version 2.12 video comments
for people who have upgraded and have lost the video comments function,
replace your functions.php file with this one
(this will be fixed in v3)
Code:
<?
// start v2.12 new functions
// searchform(*)
// * can be h or v
// horizontal or vertical
function searchform($option) {
global $website , $root_url;
$action = $website.$root_url."?option=search";
if ($option=="h") {
return '<form name="search" action="'.$action.'" method="post"><input type="text" name="search" /><input type="submit" value="Search" /></form>';
} else if ($option=="v") {
return '<center><form name="search" action="'.$action.'" method="post"><input type="text" name="search" /><br /><input type="submit" value="Search" /></form></center>';
}
}
// search page, called from the content() function
// would prefer match against, but our field is not fulltext
// maybe change this in later releases?
// might cause problems for existing users
// maybe we can alter the tables?
function search($q) {
global $lcl,$sutun,$satir,$cache_time;
$title = "<h1 class=\"title\">".$lcl['search_results'].": ".urldecode($q)."</h1>";
$novideo = "<h1 class=\"title\">".$lcl['search_novideo']."</h1>";
$noinput = "<h1 class=\"title\">".$lcl['search_noinput']."</h1>";
if (!$q) {
return $noinput;
} else {
$sayfa = 1;
$adet = $satir*$sutun;
if ($i==""){$i=0;}
if(isset($_GET['p'])) {
$sayfa = temizle($_GET['p']);
}
$offset = ($sayfa - 1) * $adet;
echo 'debug: '.$offset.' - '.$adet.'<br />';
//$sayfalama = pager("video where `title` rlike ('.*[[:<:]]".$q."[[:>:]].*')",$adet,"?p=#p#");
db_baglan();
$sayfalama = pager("video where `title` like '%$q%'",$adet,"?option=search&search=".$q."&p=#p#");
db_baglan();
$sorgu = "select * from video where `title` like '%$q%' order by `title` asc limit ".$offset.",".$adet."";
$result = mysql_query($sorgu) or die(mysql_error());
$return = $title.'<br />'.$sayfalama.'<table><tr>';
if(mysql_affected_rows()>0) {
while($row = mysql_fetch_array($result)) {
if ($video_link=="") {
$video_link="?option=video&id=#id&title=#title";
}
$linki=str_replace('#id',$row['v_id'],$video_link);
$linki=str_replace('#title',$row['title'],$linki);
$return=$return.'<td valign="top">
<div class="video">
<a href="'.$root_url.$linki.'"><img multiple_thumbnail_url="g" class="video-thumb" border="0" src="'.$root_url.'img/thumb/'.$row['v_id'].'_0.jpg" num="'.$row['num'].'" id="thumb'.($i+1).'" alt="'.urldecode($row['title']).'" width="160" height="120" />
'.substr(urldecode($row['title']),0,25).'...</a></div>
</td>';
if ($i % $sutun==$sutun-1) {
$return=$return."</tr>";
}
$i=$i+1;
}
} else { return $novideo; }
return $return.'</tr></table>'.$sayfalama.'';
}
}
// featured()
// open featured.txt and put one video id per line
function featured($show,$option) {
global $website,$root_url,$sutun,$satir,$lcl,$video_link;
$filename = $website.$root_url.'featured.txt';
$filelines = $show;
db_baglan();
if ($option=="h") {
$data='<h1 class="title">'.$lcl['featured_videos'].'</h1><table><tr>';
if ($fileContents = file($filename)) {
for ($i = 0; $i < $filelines; $i++) {
$v_id = ($fileContents[$i]);
$query="Select * from video where v_id='$v_id'";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_array($result)) {
if ($video_link=="") {
$video_link="?option=video&id=#id&title=#title";
}
$linki=str_replace('#id',$row['v_id'],$video_link);
$linki=str_replace('#title',$row['title'],$linki);
$data=$data.'<td valign="top">
<div class="video">
<a href="'.$root_url.$linki.'"><img multiple_thumbnail_url="g" class="video-thumb" border="0" src="'.$root_url.'img/thumb/'.$row['v_id'].'_0.jpg" num="'.$row['num'].'" id="thumb'.($i+1).'" alt="'.urldecode($row['title']).'" width="160" height="120" />
'.substr(urldecode($row['title']),0,25).'...</a></div>
</td>';
}
}
}
return $data.'</tr><tr><td colspan="'.$sutun.'"><hr></td></tr></table>';
}
} else if ($option=="v") {
$data='<h1 class="title">'.$lcl['featured_videos'].'</h1><table>';
if ($fileContents = file($filename)) {
for ($i = 0; $i < $filelines; $i++) {
$v_id = ($fileContents[$i]);
$query="Select * from video where v_id='$v_id'";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_array($result)) {
if ($video_link=="") {
$video_link="?option=video&id=#id&title=#title";
}
$linki=str_replace('#id',$row['v_id'],$video_link);
$linki=str_replace('#title',$row['title'],$linki);
$data=$data.'<tr><td valign="top">
<div class="video">
<a href="'.$root_url.$linki.'"><img multiple_thumbnail_url="g" class="video-thumb" border="0" src="'.$root_url.'img/thumb/'.$row['v_id'].'_0.jpg" num="'.$row['num'].'" id="thumb'.($i+1).'" alt="'.urldecode($row['title']).'" width="160" height="120" />
'.substr(urldecode($row['title']),0,25).'...</a></div>
</td></tr>';
}
}
}
return $data.'</table>';
}
}
}
// end v2.12 new functions
function right_one()
{
include 'tmp/html/right_one.php';
}
function right_two()
{
include 'tmp/html/right_two.php';
}
function left_one()
{
include 'tmp/html/left_one.php';}
function left_two()
{
include 'tmp/html/left_two.php';}
function left_tree()
{
include 'tmp/html/left_tree.php';}
function center_up()
{
include 'tmp/html/center_up.php';}
function center_down()
{
include 'tmp/html/center_down.php';}
function tepe_reklam()
{
include 'tmp/html/header.php';}
function left_side()
{
global $kolonlar;
left_one();
if ($_GET['option']=="games" || $_GET['option']=="game" || $_GET['option']=="populargames" || $_GET['option']=="category_game" || $_GET['option']=="tag_game")
{
echo categories_game();
left_two();
echo recent_game_comments();
left_tree();
if ($kolonlar=="sol.css") {
echo taglar_game();
}
}
else
{
echo categories();
left_two();
echo recent_comments();
left_tree();
if ($kolonlar=="sol.css") {
echo taglar();
}
}
}
function right_side()
{
global $kolonlar;
right_one();
if ($_GET['option']=="games" || $_GET['option']=="game" || $_GET['option']=="populargames" || $_GET['option']=="category_game" || $_GET['option']=="tag_game")
{
if ($kolonlar=="sag.css") {
echo categories_game();
echo recent_game_comments();
}
echo taglar_game();
}
else {
if ($kolonlar=="sag.css") {
echo categories();
echo recent_comments();
}
echo taglar();
}
right_two();
}
function content() {
global $lcl;
switch ($_GET['option']) {
case "search":
$q = urlencode($_POST['search']);
if(!$q) { $q = urlencode($_GET['search']); }
return search($q);
break;
case "video":
global $video_arr;
return '<h1 class="title">'.$video_arr[1].' </h1><center>'.$video_arr[2].'<br />'.$video_arr[3].'<br /><br />'.$video_arr[4].'<br />'.$lcl['relatedvideos'].':<br />'.tablo(true,true).'</center>';
break;
case "game":
global $game_arr;
return '<h1 class="title">'.$game_arr[1].' </h1><center>'.$game_arr[2].'<br />'.$game_arr[3].'<br /><br />'.$game_arr[4].'<br />'.$lcl['relatedgames'].':<br />'.tablo_games(true,true).'</center>';
break;
case "tag":
return '<h1 class="title">'.$_GET['tag'].' </h1> <center>'.tablo(false,true).' </center> <hr />'.encok().' <hr />'.google_kelimeler();
break;
case "tag_game":
return '<h1 class="title">'.$_GET['tag'].' </h1> <center>'.tablo_games(false,true).' </center> <hr />'.encok_game().' <hr />'.google_game_kelimeler();
break;
case "popular":
return '<h1 class="title">'.$lcl['popularvideos'].' </h1> <center>'.tablo(false,false,false,true).' </center>';
break;
case "populargames":
return '<h1 class="title">'.$lcl['populargames'].' </h1> <center>'.tablo_games(false,false,false,true).' </center>';
break;
case "category":
return '<h1 class="title">'.$_GET['category'].' </h1> <center>'.tablo(false,false,true).' </center>';
break;
case "category_game":
return '<h1 class="title">'.$_GET['category'].' </h1> <center>'.tablo_games(false,false,true).' </center>';
break;
case "contact":
return '<h1 class="title">'.$lcl['contact'].' </h1> <center>'.contact().' </center>';
break;
case "games":
return '<center>'.tablo_games().' </center>';
break;
default:
return '<h1 class="title">'.$lcl['recently_added'].'</h1><center>'.tablo().' </center>';
}
}
function call_menuler()
{
global $root_url,$lcl;
return '<li><a href="'.$root_url.'">'.$lcl['homepage'].'</a></li>
<li><a href="'.$root_url.'?option=popular">'.$lcl['popularvideos'].'</a></li>
<li><a href="/blog/">Amateur blog</a><li>
<li><a href="http://www.hotamateurchat.com/?w=12163&ws=1107001 ">Webcam</a><li>
<li><a href="mailto:[email protected]" target="_blank">Contact</a></li>';
}
function call_metalar()
{
tag_kaydet();
tag_game_kaydet();
global $metalar,$meta_title,$meta_keywords,$meta_description,$root_url,$template,$kolonlar;
return '<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>'.$metalar.$meta_title.'</title>
<meta name="keywords" content="'.$metalar.$meta_keywords.'">
<meta name="description" content="'.$metalar.$meta_description.'">
<meta name="allow-search" content="yes">
<meta name="robots" content="follow">
<meta name="revisit-after" content="1 days">
<meta name="rating" content="general">
<link href="'.$root_url.'css/main.css" rel="stylesheet" type="text/css" media="screen" />
<link href="'.$root_url.'template/'.$template.'/default.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="stylesheet" type="text/css" href="'.$root_url.'template/'.$template.'/'.$kolonlar.'" />';
}
function email_gonder($adresi, $adi, $konusu, $mesaji)
{
global $email;
$headers="From: ".$adi." <".$adresi.">\r\n";
$headers=$headers."MIME-Version: 1.0\r\n";
$headers=$headers."Content-type: text/HTML; charset=iso-8859-9\r\n";
$mesaji="Name : ".$adi."<br>E-mail:".$adresi."<br>Subject:".$konusu."<br><br>".$mesaji;
mail($email,$konusu,$mesaji,$headers);
}
function contact()
{
global $root_url,$lcl;
if ($_POST['name']) {
if (intval($_POST['security'])!=$_SESSION['security'])
{$mesaj="<font color='red'>".$lcl['contact_security_err2']."</font>";}
else
{
$check1 = 'http';
$check2 = 'www.';
$spamcheck = strpos($_POST['mesaj'],$check1);
$spamcheck = strpos($_POST['mesaj'],$check2);
if($spamcheck === false) {
email_gonder($_POST['email'],$_POST['name'],$_POST['subject'],$_POST['mesaj']); $mesaj=$lcl['contact_succes'];
} else {
echo '<script language="javascript">
alert("'.$lcl['spammer'].'");
</script>';
}
}
}
$form='<br>'.$mesaj.'<br><form name="contact" onsubmit="return denetle()" method="post">
<table>
<tr><td>'.$lcl['contact_name'].' : </td><td><input type="text" size="40" value="'.$_POST['name'].'" name="name" id="name" /></td></tr>
<tr><td>'.$lcl['contact_email'].' : </td><td><input type="text" size="40" value="'.$_POST['email'].'" name="email" id="email" /></td></tr>
<tr><td>'.$lcl['contact_subject'].' : </td><td><input type="text" size="40" value="'.$_POST['subject'].'" name="subject" id="subject" /></td></tr>
<tr><td>'.$lcl['contact_message'].' :</td><td> <textarea rows="10" cols="30" name="mesaj" id="mesaj">'.$_POST['mesaj'].'</textarea></td></tr>
<tr><td>'.$lcl['contact_security'].' :</td><td><input name="security" id="security" /> <img src="'.$root_url.'captcha.php"></td></tr>
<tr><td colspan=2> <input type="submit" value="'.$lcl['send'].'" /></td></tr></table>
</form>
<script language="javascript">
function denetle()
{
if (document.getElementById("name").value=="") {alert("'.$lcl['contact_name_err'].'");return false;}
if (document.getElementById("email").value=="") {alert("'.$lcl['contact_email_err'].'");return false;}
if (document.getElementById("subject").value=="") {alert("'.$lcl['contact_subject_err'].'");return false;}
if (document.getElementById("mesaj").value=="") {alert("'.$lcl['contact_message_err'].'");return false;}
if (document.getElementById("security").value=="") {alert("'.$lcl['contact_security_err'].'");return false;}
return true;
}
</script>';
return $form;
}
function db_baglan()
{
global $sunucu,$db_username,$db_password,$db_database,$conn;
$conn = mysql_connect($sunucu,$db_username,$db_password);
if (!$conn)
{
return false;
}
mysql_select_db($db_database, $conn);
return true;
}
function temizle($x)
{
$x=str_ireplace("'","",$x);
$x=str_ireplace(" and ","",$x);
$x=str_ireplace(" or ","",$x);
$x=str_ireplace("delete ","",$x);
$x=str_ireplace("select ","",$x);
$x=str_ireplace(" user ","",$x);
$x=str_ireplace(" where ","",$x);
$x=str_ireplace("drop ","",$x);
$x=str_ireplace("exec ","",$x);
$x=str_ireplace("update ","",$x);
$x=str_ireplace("insert ","",$x);
$x=str_ireplace("into ","",$x);
$x=str_ireplace("union ","",$x);
$x=str_ireplace("concat ","",$x);
$x=str_ireplace("admin ","",$x);
return $x;
}
function tag_al()
{
return $_GET['tag'];
}
function tablo($related=false,$rastgele=false,$kategori=false,$popular=false)
{
global $cache_time;
$sayfa = 1;
if(isset($_GET['p']))
{
$sayfa = temizle($_GET['p']);
}
if ($related) {$cache_id=temizle($_GET['id']);$cache_group="related_v";} //video altindaki alakali videolar
else if ($related==false & $rastgele==false) {$cache_id=$sayfa;$cache_group="index_v";} // index sayfasindaki sayfalamali videolar
else if ($related==false & $rastgele==true) {$cache_id=tag_al();$cache_group="tag_v";}
if ($kategori) {$cache_id=temizle($_GET['id']).$sayfa;$cache_group="kategori_v";}
if ($popular) {$cache_id="popular";$cache_group="popular_v";}
$options = array(
'cacheDir' => 'tmp/tablo/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get($cache_id,$cache_group)) {
return $data;
} else {
global $sutun,$satir,$video_link,$conn,$kaynak_url,$root_url,$category_link;
if ($related){$satir=3;}
$adet=$satir*$sutun;
if ($rastgele)
{
if ($related) { //video ile alakali
$sorgu=get_tags3(temizle($_GET['id']));
if ($sorgu!="()") {
$sorgu="select * from tag where ".$sorgu." GROUP BY v_id limit ".$adet;
//echo $sorgu."<br>";
db_baglan();
$result = mysql_query($sorgu);
$sql_sorgu2="(";
while($row = mysql_fetch_array($result))
{
if ($sql_sorgu2=="(") {
$sql_sorgu2=$sql_sorgu2." v_id=".$row['v_id'];}
else {
$sql_sorgu2=$sql_sorgu2." or v_id=".$row['v_id'];}
}
$sql_sorgu2=$sql_sorgu2.")";
$sql_sorgu3=str_replace("or v_id=","and v_id!=",$sql_sorgu2);
$sql_sorgu3=str_replace("v_id=","v_id!=",$sql_sorgu3);
mysql_close($conn);
}
}
else
{ // tag ile alakali
$sorgu="select * from tag where kelime='".urlencode(temizle($_GET['tag']))."' and v_id!=0 limit ".$adet;
//echo $sorgu."<br>";
db_baglan();
$result = mysql_query($sorgu);
$sql_sorgu2="(";
while($row = mysql_fetch_array($result))
{
if ($sql_sorgu2=="(") {
$sql_sorgu2=$sql_sorgu2." v_id=".$row['v_id'];}
else {
$sql_sorgu2=$sql_sorgu2." or v_id=".$row['v_id'];}
}
$sql_sorgu2=$sql_sorgu2.")";
$sql_sorgu3=str_replace("or v_id=","and v_id!=",$sql_sorgu2);
$sql_sorgu3=str_replace("v_id=","v_id!=",$sql_sorgu3);
mysql_close($conn);
}
}
else
{
$offset = ($sayfa - 1) * $adet;
if ($kategori) {
if ($category_link=="") {$linkim='?id=#id&category=#category&option=category&p=#p#';} else {$linkim=$category_link;}
$linkim=str_replace('#id',temizle($_GET['id']),$linkim);
$linkim=str_replace('#category',urlencode($_GET['category']),$linkim);
$linkim=str_replace('#p','#p#',$linkim);
$linkim=$root_url.$linkim;
$sql_sorgu=" and category=".temizle($_GET['id'])." order by tarih desc limit ".$offset.",".$adet;
$sayfalama=pager("video where tamam=1 and category=".temizle($_GET['id']),$adet,$linkim);
}
else if ($popular)
{$sql_sorgu=" order by hit desc limit ".$adet;}
else {
$sql_sorgu=" order by tarih desc limit ".$offset.",".$adet;
$sayfalama=pager("video where tamam=1",$adet,"?p=#p#");
}
}
db_baglan();
$sql_sorgu="Select * from video where tamam=1 ".$sql_sorgu;
$data=$sayfalama."<table>";
if ($rastgele)
{
if ($sql_sorgu2!="" & $sql_sorgu2!="()")
{
$sql_sorgu2="Select * from video where tamam=1 and ".$sql_sorgu2." order by tarih desc";
$result = mysql_query($sql_sorgu2);
if ($i==""){$i=0;}
$cikacak=mysql_affected_rows();
if(mysql_affected_rows()>0) {
while($row = mysql_fetch_array($result))
{
$title=urldecode($row['title']);
if ($i % $sutun==0) {$data=$data."<tr>";}
if ($video_link==""){$video_link="?option=video&id=#id&title=#title";}
$linki=str_replace('#id',$row['v_id'],$video_link);
$linki=str_replace('#title',$row['title'],$linki);
$cat_id = $row['category'];
$result2 = mysql_query("select * from category where `id` = '$cat_id'");
$cat_tot = mysql_num_rows($result2);
while ($row2 = mysql_fetch_array($result2))
{
$category = urldecode($row2['category']);
}
$data=$data.'<td valign="top"><a href="'.$root_url.$linki.'"><div align="center"><img multiple_thumbnail_url="g" class="video-thumb" border="0" src="'.$root_url.'img/thumb/'.$row['v_id'].'_0.jpg" num="'.$row['num'].'" id="thumb'.($i+1).'" alt="'.urldecode($row['title']).'" width="160" height="120" /></div>'.urldecode($row['title']).'</a><br>Category: '.$category.'<br>Views: '.$row['hit'].'</<br>Comments: $com_tot</td>';
$vid_id = $row['v_id'];
$result2 = mysql_query("select * from comments where `v_id` = '$vid_id'");
$com_tot = mysql_num_rows($result2);
if ($i % $sutun==$sutun-1) {$data=$data."</tr>";}
$i=$i+1;
}
}
}
$adet=$adet-$cikacak;
if ($cikacak>0) {
$sql_sorgu="Select * from video where tamam=1 and ".$sql_sorgu3." order by rand() limit ".$adet; }
else {
$sql_sorgu="Select * from video where tamam=1 order by rand() limit ".$adet; }
}
if ($adet>0) {
//$result = mysql_query("Select * from video2 where tamam=1 order by id limit 1,18");
$result = mysql_query($sql_sorgu);
if ($i==""){$i=0;}
if(mysql_affected_rows()>0) {
while($row = mysql_fetch_array($result))
{
$title=urldecode($row['title']);
if ($i % $sutun==0) {$data=$data."<tr>";}
if ($video_link==""){$video_link="?option=video&id=#id&title=#title";}
$linki=str_replace('#id',$row['v_id'],$video_link);
$linki=str_replace('#title',$row['title'],$linki);
$data=$data.'<td valign="top">
<div class="video">
<a href="'.$root_url.$linki.'">
<img multiple_thumbnail_url="g" class="video-thumb" border="0" src="'.$root_url.'img/thumb/'.$row['v_id'].'_0.jpg" num="'.$row['num'].'" id="thumb'.($i+1).'" alt="'.urldecode($row['title']).'" width="160" height="120" />
'.substr(urldecode($row['title']),0,20).'...</a></div>
</td>';
if ($i % $sutun==$sutun-1) {$data=$data."</tr>";}
$i=$i+1;
}
}
mysql_close($conn);
$dondur=$data.'</table>'.$sayfalama.' <script type="text/javascript" src="http://yui.yahooapis.com/combo?2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js&2.8.0r4/build/element/element-min.js&2.8.0r4/build/container/container-min.js&2.8.0r4/build/connection/connection-min.js"></script>
<script type="text/javascript" src="'.$root_url.'thumbchange-r5.js"></script>
<script type="text/javascript">
YAHOO.youporn.thumbchange.register('.($adet+1).', \'thumb\');
</script> ';
if ($cache_group=="tag_v")
{
if (google_referans()==true) {$cache->save($dondur);}
}
else {$cache->save($dondur);}
return $dondur;
}
else {return false;}
}
}
function tablo_games($related=false,$rastgele=false,$kategori=false,$popular=false)
{
global $cache_time;
$sayfa = 1;
if(isset($_GET['p']))
{
$sayfa = temizle($_GET['p']);
}
if ($related) {$cache_id=temizle($_GET['id']);$cache_group="related_g";} //video altindaki alakali videolar
else if ($related==false & $rastgele==false) {$cache_id=$sayfa;$cache_group="index_g";} // index sayfasindaki sayfalamali videolar
else if ($related==false & $rastgele==true) {$cache_id=tag_al();$cache_group="tag_g";}
if ($kategori) {$cache_id=temizle($_GET['id']).$sayfa;$cache_group="kategori_g";}
if ($popular) {$cache_id="popular";$cache_group="popular_g";}
$options = array(
'cacheDir' => 'tmp/tablo_game/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get($cache_id,$cache_group)) {
return $data;
} else {
global $sutun_game,$satir_game,$game_link,$conn,$kaynak_url,$root_url,$category_game_link;
if ($related){$satir_game=3;}
$adet=$satir_game*$sutun_game;
if ($rastgele)
{
if ($related) { //video ile alakali
$sorgu=get_tags3(temizle($_GET['id']),"tag_game");
if ($sorgu!="()") {
$sorgu="select * from tag_game where ".$sorgu." GROUP BY v_id limit ".$adet;
db_baglan();
$result = mysql_query($sorgu);
$sql_sorgu2="(";
while($row = mysql_fetch_array($result))
{
if ($sql_sorgu2=="(") {
$sql_sorgu2=$sql_sorgu2." v_id=".$row['v_id'];}
else {
$sql_sorgu2=$sql_sorgu2." or v_id=".$row['v_id'];}
}
$sql_sorgu2=$sql_sorgu2.")";
$sql_sorgu3=str_replace("or v_id=","and v_id!=",$sql_sorgu2);
$sql_sorgu3=str_replace("v_id=","v_id!=",$sql_sorgu3);
mysql_close($conn);
}
}
else
{ // tag ile alakali
$sorgu="select * from tag_game where kelime='".urlencode(temizle($_GET['tag']))."' and v_id!=0 limit ".$adet;
//echo $sorgu."<br>";
db_baglan();
$result = mysql_query($sorgu);
$sql_sorgu2="(";
while($row = mysql_fetch_array($result))
{
if ($sql_sorgu2=="(") {
$sql_sorgu2=$sql_sorgu2." v_id=".$row['v_id'];}
else {
$sql_sorgu2=$sql_sorgu2." or v_id=".$row['v_id'];}
}
$sql_sorgu2=$sql_sorgu2.")";
$sql_sorgu3=str_replace("or v_id=","and v_id!=",$sql_sorgu2);
$sql_sorgu3=str_replace("v_id=","v_id!=",$sql_sorgu3);
mysql_close($conn);
}
}
else
{
$offset = ($sayfa - 1) * $adet;
if ($kategori) {
if ($category_game_link=="") {$linkim='?id=#id&category=#category&option=category_game&p=#p#';} else {$linkim=$category_game_link;}
$linkim=str_replace('#id',temizle($_GET['id']),$linkim);
$linkim=str_replace('#category',urlencode($_GET['category']),$linkim);
$linkim=str_replace('#p','#p#',$linkim);
$linkim=$root_url.$linkim;
$sql_sorgu=" and category=".temizle($_GET['id'])." order by tarih desc limit ".$offset.",".$adet;
$sayfalama=pager("game where tamam=1 and category=".temizle($_GET['id']),$adet,$linkim);
}
else if ($popular)
{$sql_sorgu=" order by hit desc limit ".$adet;}
else {
$sql_sorgu=" order by tarih desc limit ".$offset.",".$adet;
$sayfalama=pager("game where tamam=1",$adet,"?p=#p#&option=games");
}
}
$baglanti=db_baglan();
$sql_sorgu="Select * from game where tamam=1 ".$sql_sorgu;
$data=$sayfalama."<table>";
if ($rastgele)
{
if ($sql_sorgu2!="" & $sql_sorgu2!="()")
{
$sql_sorgu2="Select * from game where tamam=1 and ".$sql_sorgu2." order by tarih desc";
$result = mysql_query($sql_sorgu2);
if ($i==""){$i=0;}
$cikacak=mysql_affected_rows();
if(mysql_affected_rows()>0) {
while($row = mysql_fetch_array($result))
{
$title=urldecode($row['title']);
if ($i % $sutun_game==0) {$data=$data."<tr>";}
if ($game_link==""){$game_link="?option=game&id=#id&title=#title";}
$linki=str_replace('#id',$row['v_id'],$game_link);
$linki=str_replace('#title',$row['title'],$linki);
$data=$data.'<td valign="top"><a href="'.$root_url.$linki.'"><div class="video"><img multiple_thumbnail_url="g" class="video-thumb" border="0" src="'.$root_url.'img/thumb_game/'.$row['v_id'].'_0.jpg" num="'.$row['num'].'" id="thumb'.($i+1).'" alt="'.urldecode($row['title']).'" width="160" height="120" /></div>'.urldecode($row['title']).'</a></td>';
if ($i % $sutun_game==$sutun_game-1) {$data=$data."</tr><tr><td colspan='".$sutun_game."'><hr /></td></tr>";}
$i=$i+1;
}
}
}
$adet=$adet-$cikacak;
if ($cikacak>0) {
$sql_sorgu="Select * from game where tamam=1 and ".$sql_sorgu3." order by rand() limit ".$adet; }
else {
$sql_sorgu="Select * from game where tamam=1 order by rand() limit ".$adet; }
}
if ($adet>0) {
//$result = mysql_query("Select * from video2 where tamam=1 order by id limit 1,18");
$result = mysql_query($sql_sorgu);
if ($i==""){$i=0;}
if(mysql_affected_rows()>0) {
while($row = mysql_fetch_array($result))
{
$title=urldecode($row['title']);
if ($i % $sutun_game==0) {$data=$data."<tr>";}
if ($game_link==""){$game_link="?option=game&id=#id&title=#title";}
$linki=str_replace('#id',$row['v_id'],$game_link);
$linki=str_replace('#title',$row['title'],$linki);
$data=$data.'<td valign="top"><a href="'.$root_url.$linki.'"><div class="video"><img multiple_thumbnail_url="g" class="video-thumb" border="0" src="'.$root_url.'img/thumb_game/'.$row['v_id'].'_0.jpg" num="'.$row['num'].'" id="thumb'.($i+1).'" alt="'.urldecode($row['title']).'" width="160" height="120" /></div>'.urldecode($row['title']).'</a></td>';
if ($i % $sutun_game==$sutun_game-1) {$data=$data."</tr><tr><td colspan='".$sutun_game."'><hr /></td></tr>";}
$i=$i+1;
}
}
mysql_close($conn);
$dondur=$data.'</table>'.$sayfalama.' <script type="text/javascript" src="http://yui.yahooapis.com/combo?2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js&2.8.0r4/build/element/element-min.js&2.8.0r4/build/container/container-min.js&2.8.0r4/build/connection/connection-min.js"></script>
<script type="text/javascript" src="'.$root_url.'thumbchange-r5.js"></script>
<script type="text/javascript">
YAHOO.youporn.thumbchange.register('.($adet+1).', \'thumb\');
</script> ';
if ($cache_group=="tag_g")
{
if (google_referans()==true) {$cache->save($dondur);}
}
else {$cache->save($dondur);}
return $dondur;
}
else {return false;}
}
}
function pager($tablo,$adet,$link)
{
global $conn;
$sayfa = 1;
$baglanti=db_baglan();
if(isset($_GET['p']))
{
$sayfa = temizle($_GET['p']);
}
$result = mysql_query("Select count(id) as toplam from ".$tablo);
$row = mysql_fetch_array($result);
$toplam=$row['toplam'];
mysql_close($conn);
$kacsayfa=$toplam/$adet;
if (strpos($kacsayfa,".")>0){$kacsayfa=intval($kacsayfa)+1;}
$sayfalama="<div class='paginator'>";
if ($sayfa>6){$linkir3=str_replace('#p#',1,$link);
$sayfalama=$sayfalama."<a href='".$linkir3."'>1</a>";}
if($sayfa>1){
$linkir2=str_replace('#p#',$sayfa-1,$link);
$sayfalama=$sayfalama."<a href='".$linkir2."'><<</a>";}
for ($i=1;$i<12;$i++)
{
$c_sayfa=$sayfa-6+$i;
if ($c_sayfa>0 && $kacsayfa>=$c_sayfa)
{
$linkir=str_replace('#p#',$c_sayfa,$link);
if ($c_sayfa==$sayfa){$sayfalama=$sayfalama."<a class='secili' href='javascript:;'>".$c_sayfa."</a>";} else { $sayfalama=$sayfalama."<a href='".$linkir."'>".$c_sayfa."</a>";}
}
}
if($kacsayfa>1 && $sayfa<$kacsayfa)
{
$linkir=str_replace('#p#',$sayfa+1,$link);
$sayfalama=$sayfalama."<a href='".$linkir."'>>></a>";
}
if(($kacsayfa-$sayfa)>5)
{
$linkir=str_replace('#p#',$kacsayfa,$link);
$sayfalama=$sayfalama."<a href='".$linkir."'>".$kacsayfa."</a>";
}
$sayfalama=$sayfalama."</div>";
return $sayfalama;
}
function categories()
{
global $cache_time;
$options = array(
'cacheDir' => 'tmp/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get('categories')) {
return $data;
} else {
global $conn,$category_link,$root_url,$lcl;
$baglanti=db_baglan();
$kategoriler='<li><h2>'.$lcl['categories'].'</h2><ul>';
$result = mysql_query("select * from category order by category");
if ($category_link==""){$linki="?id=#id&category=#category&option=category&p=1";} else {$linki=$category_link;}
while ($row = mysql_fetch_array($result))
{
$linki2=str_replace('#id',$row['id'],$linki);
$linki2=str_replace('#category',$row['category'],$linki2);
$linki2=str_replace('#p','1',$linki2);
$cat_id = $row['id'];
$result2 = mysql_query("select * from video where `category` = '$cat_id'");
$cat_tot = mysql_num_rows($result2);
$kategoriler=$kategoriler.'<li><a href="'.$root_url.$linki2.'">'.urldecode($row['category']).'</a>('.$cat_tot.')</li>';
}
$kategoriler=$kategoriler.'</ul></li>';
mysql_close($conn);
$cache->save($kategoriler);
return $kategoriler;
}
}
function categories_game()
{
global $cache_time;
$options = array(
'cacheDir' => 'tmp/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get('categories_game')) {
return $data;
} else {
global $conn,$category_game_link,$root_url,$lcl;
$baglanti=db_baglan();
$kategoriler='<li><h2>'.$lcl['categories'].'</h2><ul>';
$result = mysql_query("select * from category_game order by category");
if ($category_game_link==""){$linki="?id=#id&category=#category&option=category_game&p=1";} else {$linki=$category_game_link;}
while ($row = mysql_fetch_array($result))
{
$linki2=str_replace('#id',$row['id'],$linki);
$linki2=str_replace('#category',$row['category'],$linki2);
$linki2=str_replace('#p','1',$linki2);
$kategoriler=$kategoriler.'<li><a href="'.$root_url.$linki2.'">'.urldecode($row['category']).'</a></li>';
}
$kategoriler=$kategoriler.'</ul></li>';
mysql_close($conn);
$cache->save($kategoriler);
return $kategoriler;
}
}
function footer()
{
include 'tmp/html/footer.php';
return '<p class="copyright">© 2011 All Rights Reserved • Scripted by <a href="http://freeadultscript.com/">Free Adult Script V 2.12</a>.</p> ';
}
function tepe()
{
include 'tmp/html/tepe.php';
}
function recent_comments()
{
global $cache_time;
$options = array(
'cacheDir' => 'tmp/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get('recent_comments')) {
return $data;
} else {
global $conn,$video_link,$root_url,$lcl;
$baglanti=db_baglan();
$kategoriler='<li><h2>'.$lcl['recentcomments'].'</h2><ul>';
$result = mysql_query("select * from comments where yayin=1 order by tarih desc limit 5");
if ($video_link==""){$video_link="?option=video&id=#id&title=#title";}
while ($row = mysql_fetch_array($result))
{
$result2 = mysql_query("select * from video where v_id=".$row['v_id']);
$row2 = mysql_fetch_array($result2);
$linki=str_replace('#id',$row2['v_id'],$video_link);
$linki=str_replace('#title',$row2['title'],$linki);
$kategoriler=$kategoriler.'<li><a href="'.$root_url.$linki.'">'.substr(urldecode($row['comment']),0,60).'...</a></li>';
}
$kategoriler=$kategoriler.'</ul></li>';
mysql_close($conn);
$cache->save($kategoriler);
return $kategoriler;
}
}
function recent_game_comments()
{
global $cache_time;
$options = array(
'cacheDir' => 'tmp/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get('recent_game_comments')) {
return $data;
} else {
global $conn,$game_link,$root_url,$lcl;
$baglanti=db_baglan();
$kategoriler='<li><h2>'.$lcl['recentcomments'].'</h2><ul>';
$result = mysql_query("select * from comments_game where yayin=1 order by tarih desc limit 5");
if ($game_link==""){$game_link="?option=game&id=#id&title=#title";}
while ($row = mysql_fetch_array($result))
{
$result2 = mysql_query("select * from game where v_id=".$row['v_id']);
$row2 = mysql_fetch_array($result2);
$linki=str_replace('#id',$row2['v_id'],$game_link);
$linki=str_replace('#title',$row2['title'],$linki);
$kategoriler=$kategoriler.'<li><a href="'.$root_url.$linki.'">'.substr(urldecode($row['comment']),0,60).'...</a></li>';
}
$kategoriler=$kategoriler.'</ul></li>';
mysql_close($conn);
$cache->save($kategoriler);
return $kategoriler;
}
}
function video($id)
{
global $conn,$cache_time;
$id=temizle($id);
$baglanti=db_baglan();
mysql_query("update video set hit=hit+1 where v_id=".$id);
mysql_close($conn);
if ($_POST['comment']){post_comment();}
$options = array(
'cacheDir' => 'tmp/video/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get($id,"video")) {
$datalar=explode("###",$data);
return array(true,$datalar[0],$datalar[1],$datalar[2],$datalar[3]);
} else {
global $lcl,$kaynak_url,$comment_enable,$website,$root_url,$video_link;
$baglanti=db_baglan();
$result = mysql_query("Select * from video where v_id=".$id);
if(mysql_affected_rows()>0)
{ $row = mysql_fetch_array($result);
$description=$row['description'];
$title=$row['title'];
$kaynak=$row['kaynak'];
mysql_close($conn);
$taglari=get_tags2($id);
if($comment_enable==1){$commentti=comments();}
// video share option
if ($video_link==""){$video_link="?option=video&id=#id&title=#title";}
$linki=str_replace('#id',$row['v_id'],$video_link);
$linki=str_replace('#title',$row['title'],$linki);
$share = $lcl['share'].':<br/><textarea rows="2" cols="40"><div align="center">
<a href="'.$website.$root_url.$linki.'">
<img multiple_thumbnail_url="g" class="video-thumb" border="0" src="'.$website.$root_url.'img/thumb/'.$row['v_id'].'_0.jpg" num="'.$row['num'].'" id="thumb'.($i+1).'" alt="'.urldecode($row['title']).'" width="160" height="120" /></a>
<br /><a href="'.$website.$root_url.$linki.'">'.substr(urldecode($row['title']),0,25).'...</a></div></textarea>';
$data_v=array(true,urldecode($title),'<script type="text/javascript" src="'.$kaynak_url.'video/video.php?id='.$id.'&kaynak='.$kaynak.'"></script>
<br>'.$taglari,urldecode($description),$share.''.$commentti);
$data_2=urldecode($title).'###<script type="text/javascript" src="'.$kaynak_url.'video/video.php?id='.$id.'&kaynak='.$kaynak.'"></script>
<br>'.$taglari.'###'.urldecode($description).'###'.$share.'###'.$commentti;
$cache->save($data_2);
return $data_v;
}
else
{
return array(false);
}
}
}
function get_tags3($id,$kim="tag")
{
global $conn;
db_baglan();
$result = mysql_query("select * from ".$kim." where v_id=".$id);
$data="(";
while($row = mysql_fetch_array($result))
{
if ($data=="(")
{
$data=$data."kelime='".$row['kelime']."'";
}
else
{
$data=$data." or kelime='".$row['kelime']."'";
}
}
if ($data=="(") {$data=$data.")";} else {$data=$data.") and (v_id!=0 and v_id!=".$id.")";}
mysql_close($conn);
return $data;
}
function get_tags2($id,$kim="tag")
{
global $conn,$tag_link,$tag_game_link,$root_url;
db_baglan();
if ($kim=="tag"){
if ($tag_link=="") {$linki2="?option=tag&tag=#tag";} else {$linki2=$tag_link;}
}
else if ($kim=="tag_game"){
if ($tag_game_link=="") {$linki2="?option=tag_game&tag=#tag";} else {$linki2=$tag_game_link;}
}
$result = mysql_query("select * from ".$kim." where v_id=".$id);
$data="TAGS : ";
while($row = mysql_fetch_array($result))
{
$linki=str_replace('#tag',$row['kelime'],$linki2);
$data=$data.'<a href="'.$root_url.$linki.'">'.urldecode($row['kelime']).'</a>, ';
}
mysql_close($conn);
return $data;
}
function game($id)
{
$id=temizle($id);
global $conn,$cache_time,$root_url;
$baglanti=db_baglan();
mysql_query("update game set hit=hit+1 where v_id=".$id);
echo mysql_error();
mysql_close($conn);
if ($_POST['comment']){post_game_comment();}
$options = array(
'cacheDir' => 'tmp/game/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get($id,"game")) {
$datalar=explode("###",$data);
return array(true,$datalar[0],$datalar[1],$datalar[2],$datalar[3]);
} else {
global $kaynak_url,$comment_game_enable;
$baglanti=db_baglan();
$result = mysql_query("Select * from game where v_id=".$id);
if(mysql_affected_rows()>0)
{ $row = mysql_fetch_array($result);
$description=$row['description'];
$title=$row['title'];
mysql_close($conn);
if($comment_game_enable==1){$commentti=comments_game();}
// BU KISIM YAPILACAK
$taglari=get_tags2($id,'tag_game');
$data_v=array(true,urldecode($title),'<div id="loading" class="loading-invisible"><embed src="'.$root_url.'img/swf/'.$id.'.swf" quality="high" width="90%" height="90%" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/></embed><br />
<input type="button" onclick="document.getElementById(\'loading\').className = \'loading-invisible\';document.getElementById(\'game\').className = \'loading-visible2\';" value="Close Full Screen">
</div><div id="game"><embed src="'.$root_url.'img/swf/'.$id.'.swf" quality="high" width="500" height="400" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/></embed><br />
<input type="button" onclick="document.getElementById(\'loading\').className = \'loading-visible\'; location.href=\'#\'; document.getElementById(\'game\').className = \'loading-invisible\';" value="Full Screen"><br>'.$taglari.'</div>',urldecode($description),$commentti);
$data_2=urldecode($title).'###<div id="loading" class="loading-invisible"><embed src="'.$root_url.'img/swf/'.$id.'.swf" quality="high" width="90%" height="90%" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/></embed><br />
<input type="button" onclick="document.getElementById(\'loading\').className = \'loading-invisible\';document.getElementById(\'game\').className = \'loading-visible2\';" value="Close Full Screen">
</div><div id="game"><embed src="'.$root_url.'img/swf/'.$id.'.swf" quality="high" width="500" height="400" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/></embed><br />
<input type="button" onclick="document.getElementById(\'loading\').className = \'loading-visible\'; location.href=\'#\'; document.getElementById(\'game\').className = \'loading-invisible\';" value="Full Screen"><br>'.$taglari.'</div>###'.urldecode($description).'###'.$commentti;
// BU KISIM YAPILACAK SONU
$cache->save($data_2);
return $data_v;
}
else
{
return array(false);
}
}
}
function post_game_comment()
{
global $cache_time,$lcl;
if (intval($_POST['security'])!=$_SESSION['security'])
{
echo '<script language="javascript">
alert("'.$lcl['comment_form_security_err2'].'");
</script>';
return false;
}
$id=temizle($_GET['id']);
$adi=temizle($_POST['adi']);
$email=temizle($_POST['email']);
$comment=temizle($_POST['comment']);
$check1 = 'http';
$check2 = 'www.';
$spamcheck = strpos($comment,$check1);
$spamcheck = strpos($comment,$check2);
if($spamcheck === false) {
global $conn,$comment_game_yayin;
if ($comment_game_yayin==1) {
$options = array(
'cacheDir' => 'tmp/game/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get($id,"game")) {$cache->remove($id,"game");}
$options2 = array('cacheDir' => 'tmp/','lifeTime' => $cache_time,'pearErrorMode' => CACHE_LITE_ERROR_DIE);
$cache2 = new Cache_Lite($options2);
if ($data2 = $cache2->get('recent_game_comments') ) {$cache2->remove('recent_game_comments');}
}
else
{
echo '<script language="javascript">
alert("'.$lcl['comment_form_succes'].'");
</script>';
}
$baglanti=db_baglan();
mysql_query("INSERT INTO comments_game (adi,email,comment,v_id,tarih,yayin) VALUES ('".$adi."','".$email."','".$comment."',".$id.",now(),".$comment_game_yayin.")");
echo mysql_error();
mysql_close($conn);
} else {
echo '<script language="javascript">
alert("'.$lcl['spammer'].'");
</script>';
}
}
function post_comment()
{
global $cache_time,$lcl;
if (intval($_POST['security'])!=$_SESSION['security'])
{
echo '<script language="javascript">
alert("'.$lcl['comment_form_security_err2'].'");
</script>';
return false;
}
$id=temizle($_GET['id']);
$adi=temizle($_POST['adi']);
$email=temizle($_POST['email']);
$comment=temizle($_POST['comment']);
$check1 = 'http';
$check2 = 'www.';
$spamcheck = strpos($comment,$check1);
$spamcheck = strpos($comment,$check2);
if($spamcheck === false) {
global $conn,$comment_yayin;
if ($comment_yayin==1) {
$options = array(
'cacheDir' => 'tmp/video/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get($id,"video")) {$cache->remove($id,"video");}
$options2 = array('cacheDir' => 'tmp/','lifeTime' => $cache_time,'pearErrorMode' => CACHE_LITE_ERROR_DIE);
$cache2 = new Cache_Lite($options2);
if ($data2 = $cache2->get('recent_comments') ) {$cache2->remove('recent_comments');}
}
else
{
echo '<script language="javascript">
alert("'.$lcl['comment_form_succes'].'");
</script>';
}
$baglanti=db_baglan();
mysql_query("INSERT INTO comments (adi,email,comment,v_id,tarih,yayin) VALUES ('".$adi."','".$email."','".$comment."',".$id.",now(),".$comment_yayin.")");
mysql_close($conn);
} else {
echo '<script language="javascript">
alert("'.$lcl['spammer'].'");
</script>';
}
}
function comments()
{
$id=temizle($_GET['id']);
global $conn,$comment_order,$root_url,$lcl;
$baglanti=db_baglan();
$sql_sorgu="Select * from comments where yayin=1 and v_id=".$id." order by tarih ".$comment_order;
$result = mysql_query($sql_sorgu);
if(mysql_affected_rows()>0) {
$yorumlar="<div id='yorumlar'><table width='90%' class='yorumlar'>";
while($row = mysql_fetch_array($result))
{
$yorumlar=$yorumlar."<tr><td><b>".$lcl['comment_list_name'].": </b>".$row['adi']."</td><td><b>".$lcl['comment_list_date'].": </b>".$row['tarih']."</td></tr><tr><td colspan='2'><b>".$lcl['comment_list_comment'].":</b><br>".$row['comment']."<hr></td></tr>";
}
mysql_close($conn);
$yorumlar=$yorumlar."</table></div>";
}
$form='<form name="comment" onsubmit="return denetle()" method="post">
<table class="post-comment">
<tr><th>'.$lcl['comment_form_title'].'</th></tr>
<tr><td>'.$lcl['comment_form_name'].':<br><input type="text" name="adi" /></td></tr>
<tr><td>'.$lcl['comment_form_email'].'<br><input type="text" name="email" /></td></tr>
<tr><td>'.$lcl['comment_form_comment'].':<br><textarea cols="50" rows="5" name="comment" id="comment"></textarea></td></tr>
<tr><td>'.$lcl['comment_form_security'].':<input name="security" id="security" /> <img src="'.$root_url.'captcha.php"></td></tr>
<tr><td><input type="submit" value="'.$lcl['send'].'" /></td></tr>
</table>
</form>
<script language="javascript">
function denetle()
{
if (document.getElementById("comment").value=="") {alert("'.$lcl['comment_form_comment_err'].'");return false;}
if (document.getElementById("security").value=="") {alert("'.$lcl['comment_form_security_err'].'");return false;}
return true;
}
</script>';
return $form.$yorumlar;
}
function comments_game()
{
$id=temizle($_GET['id']);
global $conn,$comment_game_order,$root_url,$lcl;
$baglanti=db_baglan();
$sql_sorgu="Select * from comments_game where yayin=1 and v_id=".$id." order by tarih ".$comment_game_order;
$result = mysql_query($sql_sorgu);
if(mysql_affected_rows()>0) {
$yorumlar="<div id='yorumlar'><table width='90%' class='yorumlar'>";
while($row = mysql_fetch_array($result))
{
$yorumlar=$yorumlar."<tr><td><b>".$lcl['comment_list_name'].": </b>".$row['adi']."</td><td><b>".$lcl['comment_list_date'].": </b>".$row['tarih']."</td></tr><tr><td colspan='2'><b>".$lcl['comment_list_comment'].":</b><br>".$row['comment']."<hr></td></tr>";
}
mysql_close($conn);
$yorumlar=$yorumlar."</table></div>";
}
$form='<form name="comment" onsubmit="return denetle()" method="post">
<table class="post-comment">
<tr><th>'.$lcl['comment_form_title'].'</th></tr>
<tr><td>'.$lcl['comment_form_name'].':<br><input type="text" name="adi" /></td></tr>
<tr><td>'.$lcl['comment_form_email'].'<br><input type="text" name="email" /></td></tr>
<tr><td>'.$lcl['comment_form_comment'].':<br><textarea cols="50" rows="5" name="comment" id="comment"></textarea></td></tr>
<tr><td>'.$lcl['comment_form_security'].':<input name="security" id="security" /> <img src="'.$root_url.'captcha.php"></td></tr>
<tr><td><input type="submit" value="'.$lcl['send'].'" /></td></tr>
</table>
</form>
<script language="javascript">
function denetle()
{
if (document.getElementById("comment").value=="") {alert("'.$lcl['comment_form_comment_err'].'");return false;}
if (document.getElementById("security").value=="") {alert("'.$lcl['comment_form_security_err'].'");return false;}
return true;
}
</script>';
return $form.$yorumlar;
}
function taglar()
{
global $root_url,$cache_time;
if ($_GET['option']=="video") {$cache_id=temizle($_GET['id']);$cache_group="video_t";}
else if ($_GET['option']=="tag") {$cache_id=urlencode($_GET['tag']);$cache_group="tag_t";}
else {
$sayfa = 1;
if(isset($_GET['p']))
{
$sayfa = temizle($_GET['p']);
}
$cache_id=$sayfa;$cache_group="index_t";}
$options = array(
'cacheDir' => 'tmp/taglar/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get($cache_id,$cache_group)) {
return $data;
//return $data.backlinkspider();
} else {
global $lcl;
$baglanti=db_baglan();
$sql_sorgu="Select DISTINCT(kelime) from tag order by rand() limit 20";
$data='<li><h2>'.$lcl['tags'].'</h2><ul>';
global $conn,$tag_link;
$result = mysql_query($sql_sorgu);
if(mysql_affected_rows()>0) {
if ($tag_link=="") {$tag_link="?option=tag&tag=#tag";}
while($row = mysql_fetch_array($result))
{
$linki=str_replace('#tag',$row['kelime'],$tag_link);
$data=$data.'<a href="'.$root_url.$linki.'">'.urldecode($row['kelime']).'</a>, ';
}
$data=$data.'</ul></li>';
if ($cache_group=="tag_t")
{
if (google_referans()==true) {$cache->save($data);}
}
else {$cache->save($data);}
}
mysql_close($conn);
return $data;
//return $data.backlinkspider();
}
}
function taglar_game()
{
global $root_url,$cache_time;
if ($_GET['option']=="game") {$cache_id=temizle($_GET['id']);$cache_group="game_t";}
else if ($_GET['option']=="tag_game") {$cache_id=urlencode($_GET['tag']);$cache_group="tag_t";}
else {
$sayfa = 1;
if(isset($_GET['p']))
{
$sayfa = temizle($_GET['p']);
}
$cache_id=$sayfa;$cache_group="index_t";}
$options = array(
'cacheDir' => 'tmp/taglar_game/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get($cache_id,$cache_group)) {
return $data;
} else {
global $lcl;
$baglanti=db_baglan();
$sql_sorgu="Select DISTINCT(kelime) from tag_game order by rand() limit 20";
$data='<li><h2>'.$lcl['tags'].'</h2><ul>';
global $conn,$tag_game_link;
$result = mysql_query($sql_sorgu);
if(mysql_affected_rows()>0) {
if ($tag_game_link=="") {$tag_game_link="?option=tag_game&tag=#tag";}
while($row = mysql_fetch_array($result))
{
$linki=str_replace('#tag',$row['kelime'],$tag_game_link);
$data=$data.'<a href="'.$root_url.$linki.'">'.urldecode($row['kelime']).'</a>, ';
}
$data=$data.'</ul></li>';
if ($cache_group=="tag_t")
{
if (google_referans()==true) {$cache->save($data);}
}
else {$cache->save($data);}
}
mysql_close($conn);
return $data;
}
}
function tag_kaydet()
{
global $tag_stop;
if ($tag_stop==1) {return false;}
$referans=$_SERVER['HTTP_REFERER'];
if (strpos($referans,"www.google")>0)
{
$yerisi1=strpos($referans,"&q=");
$yerisi2=strpos($referans,"&",$yerisi1+2);
if ($yerisi1===false || $yerisi2===false) {return false;break;}
$kelimesi=substr($referans,$yerisi1+3,$yerisi2-$yerisi1-3);
$kelimesi=str_replace('%20','+',$kelimesi);
if (filtre($kelimesi)) {
global $conn;
$baglanti=db_baglan();
$result = mysql_query("Select count(id) as toplam from tag");
$row = mysql_fetch_array($result);
$toplam=$row['toplam'];
if ($toplam>500) {
mysql_query("update ignore tag set kelime='" . $kelimesi . "', tarih=now(), ping=0 order by tarih limit 1");
}
else
{
mysql_query("INSERT INTO tag (kelime,tarih) VALUES ('".$kelimesi."',now())");
}
return true;
mysql_close($conn);
}
}
return false;
}
function tag_game_kaydet()
{
global $tag_game_stop;
if ($tag_game_stop==1) {return false;}
$referans=$_SERVER['HTTP_REFERER'];
if (strpos($referans,"www.google")>0)
{
$yerisi1=strpos($referans,"&q=");
$yerisi2=strpos($referans,"&",$yerisi1+2);
if ($yerisi1===false || $yerisi2===false) {return false;break;}
$kelimesi=substr($referans,$yerisi1+3,$yerisi2-$yerisi1-3);
$kelimesi=str_replace('%20','+',$kelimesi);
if (filtre($kelimesi)) {
global $conn;
$baglanti=db_baglan();
$result = mysql_query("Select count(id) as toplam from tag_game");
$row = mysql_fetch_array($result);
$toplam=$row['toplam'];
if ($toplam>500) {
mysql_query("update ignore tag_game set kelime='" . $kelimesi . "', v_id=0, tarih=now(), ping=0 order by tarih limit 1");
}
else
{
mysql_query("INSERT INTO tag_game (kelime,tarih) VALUES ('".$kelimesi."',now())");
}
return true;
mysql_close($conn);
}
}
return false;
}
function filtre($haystack ,$offset=0){
$chr = array();
$baglanti=db_baglan();
$sql_sorgu="Select kelime from filtre";
global $conn;
$result = mysql_query($sql_sorgu);
while($row = mysql_fetch_array($result))
{
if (stripos($haystack,$row['kelime'],$offset)) {
$chr[] = stripos($haystack,$row['kelime'],$offset);
}
}
mysql_close($conn);
if(empty($chr)) return true;
return false;
}
function encok()
{
global $cache_time;
$options = array(
'cacheDir' => 'tmp/encok/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get(urlencode($_GET['tag']),"encok")) {
return $data;
} else {
$sql_sorgu="Select kelime from encok order by rand() limit 10";
global $conn;
$baglanti=db_baglan();
$result = mysql_query($sql_sorgu);
$tag=$_GET['tag'];
while($row = mysql_fetch_array($result))
{
$data=$data.$tag." ".urldecode($row['kelime']).", ";
}
if (google_referans()==true) {
$cache->save($data);}
mysql_close($conn);
return $data;
}
}
function encok_game()
{
global $cache_time;
$options = array(
'cacheDir' => 'tmp/encok_game/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get(urlencode($_GET['tag']),"encok")) {
return $data;
} else {
$sql_sorgu="Select kelime from encok_game order by rand() limit 10";
global $conn;
$baglanti=db_baglan();
$result = mysql_query($sql_sorgu);
$tag=$_GET['tag'];
while($row = mysql_fetch_array($result))
{
$data=$data.$tag." ".urldecode($row['kelime']).", ";
}
if (google_referans()==true) {
$cache->save($data);}
mysql_close($conn);
return $data;
}
}
function google_kelimeler()
{
global $cache_time,$content_stop;
if ($content_stop==1) {return "";}
$options = array(
'cacheDir' => 'tmp/google/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get(urlencode($_GET['tag']),"google")) {
return $data;
} else {
if (surekli()==urlencode($_GET['tag'])) {
$kelimeler=get_from_google(urlencode($_GET['tag']));
$cache->save($kelimeler);
}
else
{
$kelimeler=get_from_google(urlencode($_GET['tag']));
if (google_referans()==true && zaman_araligi()==true)
{
$cache->save($kelimeler);
}
}
return $kelimeler;
}
}
function google_game_kelimeler()
{
global $cache_time,$content_game_stop;
if ($content_game_stop==1) {return "";}
$options = array(
'cacheDir' => 'tmp/google_game/',
'lifeTime' => $cache_time,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get(urlencode($_GET['tag']),"google_game")) {
return $data;
} else {
if (surekli()==urlencode($_GET['tag'])) {
$kelimeler=get_from_google(urlencode($_GET['tag']));
$cache->save($kelimeler);
}
else
{
$kelimeler=get_from_google(urlencode($_GET['tag']));
if (google_referans()==true && zaman_araligi()==true)
{
$cache->save($kelimeler);
}
}
return $kelimeler;
}
}
function get_from_google($kelimesi)
{
$options2 = array(
'cacheDir' => 'tmp/',
'lifeTime' => 26400,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache_id='getgoogle';
$cache2 = new Cache_Lite($options2);
if ($data2 = $cache2->get($cache_id)) {
return "";
}
else
{
$ch = curl_init("http://www.google.com/search?num=20&q=".$kelimesi);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
if(curl_errno($ch))
{
$cache2->save("onur");
return "";
}
curl_close($ch);
$dilkodlamasi="Windows-1254";
$devam="evet";
while($devam=="evet")
{
$yeri1=strpos($data,'<div class="s">',$yeri1+2);
if ($yeri1===false){break;}
$yeri2=strpos($data,"<br>",$yeri1);
if ($yeri2===false){break;}
$kelime=substr($data,$yeri1+15,$yeri2-$yeri1-15);
$kelime = iconv($dilkodlamasi , "utf-8", $kelime );
$kelime = html_entity_decode( $kelime, ENT_QUOTES, "UTF-8" );
$yeri3=strpos($kelime,'div class="f">');
$yeri4=strpos($kelime,'</div>');
if ($yeri3>0)
{
$cikacak=substr($kelime,$yeri3-1,$yeri4-$yeri3+1);
$kelime=str_replace($cikacak,' ',$kelime);
}
$kelime=str_replace('<em>',' ',$kelime);
$kelime=str_replace('</em>',' ',$kelime);
$kelime=str_replace('<b>',' ',$kelime);
$kelime=str_replace('</b>',' ',$kelime);
$kelime=str_replace('...',' ',$kelime);
$devam="evet";
while($devam=="evet")
{
$yer1=strpos($kelime,'<');
if($yer1===false){break;}
$yer2=strpos($kelime,'>',$yer1);
if($yer2===false){break;}
$cikacak=substr($kelime,$yer1,$yer2-$yer1+1);
$kelime=str_replace($cikacak,' ',$kelime);
}
$kelime=str_replace('#','*',$kelime);
$kelimeler_arr[]=$kelime;
}
shuffle($kelimeler_arr);
$kelimeler_arr = array_slice($kelimeler_arr, 0, 5);
foreach($kelimeler_arr as $deger) {
$kelimeler=$kelimeler."<br>".$deger;
}
return $kelimeler;
}
}
function google_referans()
{
if (strpos($_SERVER['HTTP_REFERER'],"www.google")>0){return true;}
return false;
}
function zaman_araligi()
{
$options = array(
'cacheDir' => 'tmp/',
'lifeTime' => 30,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get("zaman")) {
return false;
} else {
$cache->save("omurtlak");
return true;
}
}
function surekli()
{
$options = array(
'cacheDir' => 'tmp/',
'lifeTime' => 20,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get("surekli")) {
return $data;
} else {
$cache->save(urlencode($_GET['tag']));
return false;
}
}
function clean_old_cache()
{
$options = array(
'cacheDir' => 'tmp/',
'lifeTime' => 86400,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
if ($data = $cache->get("clean")) {
return false;
} else {
$cache->save("omurtlak");
$options = array('cacheDir' => 'tmp/encok/');
$cache = new Cache_Lite($options);
$cache->clean(false,'old');
$options = array('cacheDir' => 'tmp/encok_game/');
$cache = new Cache_Lite($options);
$cache->clean(false,'old');
$options = array('cacheDir' => 'tmp/google/');
$cache = new Cache_Lite($options);
$cache->clean(false,'old');
$options = array('cacheDir' => 'tmp/google_game/');
$cache = new Cache_Lite($options);
$cache->clean(false,'old');
$options = array('cacheDir' => 'tmp/tablo/');
$cache = new Cache_Lite($options);
$cache->clean(false,'old');
$options = array('cacheDir' => 'tmp/tablo_game/');
$cache = new Cache_Lite($options);
$cache->clean(false,'old');
$options = array('cacheDir' => 'tmp/taglar/');
$cache = new Cache_Lite($options);
$cache->clean(false,'old');
$options = array('cacheDir' => 'tmp/taglar_game/');
$cache = new Cache_Lite($options);
$cache->clean(false,'old');
$options = array('cacheDir' => 'tmp/video/');
$cache = new Cache_Lite($options);
$cache->clean(false,'old');
$options = array('cacheDir' => 'tmp/game/');
$cache = new Cache_Lite($options);
$cache->clean(false,'old');
}
}
?>
Custom HTML/CSS/PHP
http://theorderofindividualacceptance.co...p.php?id=1
|