"); //# | exit("'); return; } function Putsaa($string) { if(get_magic_quotes_gpc()) // prevents duplicate backslashes { $string = stripslashes($string); } if (phpversion() >= '4.3.0') { $string = mysql_real_escape_string($string); } else { $string = mysql_escape_string($string); } return $string; } function logger($message,$info){ global $db, $user; $tlog=date("Y-m-d H:i:s"); $ip=$_SERVER['REMOTE_ADDR']; $sql="INSERT INTO tap_logger VALUES('','$tlog','$ip','$message','$info');"; $db->sql_query($sql); return; } function pagespeed($speed){ global $db; $tlog=date("Y-m-d H:i:s"); $sql="INSERT INTO tap_pageloadtime VALUES('','$tlog','$speed');"; $db->sql_query($sql); return; } function Valikko() { global $user, $db; $profiilit=0; $sql="SELECT COUNT(1) FROM tap_org_usr WHERE uid='".$user['id']."';"; $numprof=$db->sql_fetchrow($db->sql_query($sql)); $profiilit=$numprof[0]; if($profiilit=="0" && $user['role']<8){ // jos ei ole: $profiilit="Ei profiileja"; $tadd=" "; }else{ $profiilit="Profiilit"; $tadd="Lisää tapahtuma"; } $tapahtumat=0; $sql="SELECT COUNT(1) FROM tap_eve INNER JOIN tap_org_usr ON tap_eve.oid=tap_org_usr.oid WHERE tap_org_usr.uid='".$user['id']."';"; $numeve=$db->sql_fetchrow($db->sql_query($sql)); $tapahtumat=(int)$numeve[0]; if($tapahtumat=="0" && $user['role']<8){ // jos ei ole: $tapahtumat="Ei tapahtumia"; }else{ $tapahtumat="Tapahtumat"; } echo "
"; echo "

Hallintapaneeli: ".$user['email']."

"; echo "

"; //echo ""; echo ""; echo ""; // adminin kilkkeet tähän: if($user['role']>=8){ // etitään anon ilmot: $sqlanon="SELECT id FROM tap_eve WHERE piilotettu=1;"; $resanon=$db->sql_fetchrowset($db->sql_query($sqlanon)); $numanon=$db->sql_numrows(); $sqlnew="SELECT id FROM tap_eve WHERE tarkistettu=0 AND piilotettu=0;"; $resnew=$db->sql_fetchrowset($db->sql_query($sqlnew)); $numnew=$db->sql_numrows(); $cleanup=date("Y-m-d H:i:s",time()-86400); $sqlact="SELECT id FROM tap_act WHERE aika<'".$cleanup."';"; $resact=$db->sql_fetchrowset($db->sql_query($sqlact)); $numact=$db->sql_numrows(); echo ""; echo ""; //logger("Admin","viewed panel"); } //echo ""; echo "
Käyttäjä:Lisää:Selaa:
Omat tiedotLisää järjestäjä profiili$tadd
 $profiilit$tapahtumat
Admin:
Anon: $numanonUudet: $numnewAct cleanup: $numact

"; echo "
"; } function sendmaili($kelle, $otsikko, $viesti) { if(empty($kelle)||empty($otsikko)||empty($viesti)){ return "Sisäinen virhe."; } else{ $ypitomail="ilmoitukset@tapahtumia.fi"; $yhttiedot="\n\nYstävällisin terveisin\n\nYlläpito\nwww.Tapahtumia.fi\ne-mail: ilmoitukset@tapahtumia.fi"; $viesti=$viesti.$yhttiedot; mail($kelle,'=?iso-8859-1?B?'.base64_encode($otsikko).'?=',$viesti,"From: $ypitomail"); return ""; } } function spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field=filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)){ return TRUE; } else{ return FALSE; } } function passu($pituus) { $characters = array( "A","B","C","D","E","F","G","H","J","K","L","M", "N","P","Q","R","S","T","U","V","W","X","Y","Z", "a","b","c","d","e","f","g","h","j","k","l","m", "n","p","q","r","s","t","u","v","w","x","y","z", "2","3","4","5","6","7","8","9"); $keys = array(); while(count($keys) < $pituus) { $x = mt_rand(0, count($characters)-1); if(!in_array($x, $keys)) { $keys[] = $x; } } foreach($keys as $key){ $random_chars .= $characters[$key]; } return $random_chars; } function utf8_wordwrap($str, $width = 90, $break = "\n") // wordwrap() with utf-8 support { //$str = preg_split('/([\x20\r\n\t]++|\xc2\xa0)/sSX', $str, -1, PREG_SPLIT_NO_EMPTY); $str=explode("
",$str); foreach($str as $a) { $tmpstr.=$a; } //echo"[STR]".$tmpstr."
"; $len = 0; foreach ($str as $val) { $val .= ' '; $tmp = mb_strlen($val, 'utf-8'); $len += $tmp; if ($len >= $width) { $return .= "
".$break . $val; $len = $tmp; } else $return .= $val; } return $return; } function session_defaults() { $_SESSION['logged'] = false; $_SESSION['uid'] = 0; $_SESSION['username'] = ''; $_SESSION['cookie'] = 0; $_SESSION['remember'] = false; } class User { //var $db = null; // PEAR::DB pointer //global $db; var $failed = false; // failed login attempt var $date; // current date GMT var $id = 0; // the current user's id //function User(&$db) function User() { //$this->db = $db; $this->date = $GLOBALS['date']; if ($_SESSION['logged']) { $this->_checkSession(); } elseif(isset($_COOKIE['tp.fi'])) { $this->_checkRemembered($_COOKIE['tp.fi']); } } function _checkLogin($usrname, $passwd, $remember) { global $db; $username = $usrname; $password = md5($passwd); $sql = "SELECT * FROM member WHERE uname = $username AND pw = $password"; $result = $db->sql_query($sql); if(is_object($result)) { $this->_setSession($result, $remember); return true; } else { $this->failed = true; $this->_logout(); return false; } } function _setSession(&$values, $remember, $init = true) { $this->id = $values->id; $_SESSION['uid'] = $this->id; $_SESSION['username'] = htmlspecialchars($values->uname); $_SESSION['cookie'] = $values->keksi; $_SESSION['logged'] = true; if($remember) { $this->updateCookie($values->cookie, true); } if ($init) { $session = session_id(); $ip = $this->db->quote($_SERVER['REMOTE_ADDR']); $sql = "UPDATE member SET session = $session, ip = $ip WHERE " . "id = $this->id"; $this->db->query($sql); } } function _checkSession() { global $db; $username = $_SESSION['username']; $cookie = $_SESSION['cookie']; $session = session_id(); $ip = $_SERVER['REMOTE_ADDR']; $sql = "SELECT * FROM sl_admin WHERE (uname = $username) AND (keksi = $cookie) AND (sess = $session) AND (ip = $ip)"; $result = $db->sql_query($sql); if(is_object($result)) { $this->_setSession($result, false, false); } else { $this->_logout(); } } function updateCookie($cookie, $save) { $_SESSION['cookie'] = $cookie; if ($save) { $cookie = serialize(array($_SESSION['username'], $cookie) ); set_cookie('satulife', $cookie, time() + 31104000, '/satulife/'); } } } function opendb() { $yht = mysql_connect("localhost", "poro", "fg445er33"); mysql_select_db("poro", $yht) or die ("Tietokantaa ei löytynyt"); return($yht); } //tarkistetaa admin oikat: function IsAdmin($userid,$passwd) { // echo "userid: ".$userid."
pass: ".$passwd."
"; $yhteys=opendb(); $sql="SELECT * FROM user WHERE uID='$userid' AND uSalasana='$passwd'"; $result=mysql_query($sql,$yhteys) or die("Virhe a&s parissa!!!"); $num=mysql_num_rows($result); $rivi=mysql_fetch_array($result); //echo "leveli: ".$rivi['ulvl']."
num: ".$num."
"; if($rivi['ulvl']==2) { return 1; } return 0; } //tarkistetaa user oikat: function IsUser($usid,$pass) { $yhteys=opendb(); $sql="SELECT * FROM user WHERE uID='$usid' AND uSalasana='$pass'"; $result=mysql_query($sql,$yhteys) or die("Virhe a&s parissa!!!"); $num=mysql_num_rows($result); $rivi=mysql_fetch_array($result); if($rivi['ulvl']==1) { return 1; } return 0; } // HTML-tagit /n (newline) constantiks: function br2nl($text) { return str_replace( "
", chr(13).chr(10), $text ); //return eregi_replace('',chr(13).chr(10),$text); } function br_pois($text) { $text=str_replace( "
", " ", $text ); return preg_replace('/\s+/', ' ', $text); } function nltobr($text) { return str_replace(array("\r\n", "\n","\r"), "
", $text); } //näytä pvm function naytapvm($paiva) { list($year, $month, $date) = explode("-", $paiva); list($date,$time)=explode(" ",$date); echo $date."." .$month.".". $year; } //getpvm function getpvm($paiva) { list($year, $month, $date) = explode("-", $paiva); list($date,$time)=explode(" ",$date); //echo $date."." .$month.".". $year; $pvm=$date."." .$month.".". $year; return $pvm; } function gettime($aika) { //list($year, $month, $date) = explode("-", $time); list($date,$time)=explode(" ",$aika); return $time; } function ranpass($len = "8") { $pass = NULL; for($i=0; $i<$len; $i++) { $char = chr(rand(48,122)); while (!ereg("[a-zA-Z0-9]", $char)) { if($char == $lchar) continue; $char = chr(rand(48,90)); } $pass .= $char; $lchar = $char; } return $pass; } } //end of defined ?> - Tapahtumia.fi - Ilmoita ilmaiseksi - Koko Suomen kattava tapahtuma kalenteri - $onloading=""; if($_GET['p']=="nayta" || $_GET['p']=="jarjestaja" || $_GET['p']=="paikka"){ $onloading=" onload=\"initialize(); codeAddress();\""; echo ""; echo ""; } ?> "; ?>
 
- Tapahtumia.fi -
       
Toukokuu 26. 2015
· Linkit  
     
           
Kirjaudu
Tunnus:
Salasana:
 
Rekisteröidy tästä.
Mainoksia: