$categoryz\n"; } $result = mysql_query("SELECT pornstar,videos from pornstars where videos >= $minvidpornstars order by pornstar;",$lnk); while ($myrow = mysql_fetch_row($result)) { $pornstarz = $myrow[0]; $count = $myrow[1]; $pornstararray[] = $pornstarz; } $break = count($pornstararray) / 6; $cnt = 0;$column = 1; $pornstarlist = ""; $result = mysql_query("SELECT keyword from keywords where MATCH(keyword) AGAINST ('$q') limit $limitsearchtags;",$lnk); while ($myrow = mysql_fetch_row($result)) { $rel = $myrow[0]; $related .= "".ucwords(strtolower($rel))." "; } $related = trim($related,", "); $q = urlencode($q); $cl = new SphinxClient(); $cl->SetServer($sphinxhost, $sphinxport); $cl->SetConnectTimeout(2); $cl->SetMatchMode(SPH_MATCH_EXTENDED2); if($ty == 1 || !$ty) { $cl->SetSortMode(SPH_SORT_EXTENDED,'dateadded desc'); } else if($ty == 2) { $cl->SetSortMode(SPH_SORT_EXTENDED,'views desc'); } else if($ty == 3) { $cl->SetSortMode(SPH_SORT_EXTENDED,'length desc'); } $total = $rows * $cols; if(!$p){$p=1;} $page = ($p-1) * $total; $cl->SetArrayResult(true); $cl->SetLimits($page,$total); $res = $cl->Query($q, $sphinxindex); if(!$res) { echo $cl->GetLastError(); echo $cl->GetLastWarning(); } foreach($res["matches"] as $docinfo) { $id = $docinfo['id']; $ids[] = $id; } $tresults = $res["total"]; $total_pages = ceil($tresults / $total); if($total_pages == 0){$total_pages = 1;} if($total_pages <= 10) { for($i = 1; $i <= $total_pages; $i++) { if(($p) == $i) { $nav .= " $i \n"; } else { $nav .= " $i \n"; } } } else { if($p < 6) { $i=1; $f=10; } else { if($total_pages-$p > 4){$i=$p-4;$f=$p+5;}else{$i=$total_pages-9;$f=$total_pages;} } for($a = $i; $a <= $f; $a++) { if(($p) == $a) { $nav .= " $a \n"; } else { $i2=$i-1; $nav .=" $a \n"; } } } $b=$p-1; $p++; if($p <= $total_pages){$next = "";}else{$next = "";} if($p > 2){$back = "";}else{$back="";} $navbar = "$back $nav $next"; $cnt=0;$tot=0;$blk=0;$brk=$cols-1;$split=$split-1; if($tresults > 0) { foreach($ids as $id) { $result = mysql_query("SELECT id,title,site,thumbs,url,dateadded,orientation,length,tags,category from videos where id = $id;",$lnk) or die("MySQL ERROR: ".mysql_error()); while ($myrow = mysql_fetch_row($result)) { $id = $myrow[0]; $title = $myrow[1]; $site = $myrow[2]; $thumbs = $myrow[3]; $url = $myrow[4]; $date = $myrow[5]; $orientation = $myrow[6]; $length = $myrow[7]; $tags = $myrow[8]; $category = $myrow[9]; $tags = explode(",",$tags); shuffle($tags); foreach($tags as $tag) { $tag = trim($tag); $tag2 = urlencode(strtolower($tag)); $tag = ucwords($tag); if(strlen($tag) > 2) { $alltags .= "$tag, "; } } $alltags = trim($alltags,", "); $starttime=time(); $endtime=strtotime($date); $timediff = $starttime-$endtime; $days=intval($timediff/86400); $remain=$timediff%86400; $hours=intval($remain/3600); $remain=$remain%3600; $mins=intval($remain/60); $secs=$remain%60; if($days < 1){if($hours < 1){$dc = "$mins Minutes Ago";}else{if($hours == 1){$dc = "$hours Hour Ago";}else{$dc = "$hours Hours Ago";}}} else if($days < 7 && $days > 0){$dc = "$days Days Ago";} else if($days < 30 && $days >=7){$dc = floor($days/7);if($dc == 1){$dc = "$dc Week Ago";}else{$dc = "$dc Weeks Ago";}} else if($days >= 30){$dc = floor($days/30);if($dc == 1){$dc = "$dc Month Ago";}else{$dc = "$dc Months Ago";}} else if($days >= 365){$dc = floor($days/365);if($dc == 1){$dc = "$dc Year Ago";}else{$dc = "$dc2 Years Ago";}} $length = explode(":",$length); if($length[0] > 0) { $length = "$length[0]:$length[1]:$length[2]"; } else { $length = "$length[1]:$length[2]"; } $ftitle = $title; if(strlen($title)>$maxtitle) { $title = substr($title, 0, $maxtitle); $title = trim($title); $title = $title . "..."; } $content[$blk] .= "
$title$title
$dc
$alltags
"; if($cnt == $brk && $tot != $split){$content[$blk] .= "";$cnt=0;}else{$cnt++;} if($tot == $split){$blk++;$tot=0;$cnt=0;}else{$tot++;} $alltags = ""; } } } else { $nfmsg = "

We're sorry but the video you're looking for was not found, however we recommend you the following videos:


"; $result = mysql_query("SELECT id,title,site,thumbs,url,dateadded,orientation,length,tags,category from videos order by lastview desc limit $total;",$lnk); $cnt=0;$tot=0;$blk=0;$brk=$cols-1;$split=$split-1; while ($myrow = mysql_fetch_row($result)) { $id = $myrow[0]; $title = $myrow[1]; $site = $myrow[2]; $thumbs = $myrow[3]; $url = $myrow[4]; $date = $myrow[5]; $orientation = $myrow[6]; $length = $myrow[7]; $tags = $myrow[8]; $category = $myrow[9]; $tags = explode(",",$tags); shuffle($tags); foreach($tags as $tag) { $tag = trim($tag); $tag2 = urlencode(strtolower($tag)); $tag = ucwords($tag); if(strlen($tag) > 2) { $alltags .= "$tag, "; } } $alltags = trim($alltags,", "); $starttime=time(); $endtime=strtotime($date); $timediff = $starttime-$endtime; $days=intval($timediff/86400); $remain=$timediff%86400; $hours=intval($remain/3600); $remain=$remain%3600; $mins=intval($remain/60); $secs=$remain%60; if($days < 1){if($hours < 1){$dc = "$mins Minutes Ago";}else{if($hours == 1){$dc = "$hours Hour Ago";}else{$dc = "$hours Hours Ago";}}} else if($days < 7 && $days > 0){$dc = "$days Days Ago";} else if($days < 30 && $days >=7){$dc = floor($days/7);if($dc == 1){$dc = "$dc Week Ago";}else{$dc = "$dc Weeks Ago";}} else if($days >= 30){$dc = floor($days/30);if($dc == 1){$dc = "$dc Month Ago";}else{$dc = "$dc Months Ago";}} else if($days >= 365){$dc = floor($days/365);if($dc == 1){$dc = "$dc Year Ago";}else{$dc = "$dc2 Years Ago";}} $length = explode(":",$length); if($length[0] > 0) { $length = "$length[0]:$length[1]:$length[2]"; } else { $length = "$length[1]:$length[2]"; } $ftitle = $title; if(strlen($title)>$maxtitle) { $title = substr($title, 0, $maxtitle); $title = trim($title); $title = $title . "..."; } $content[$blk] .= "
$title$title
$dc
$alltags
"; if($cnt == $brk && $tot != $split){$content[$blk] .= "";$cnt=0;}else{$cnt++;} if($tot == $split){$blk++;$tot=0;$cnt=0;}else{$tot++;} $alltags = ""; } } $html = file_get_contents("template3.html", "r"); preg_match_all ("/--include:(.*?)--/si", $html, &$matches2); $matches2 = $matches2[1]; foreach($matches2 as $var) { $inc = file_get_contents("$var", "r"); $html = preg_replace("/--include:$var--/i", "$inc", $html); } for($x=0;$x<$blocks;$x++) { $y=$x+1; $html = preg_replace("/--block$y--/i", "$nfmsg$content[$x]", $html); } $html = preg_replace("/--navbar--/i", "$navbar", $html); $html = preg_replace("/--q--/i", "$q", $html); $html = preg_replace("/--q2--/i", ucwords(strtolower(urldecode($q))), $html); $html = preg_replace("/--q3--/i", strtolower($q), $html); $html = preg_replace("/--q4--/i", strtolower(urldecode($q)), $html); $html = preg_replace("/--tags--/i", "$related", $html); $html = preg_replace("/--last--/i", "$last", $html); $html = preg_replace("/--allcats--/i", "$allcats", $html); $html = preg_replace("/--biglist--/i", "$biglist", $html); $html = preg_replace("/--pornstarlist--/i", "$pornstarlist", $html); $xix = "[an error occurred while processing this directive]"; $html = preg_replace("/--script--/i", "$xix", $html); $fp = @fopen($cachefile, 'w'); @fwrite($fp, $html); @fclose($fp); echo $html; } function curPageURL() { $pageURL = 'http'; if($_SERVER["HTTPS"] == "on") { $pageURL .= "s"; } $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } ?>