require_once __DIR__."/models/User.php"; require_once __DIR__."/models/UserTypes.php"; require_once __DIR__."/models/RespondMessage.php"; require_once __DIR__."/models/Cities.php"; require_once __DIR__."/models/Zones.php"; require_once __DIR__."/models/Category.php"; require_once __DIR__."/models/Advert.php"; require_once __DIR__."/models/pagination.class.php"; ?> function seo($s) { $tr = array('ş','Ş','ı','I','İ','ğ','Ğ','ü','Ü','ö','Ö','Ç','ç','(',')','/',':',',','?','+'); $eng = array('s','s','i','i','i','g','g','u','u','o','o','c','c','','','-','-','','','-'); $s = str_replace($tr,$eng,$s); $s = strtolower($s); $s = preg_replace('/&.+?;/', '', $s); $s = preg_replace('/\s+/', '-', $s); $s = preg_replace('|-+|', '-', $s); $s = preg_replace('/#/', '', $s); $s = str_replace('.', '', $s); $s = trim($s, '-'); return $s; } class kutuphane{ public static function UploadPicture($resim,$kayitadres){ $uploads_dir = $kayitadres; $tmp_name = $resim["tmp_name"] ; $name = $resim["name"] ; move_uploaded_file($tmp_name, $uploads_dir); } public static function isMobile() { return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]); } public static function paraformat($para){ return number_format($para, 0, ',', '.'); } }?> function dilhash( $lang,$table,$col,$recordid ){ return md5($table.$col.$recordid.$lang); } function dilguncelle($dil,$table,$recordid,$col,$value){ global $dbh; $hash=dilhash($dil,$table,$col,$recordid); $sorgu = $dbh->prepare(" REPLACE INTO dil_icerik SET dil = :dil, kayithash = :kayithash, icerik = :icerik"); $sorgu->execute(array( "dil"=> $dil, "kayithash"=> $hash, "icerik"=> $value )); } function cevir( $tablo,$kayit,$dil){ global $dbh; $id=$kayit["id"]; foreach($kayit as $hucreanahtar=>$hucreveri){ $hash=dilhash($dil,$tablo,$hucreanahtar,$id); $sorgu = $dbh->prepare("SELECT * FROM dil_icerik Where kayithash=:id"); $sorgu->execute(array( "id"=> $hash )); $sonuc = $sorgu->fetch(); if(isset($sonuc["icerik"])){ $kayit[$hucreanahtar]=$sonuc["icerik"]; } } return $kayit; }?> $ip_address = $_SERVER["REMOTE_ADDR"]; $page_name = $_SERVER["SCRIPT_NAME"]; $query_string = $_SERVER["QUERY_STRING"]; $current_page = $page_name."?".$query_string; /** @var PDO $dbh */ if(isset($_SESSION["tracking"])){ //update the visitor log in the database, based on the current visitor //id held in $_SESSION["visitor_id"] $visitor_id = isset($_SESSION["visitor_id"])?$_SESSION["visitor_id"]:0; if($_SESSION["current_page"] != $current_page) { $sql = "INSERT INTO visitor_tracking (ip_address, page_name, query_string, visitor_id) VALUES ('$ip_address', '$page_name', '$query_string', '$visitor_id')"; $f = $dbh->prepare($sql); $f ->execute(); $_SESSION["current_page"] = $current_page; } } else { //set a session variable so we know that this visitor is being tracked //insert a new row into the database for this person $sql = "INSERT INTO visitor_tracking (ip_address, page_name, query_string) VALUES ('$ip_address', '$page_name', '$query_string')"; $f = $dbh->prepare($sql); $f ->execute(); //find the next available visitor_id for the database //to assign to this person $_SESSION["tracking"] = true; $entry_id = $dbh->lastInsertId(); $lowest_sql = ($dbh->prepare("SELECT MAX(visitor_id) as next FROM visitor_tracking")); $lowest_sql->execute(); $lowest_sql = $lowest_sql->fetch(PDO::FETCH_ASSOC); $lowest = $lowest_sql["next"]; if(!isset($lowest)) $lowest = 1; else $lowest++; //update the visitor entry with the new visitor id //Note, that we do it in this way to prevent a "race condition" $ffexecute= ($dbh->prepare("UPDATE visitor_tracking SET visitor_id = '$lowest' WHERE entry_id = '$entry_id'")); $ffexecute->execute(); //place the current visitor_id into the session so we can use it on //subsequent visits to track this person $_SESSION["visitor_id"] = $lowest; //save the current page to session so we don't track if someone just refreshes the page $_SESSION["current_page"] = $current_page; }