-1";
//$flashandcheck='';
$flashandcheck=" and (flashcheckresult > -1 OR localswf IS NOT NULL)";
// $flashandcheck='';
$gamedup=" and dup = '0' ";
//$fbgurl=str_ireplace("//games.kidzsearch.com","//www.kidzsearch.com",$gmurl);
// $fburl=str_ireplace("/computer/","/games/",$fbgurl);
require_once('PhpBadWords.php');
function prebanword($word)
{
// error_log("PREBAN BASE ".$word);
// echo "PB: $word ";
$rd=str_ireplace('!', "!", $word);
$rd=str_ireplace('@', "@", $rd);
$rd=str_ireplace('*', "*", $rd);
$rd=str_ireplace('#', "#", $rd);
$rd=str_ireplace('$', "$", $rd);
$obj = new PhpBadWords();
$obj->setText($rd);
$rd=$obj->whitelistit();
$word=$rd;
$z=false;
// sanity. too high processing.
if (stripos($word, 'copulat') !== FALSE) return true;
if (stripos($word, 'rule 34') !== FALSE) return true;
if (stripos($word, 'rule34') !== FALSE) return true;
if (stripos($word, 'rule 32') !== FALSE) return true;
if (stripos($word, 'rule32') !== FALSE) return true;
if (stripos($word, 'rule 36') !== FALSE) return true;
if (stripos($word, 'rule36') !== FALSE) return true;
if (stripos($word, 'porn') !== FALSE) return true;
if (stripos($word, 'p@rn') !== FALSE) return true;
if (stripos($word, 'p*rn') !== FALSE) return true;
if (stripos($word, 'prno') !== FALSE) return true;
if (stripos($word, 'fuck') !== FALSE) return true;
if (stripos($word, 'shit') !== FALSE) return true;
if (stripos($word, 'bitch') !== FALSE) return true;
if (stripos($word, 'sexy') !== FALSE) return true;
if (stripos($word, 'piss') !== FALSE) return true;
if (stripos($word, 'cunt') !== FALSE) return true;
if (stripos($word, 'cocksucker') !== FALSE) return true;
if (stripos($word, 'cock sucker') !== FALSE) return true;
if (stripos($word, ' tit ') !== FALSE) return true;
if (stripos($word, ' tits ') !== FALSE) return true;
if (stripos($word, ' cock ') !== FALSE) return true;
if (stripos($word, 'big dick') !== FALSE) return true;
if (stripos($word, ' sex ') !== FALSE) return true;
if (stripos($word, 'vagina') !== FALSE) return true;
if (stripos($word, 'penis') !== FALSE) return true;
if (stripos($word, ' ass ') !== FALSE) return true;
if (stripos($word, 'asshole') !== FALSE) return true;
if (stripos($word, 'boob') !== FALSE) return true;
if (stripos($word, 'bitch') !== FALSE) return true;
if (stripos($word, 'faggot') !== FALSE) return true;
if (stripos($word, 'boob') !== FALSE) return true;
if (stripos($word, 'nipple') !== FALSE) return true;
if ($word=='ass ') return true;
if ($word==' ass') return true;
if ($word=='homo') return true;
if ($word==='fag') return true;
if ($word=='ass') return true;
if ($word=='big ass') return true;
if ($word=='sex') return true;
if ($word=='tits') return true;
if ($word=='tit') return true;
if ($word=='cock') return true;
if ($word=='dick') return true;
if ($word=='vagina') return true;
if ($word=='penis') return true;
if (stripos($word, '@ss') !== FALSE) return true;
if (stripos($word, 'a$$') !== FALSE) return true;
if (stripos($word, 'p!ll') !== FALSE) return true;
if (stripos($word, '$h!t') !== FALSE) return true;
if (stripos($word, 'sh!t') !== FALSE) return true;
if (stripos($word, '$hit') !== FALSE) return true;
if (stripos($word, '$hit') !== FALSE) return true;
if (stripos($word, 'g*y') !== FALSE) return true;
if (stripos($word, 'f*g') !== FALSE) return true;
if (stripos($word, 'f@g') !== FALSE) return true;
if (stripos($word, 's*x') !== FALSE) return true;
if (stripos($word, 'br*ast') !== FALSE) return true;
if (stripos($word, 'bre*st') !== FALSE) return true;
if (stripos($word, 'br*@st') !== FALSE) { error_log("prepanned --> br*@st <--"); return true; }
if (stripos($word, 'bre*st') !== FALSE) return true;
if (stripos($word, 'bl*wjob') !== FALSE) { error_log("prepanned --> bl*wjob <--"); return true; }
if (stripos($word, 'blowj*b') !== FALSE) { error_log("prepanned --> blowj*b <--"); return true; }
if (stripos($word, 'fuck') !== FALSE) { error_log("prepanned --> fuck<--"); return true; }
if (stripos($word, 'f*ck') !== FALSE) { error_log("prepanned -->f*ck <--"); return true; }
if (stripos($word, 'fu*k') !== FALSE) { error_log("prepanned --> fu*k <--"); return true; }
if (stripos($word, 'fuc*') !== FALSE) { error_log("prepanned --> fuc* <--"); return true; }
if (stripos($word, '*uck') !== FALSE) { error_log("prepanned --> *uck <--"); return true; }
if (stripos($word, 'sh*t') !== FALSE) { error_log("prepanned -->sh*t <--"); return true; }
if (stripos($word, 'c*ck') !== FALSE) { error_log("prepanned --> c*ck <--"); return true; }
if (stripos($word, 'p*ssy') !== FALSE) { error_log("prepanned --> p*ssy <--"); return true; }
if (stripos($word, 'c*nt') !== FALSE) { error_log("prepanned --> c*nt <--"); return true; }
if (stripos($word, '*sshole') !== FALSE) { error_log("prepanned --> *sshole <--"); return true; }
if (stripos($word, 'd*mn') !== FALSE) { error_log("prepanned --> d*mn <--"); return true; }
if (stripos($word, 'p*ss') !== FALSE) { error_log("prepanned --> p*ss <--"); return true; }
if (stripos($word, 'b*tch') !== FALSE) { error_log("prepanned --> b*tch <--"); return true; }
if (stripos($word, 'b*tch') !== FALSE) { error_log("prepanned --> b*tch <--"); return true; }
if (stripos($word, 'p!ll') !== FALSE) { error_log("prepanned --> p!ll <--"); return true; }
if (stripos($word, 'g*y') !== FALSE) { error_log("prepanned --> g*y <--"); return true; }
if (stripos($word, 'f@g') !== FALSE) { error_log("prepanned --> f@g <--"); return true; }
if (stripos($word, 'bre@st') !== FALSE) { error_log("prepanned --> bre@st <--"); return true; }
if (stripos($word, 'sh!t') !== FALSE) { error_log("prepanned -->sh!t <--"); return true; }
if (stripos($word, 'p!ss') !== FALSE) { error_log("prepanned -->p!ss <--"); return true; }
if (stripos($word, 'b!tch') !== FALSE) { error_log("prepanned --> b!tch <--"); return true; }
if (stripos($word, 'd!rty') !== FALSE) { error_log("prepanned --> d!irty <--"); return true; }
if (stripos($word, 'f@p') !== FALSE) { error_log("prepanned -->f@p <--"); return true; }
if (stripos($word, 'a$$') !== FALSE) { error_log("prepanned -->a$$ <--"); return true; }
if (stripos($word, 'p!ll') !== FALSE) { error_log("prepanned -->p!ll <--"); return true; }
if (stripos($word, 'dr*g') !== FALSE) { error_log("prepanned -->dr*g <--"); return true; }
if (stripos($word, 'pen!s') !== FALSE) { error_log("prepanned -->pen!s <--"); return true; }
if (stripos($word, 'p!n!s') !== FALSE) { error_log("prepanned -->p!n!s <--"); return true; }
if (stripos($word, 'pen!s') !== FALSE) { error_log("prepanned -->pen!s <--"); return true; }
if (stripos($word, 'penis') !== FALSE) { error_log("prepanned -->penis <--"); return true; }
if (stripos($word, 'vag!na') !== FALSE) { error_log("prepanned -->vag!na <--"); return true; }
if (stripos($word, 'v@gin@') !== FALSE) { error_log("prepanned -->v@gin@ <--"); return true; }
if (stripos($word, 'v@gina') !== FALSE) { error_log("prepanned -->v@gina <--"); return true; }
if (stripos($word, 'vagin@') !== FALSE) { error_log("prepanned -->vagin@ <--"); return true; }
if (stripos($word, 'c*nt') !== FALSE) { error_log("prepanned -->c*nt <--"); return true; }
if (stripos($word, 'd@mn') !== FALSE) { error_log("prepanned -->d@mn <--"); return true; }
if (stripos($word, 'g@y') !== FALSE) { error_log("prepanned -->g@y <--"); return true; }
if (stripos($word, 'f@g') !== FALSE) { error_log("prepanned -->f@g <--"); return true; }
if (stripos($word, 's*x') !== FALSE) { error_log("prepanned -->s*x <--"); return true; }
if (stripos($word, 's#x') !== FALSE) { error_log("prepanned -->s#x <--"); return true; }
if (stripos($word, 'bre@st') !== FALSE) { error_log("prepanned -->bre@st <--"); return true; }
if (stripos($word, 'blowj*b') !== FALSE) { error_log("prepanned -->blowj*b <--"); return true; }
if (stripos($word, 'bl*wjob') !== FALSE) { error_log("prepanned -->bl*wjob <--"); return true; }
if (stripos($word, 'bl*wj*b') !== FALSE) { error_log("prepanned -->bl*wjob <--"); return true; }
if (stripos($word, 'c*ck') !== FALSE) { error_log("prepanned -->c*ck <--"); return true; }
if (stripos($word, 'f*ck') !== FALSE) { error_log("prepanned -->f*ck <--"); return true; }
if (stripos($word, 'p*ssy') !== FALSE) { error_log("prepanned -->p*ssy <--"); return true; }
if (stripos($word, 'sh!t') !== FALSE) { error_log("prepanned -->sh!t <--"); return true; }
if (stripos($word, '@sshole') !== FALSE) { error_log("prepanned -->@sshole <--"); return true; }
if (stripos($word, '@$$hole') !== FALSE) { error_log("prepanned -->asshole (dollar)<--"); return true; }
if (stripos($word, 'a$$hole') !== FALSE) { error_log("prepanned -->asshold dollar2 <--"); return true; }
if (stripos($word, 'b!tch') !== FALSE) { error_log("prepanned -->b!tch <--"); return true; }
if (stripos($word, 'w@nk') !== FALSE) { error_log("prepanned -->w@nk <--"); return true; }
if (stripos($word, 'j@ck') !== FALSE) { error_log("prepanned -->j@ck <--"); return true; }
if (stripos($word, 'j!ll') !== FALSE) { error_log("prepanned -->j!ll <--"); return true; }
if (stripos($word, 'c*m') !== FALSE) { error_log("prepanned -->c*m <--"); return true; }
if (stripos($word, 'c*me') !== FALSE) { error_log("prepanned -->c*me <--"); return true; }
if (stripos($word, 'gay kiss') !== FALSE) { error_log("prepanned --> gay kiss <--"); return true; }
if (stripos($word, 'kiss gay') !== FALSE) { error_log("prepanned --> kiss gay <--"); return true; }
if (stripos($word, 'hot gay') !== FALSE) { error_log("prepanned --> hot gay <--"); return true; }
if (stripos($word, 'gay hot') !== FALSE) { error_log("prepanned --> gay hot <--"); return true; }
if (stripos($word, 'hot lesbian') !== FALSE) { error_log("prepanned --> hot lesbian <--"); return true; }
if (stripos($word, 'lesbian hot') !== FALSE) { error_log("prepanned -->lesbian hot <--"); return true; }
if (stripos($word, 'lesbian kiss') !== FALSE) { error_log("prepanned --> lesbian kiss <--"); return true; }
if (stripos($word, 'kiss lesbian') !== FALSE) { error_log("prepanned --> kiss lesbian <--"); return true; }
if (stripos($word, 'g*y') !== FALSE) { error_log("prepanned --> g*y <--"); return true; }
if (stripos($word, 'f*g') !== FALSE) { error_log("prepanned --> f*g <--"); return true; }
if (stripos($word, 's*x') !== FALSE) { error_log("prepanned --> s*x <--"); return true; }
if (stripos($word, 'br*ast') !== FALSE) { error_log("prepanned -->br*ast <--"); return true; }
if (stripos($word, 'bre*st') !== FALSE) { error_log("prepanned --> bre*st <--"); return true; }
if (stripos($word, 'bl*wjob') !== FALSE) { error_log("prepanned --> bl*wjob <--"); return true; }
if (stripos($word, 'blowj*b') !== FALSE) { error_log("prepanned --> blowj*b <--"); return true; }
if (stripos($word, 'fuck') !== FALSE) { error_log("prepanned --> fuck <--"); return true; }
if (stripos($word, 'f*ck') !== FALSE) { error_log("prepanned --> f*ck <--"); return true; }
if (stripos($word, 'fu*k') !== FALSE) { error_log("prepanned --> fu*k <--"); return true; }
if (stripos($word, 'fuc*') !== FALSE) { error_log("prepanned --> fuc* <--"); return true; }
if (stripos($word, '*uck') !== FALSE) { error_log("prepanned --> *uck <--"); return true; }
if (stripos($word, 'sh*t') !== FALSE) { error_log("prepanned -->sh*t <--"); return true; }
if (stripos($word, 'c*ck') !== FALSE) { error_log("prepanned --> c*ck <--"); return true; }
if (stripos($word, 'p*ssy') !== FALSE) { error_log("prepanned --> p*ssy <--"); return true; }
if (stripos($word, 'c*nt') !== FALSE) { error_log("prepanned --> c*nt <--"); return true; }
if (stripos($word, '*sshole') !== FALSE) { error_log("prepanned -->*sshole <--"); return true; }
if (stripos($word, 'd*mn') !== FALSE) { error_log("prepanned --> d*mn <--"); return true; }
if (stripos($word, 'p*ss') !== FALSE) { error_log("prepanned --> p*ss <--"); return true; }
if (stripos($word, 'b*tch') !== FALSE) { error_log("prepanned --> b*tch <--"); return true; }
if (stripos($word, 'view_adult=true') !== FALSE) { error_log("prepanned --> view_adult=true <--"); return true; }
return false;
}
function xss_clean($data)
{
return htmlspecialchars(strip_tags($data));
}
function xss_clean2($data)
{
$d=str_replace("'", "~", $data);
$d=str_replace("\"", "^", $d);
$m=htmlspecialchars(strip_tags($d));
$m=str_replace("^", "\"", $m);
$m=str_replace("~", "", $m); // was ' for replacement
return $m;
}
$badword=0;
if( !isset($learning) || empty($learning) ) $learning=0;
if( isset($_REQUEST['gamesearch']))
{
$x=$_REQUEST['gamesearch'];
$x=str_ireplace("manga", "", $x);
$x=str_ireplace("anime", "", $x);
$r=0;
//$obj = new PhpBadWords();
//$obj->setText($x);
//$r=$obj->check();
if(stripos($x,'manga') !== false) $r=0;
if(stripos($x,'anime') !== false) $r=0;
if( prebanword($x) )
{
$badword=1;
include ("gamebanterm.html");
die();
}
if( isset($r) && $r==1 )
{
//$badword=1;
//include ("gamebanterm.html");
//die();
}
}
if( isset($_REQUEST['cat'])) $_REQUEST['cat']=htmlentities($_REQUEST['cat'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
//if( isset($_REQUEST['gamesearch'])) $_REQUEST['gamesearch']=htmlentities($_REQUEST['gamesearch'], ENT_QUOTES | ENT_HTML5, 'UTF-8');
if( isset($_REQUEST['gamesearch'])) $_REQUEST['gamesearch']=xss_clean2($_REQUEST['gamesearch']);
if( isset($_REQUEST['learning'])) $_REQUEST['learning']=htmlentities($_REQUEST['learning'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['nowplaying'])) $_REQUEST['nowplaying']=htmlentities($_REQUEST['nowplaying'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['nowplayingmg'])) $_REQUEST['nowplayingmg']=htmlentities($_REQUEST['nowplayingmg'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['page'])) $_REQUEST['page']=htmlentities($_REQUEST['page'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['plays'])) $_REQUEST['plays']=htmlentities($_REQUEST['plays'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['recentadd'])) $_REQUEST['recentadd']=htmlentities($_REQUEST['recentadd'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['related'])) $_REQUEST['related']=htmlentities($_REQUEST['related'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['starrating'])) $_REQUEST['starrating']=htmlentities($_REQUEST['starrating'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['nocache'])) $_REQUEST['nocache']=htmlentities($_REQUEST['nocache'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['pd'])) $_REQUEST['pd']=htmlentities($_REQUEST['pd'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['pop'])) $_REQUEST['pop']=htmlentities($_REQUEST['pop'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['shuffle'])) $_REQUEST['shuffle']=htmlentities($_REQUEST['shuffle'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['localsearch'])) $_REQUEST['localsearch']=htmlentities($_REQUEST['localsearch'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['src'])) $_REQUEST['src']=htmlentities($_REQUEST['src'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['page'])) $_REQUEST['page']=htmlentities($_REQUEST['page'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['prev'])) $_REQUEST['prev']=htmlentities($_REQUEST['prev'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
if( isset($_REQUEST['next'])) $_REQUEST['next']=htmlentities($_REQUEST['next'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
//setcookie('ksfloorad1', '1', time() + (86400 * 0.5 ), '/', '.kidzsearch.com'); // 12 hr
require_once 'Mobile_Detect.php';
require_once 'gamelib.php';
require_once 'Inflect.php';
$detect = new Mobile_Detect;
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
$gq="";
if( isset($_REQUEST['gamesearch']))
{
$gq=$_REQUEST['gamesearch'];
}
// Set a session variable if the user prefers the desktop version ( no option for new mobile section to switch to desktop).
if (isset($_REQUEST['v']) && $_REQUEST['v'] == 'xxxdesktop') {
$_SESSION['v'] = 'desktop';
}
if (isset($_REQUEST['v']) && $_REQUEST['v'] == 'xxxmobile') {
$_SESSION['v'] = 'mobile';
}
// Detect browser and redirect mobile users unless they've already opted out
if (1==1 || !isset($_SESSION['v']) || (isset($_SESSION['v']) && $_SESSION['v'] != 'desktop')) {
// Place browser detection and redirection code here
$categorylink="https://games.kidzsearch.com/?s=".$gq;
switch (strtolower($gq)) {
case "action":
$categorylink="https://games.kidzsearch.com/category/action";
break;
case "adventure":
$categorylink="https://games.kidzsearch.com/category/adventure";
break;
case "arcade":
case "fun":
$categorylink="https://games.kidzsearch.com/category/arcade";
break;
case "board game":
$categorylink="https://games.kidzsearch.com/category/board-game";
break;
case "casino":
$categorylink="https://games.kidzsearch.com/category/casino";
break;
case "customize":
$categorylink="https://games.kidzsearch.com/category/customize";
break;
case "dress-up":
case "girl":
$categorylink="https://games.kidzsearch.com/category/dress-up";
break;
case "driving":
case "racing":
case "race":
$categorylink="https://games.kidzsearch.com/category/driving";
break;
case "education":
case "learning":
case "math":
case "science":
case "physics":
case "english":
case "history":
case "learn":
case "word":
$categorylink="https://games.kidzsearch.com/category/education";
break;
case "jigsaw":
$categorylink="https://games.kidzsearch.com/category/jigsaw";
break;
case "multiplayer":
case "mmo":
case "io":
$categorylink="https://games.kidzsearch.com/category/multiplayer";
break;
case "other":
$categorylink="https://games.kidzsearch.com/category/other";
break;
case "puzzles":
case "logic":
case "puzzle":
$categorylink="https://games.kidzsearch.com/category/puzzles";
break;
case "shooting":
$categorylink="https://games.kidzsearch.com/category/shooting";
break;
case "sports":
case "sport":
$categorylink="https://games.kidzsearch.com/category/sports";
break;
case "strategy":
case "skill":
$categorylink="https://games.kidzsearch.com/category/strategy";
break;
default:
$categorylink="https://games.kidzsearch.com/?s=".$gq;
}
if( !isset($gq) || strlen($gq) < 2 )
{
$categorylink="https://games.kidzsearch.com/?v=mobile";
}
if($_SESSION['v']=="mobile" || $deviceType=="phone" || $deviceType=="tablet" )
{
if( isset($_REQUEST['gamesearch']))
{
$gq=$_REQUEST['gamesearch'];
header("Location: ".$categorylink);
exit;
}
else
{
header("Location: https://games.kidzsearch.com");
exit;
}
}
}
// echo "88888888888";
//echo $categorylink;
?>
1 )
{
$affv= $_SESSION['useraff'];
if ( isset($_SESSION['usersubid']) && strlen(trim($_SESSION['usersubid'])) > 1 ) $affsubid= $_SESSION['usersubid'];
}
else
{
if( isset($_REQUEST['aff']) ){
$affv=$_REQUEST['aff']; }
if(strlen(trim($affv))<2 ) $affv='ks';
if(strlen(trim($subid))<2 ) $subid='';
if( isset($_REQUEST['subid']) ) $subid=$_REQUEST['subid'];
}
// include_once "../admin.php";
$greq="";
if( isset($_REQUEST['gamesearch']) )
{
$greq=$_REQUEST['gamesearch'];
$_REQUEST['gamesearch']=htmlentities($_REQUEST['gamesearch'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
}
// $theaffv=getsetaffiliate($affv,$greq,'gameindex', $subid);
function singularlist($string)
{
return $string; // buggy
$obj = new Inflect();
$words = explode(' ', $string );
$newterm="";
foreach ($words as $key => $val) {
$singular=$obj->singularize($val);
$newterm=$newterm." ".$singular;
}
return trim($newterm);
}
function cleangs($gs)
{
$gs=str_replace("games", "", $gs);
$gs=str_replace("game", "", $gs);
$gs=str_replace("play", "", $gs);
$gs=str_replace("video", "", $gs);
$gs=str_replace("videos", "", $gs);
$gs=str_replace("facts for kids", "", $gs);
$gs=str_replace("cool math", "math", $gs);
$gs=str_replace("cool math", "math", $gs);
$gs=htmlspecialchars($gs, ENT_QUOTES);
$gs=singularlist($gs);
$gs =html_entity_decode($gs, ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8');
return $gs;
}
function formatGamePlays($plays) {
if ($plays >= 1000000) {
return round($plays / 1000000, 1) . 'm';
} elseif ($plays >= 1000) {
return round($plays / 1000, 1) . 'k';
} else {
return $plays;
}
}
function showstars ( $number, $plays=0, $votes=0 ) {
// Convert any entered number into a float
// Because the rating can be a decimal e.g. 4.5
$number = number_format ( $number, 1 );
// Get the integer part of the number
$intpart = floor ( $number );
// Get the fraction part
$fraction = $number - $intpart;
// Rating is out of 5
// Get how many stars should be left blank
$unrated = 5 - ceil ( $number );
// Populate the full-rated stars
if ( $intpart <= 5 ) {
for ( $i=0; $i<$intpart; $i++ )
echo '';
}
// Populate the half-rated star, if any
if ( $fraction == 0.5 ) {
echo '
';
}
// Populate the unrated stars, if any
if ( $unrated > 0 ) {
for ( $j=0; $j<$unrated; $j++ )
echo '
';
}
$p = formatGamePlays($plays);
$v = formatGamePlays($votes);
if($p >0 && $v > 1)
{
echo '
![]() | Desktop"; } else { // echo " Mobile Games"; } ?> |
'; echo "".strtoupper($one)." top"; echo ' |
$name ($hits) | "; } } echo '
";
?>
1 ) {
$gs=cleangs($gs);
}
// use function!
$gs=$mysqli->real_escape_string($gs);
// echo $query;
$result = $mysqli->query($query);
/* Setup page vars for display. */
if ($page == 0) $page = 1; //if no page var is given, default to 1.
$prev = $page - 1; //previous page is page - 1
$next = $page + 1; //next page is page + 1
$lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up.
$lpm1 = $lastpage - 1; //last page minus 1
/*
Now we apply our rules and draw the pagination object.
We're actually saving the code to a variable in case we want to draw it more than once.
*/
$pagination = "";
if($lastpage > 1)
{
$pagination .= " ";
//previous button
if ($page > 1)
{
$pagination.= "<<< previous";
$singlepageleft=" < ";
}
else
{
$pagination.= "<<< previous";
$singlepageleft=" < ";
}
//pages
$singlepageleft=" < ";
if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "$counter";
else
$pagination.= "$counter";
}
}
elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some
{
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= "$counter";
else
$pagination.= "$counter";
}
$pagination.= "...";
$pagination.= "$lpm1";
$pagination.= "$lastpage";
}
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "1";
$pagination.= "2";
$pagination.= "...";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= "$counter";
else
$pagination.= "$counter";
}
$pagination.= "...";
$pagination.= "$lpm1";
$pagination.= "$lastpage";
}
//close to end; only hide early pages
else
{
$pagination.= "1";
$pagination.= "2";
$pagination.= "...";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "$counter";
else
$pagination.= "$counter";
}
}
}
//next button
if ($page < $counter - 1) {
$pagination.= "next >>>";
$singlepageright=" > ";
}
else {
$pagination.= "next >>>";
$singlepageright = " > ";
}
$pagination.= " \n";
}
// old recent play
if($tpd > 0)
{
if( isset($_GET['recentadd']) && $_GET['recentadd']==1 )
{
if(stripos($setcategoryd,'recent') !== false)
{}
else
{
$setcategoryd="Recently Added ".$setcategoryd;
}
}
//echo "";
echo " $setcategoryd $mbgame Games.";
if( !$setcategoryd=="All") echo "$tpd results.";
}
else
{
echo " $setcategoryd Games.";
}
?>
Reload Games '; } if ( isset( $_REQUEST['nowplayingmg']) && $_REQUEST['nowplayingmg']=='1' ) { //echo ' '; } ?> 0) { echo ' '; } echo "
|