-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 '
('.$p.', '.$v.' votes)
'; } else if($p>0 && $v==1) { echo '
('.$p.', '.$v.' vote)
'; } else if($p>0) { echo '
('.$p.')
'; } } if (isset($_REQUEST['gamesearch'])) { $gs=$_REQUEST['gamesearch']; $gs=trim($_REQUEST['gamesearch']); if( strlen($gs) > 1 ) { $gs=cleangs($gs); } $_SESSION['lastsearchgames']=$gs; } else { $gs=$_SESSION['lastsearchgames']; } ?> <?php if( $gst=="all" || $gst=='') { echo "Free "; } else { echo "Free ".ucfirst($gst); } ?> Games | Free Online Games for Kids | KidzSearch.com "; } else { echo ""; } ?> Games | Free Online Games for Kids | KidzSearch.com"/> " >
EDIT MODE "; $statusmarker="-10000"; } $iphone=0; $phone=0; $tablet=0; $mobile=0; $desk=0; // echo "MB ".$detect->isMobile(); if( isset($_SESSION['mobile']) )$mobile= $_SESSION['mobile']; if( isset($_SESSION['desk']) )$desk=$_SESSION['desk']; $related=0; if ( ( isset($_GET['related']) && $_GET['related']==1 ) ) { $related=1; } if ( ( isset($_GET['desktop']) && $_GET['desktop']==1 ) ) { $desk=1; $mobile=0; $_SESSION['desk']=1; $_SESSION['mobile']=0; } if ( (isset($_GET['mobile']) && $_GET['mobile']==1) || ( $detect->isMobile() && $desk==0) ) { $setcategory="Mobile"; $mobile=1; $_SESSION['mobile']=1; $_SESSION['desk']=0; } if($detect->isIphone() ) { $iphone=1; // $statusmarker="-10000"; } $ismobileandwhere=" AND ( mobileonly='0' ) "; // $ismobileandwhere=" AND ( ismobile='0' ) "; $linebr=""; if( $mobile==1 || $tablet==1) { $phone=1; $linebr="

           "; //$statusmarker="-10000"; $phonewhere=" AND ismobile='1' "; $ismobileandwhere=" AND ( ismobile='1' ) "; } ?> 2) { $cache_folder = 'cache/'; //folder to store Cache files (shorter term) } } // $ignore = (in_array($dynamic_url,$ignore_pages))?true:false; //check if url is in ignore list $dynamic_url = 'http://'.$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING'] . $phone; // requested dynamic page (full url) $cache_file = $cache_folder.md5($dynamic_url).$cache_ext; // construct a cache file $cachefile=$cache_file; $ignore=false; $cachetime = 24 * 3600 * 7; // 1 week if (strpos($dynamic_url,'pop=1') !== false) { $cachetime = 24 * 3600 * 1; // 1 day // echo " NOW PLAYING ||||||||||||||||||||||||| "; } if (strpos($dynamic_url,'pop=7') !== false) { $cachetime = 24 * 3600 * 7; // 7 days // echo " NOW PLAYING ||||||||||||||||||||||||| "; } if (strpos($dynamic_url,'pop=30') !== false) { $cachetime = 24 * 3600 * 30; // 30 days // echo " NOW PLAYING ||||||||||||||||||||||||| "; } if (strpos($dynamic_url,'recentadd') !== false) { $cachetime = 3600*1; // 1 hour // echo " NOW PLAYING ||||||||||||||||||||||||| "; } if (strpos($dynamic_url,'plays=1') !== false) { $cachetime = 3600*1; // 1 hours // echo " NOW PLAYING ||||||||||||||||||||||||| "; } if (strpos($dynamic_url,'shuffle=1') !== false) { $cachetime = 1; // // echo " NOW PLAYING ||||||||||||||||||||||||| "; } if (strpos($dynamic_url,'starrating=1') !== false) { $cachetime = 3600*6; // 6 hours // echo " NOW PLAYING ||||||||||||||||||||||||| "; } if (strpos($dynamic_url,'nowplaying=1') !== false) { $cachetime = 7; // 15 secs // error_log($query); // $ignore=true; // echo " NOW PLAYING ||||||||||||||||||||||||| "; } if (strpos($dynamic_url,'nowplayingmg=1') !== false) { $cachetime = 0; // 15 secs } // Serve from the cache if it is younger than $cachetime if( $ip=="x162.201.250.6" ) { // $cachetime =0; } // $cachetime = 0; if (strpos($dynamic_url,'nocache=1') !== false || isset($_GET['allcat']) ) { $cachetime = 0; $dynamic_url = 'http://'.$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING'] . $phone; // requested dynamic page (full url) $dynamic_url=str_replace("&nocache=1","",$dynamic_url); $dynamic_url=str_replace("?nocache=1","",$dynamic_url); $dynamic_url=str_replace("nocache=1","",$dynamic_url); $cache_file = $cache_folder.md5($dynamic_url).$cache_ext; // construct a cache file $cachefile=$cache_file; // echo " (( $dynamic_url )) ".$cache_file; } if (!$ignore && ( file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile))) ) { session_start(); if( !isset($_SESSION["floorad"]) ) $_SESSION["floorad"] = "1"; // setcookie('ksfloorad1', '1', time() + (86400 * 0.5 ), '/', '.kidzsearch.com'); // 12 hr include($cachefile); /** if( $_SESSION["floorad"]==1 ) { $_SESSION["floorad"]=2; echo ""; if( !isset($_COOKIE['ksfloorad1'])) // won't be set until another page load { echo "
"; } } */ echo ""; exit; } ob_start(); // start the output buffer // echo $phonewhere; $mysqli = new mysqli('localhost', 'gamez', 'zentech2', 'gamez-db'); if (mysqli_connect_errno()) { error_log("Connect failed: %s\n", mysqli_connect_error()); exit(); } mysqli_set_charset($mysqli, "utf8"); ?>
        free games   Desktop"; } else { // echo "  Mobile Games"; } ?>

"; $searchkidzsearchchecked="checked"; $searchwebchecked=""; if( isset($_REQUEST['localsearch']) ){ $searchkidzsearchchecked="checked"; $searchwebchecked=""; } echo ""; echo "

      kidzsearch   all sites "; if( $mobile==1 || $tablet==1) { echo "
"; } ?>     Sort: plays   rating   new   random

'game' and name <>'games') and ( (main='0' and matches > 1) OR main='1') order by name asc;"; if ( $phone==1 || $tablet==1 ) { $query = "select catid, name, mobilematches as matches, main, icon from gamecat where status='0' and ( (mobilemain='0' and mobilematches > 1) OR mobilemain='1') and (name not like '#%' AND name not like '%,%' AND name not like '%.' AND name <>'game' and name <>'games') order by name asc;"; } ?>
'game' and name <>'games') and ( (main='0' and matches > 1) OR main='1') and name like '".$one."%' order by name asc"; $link = new mysqli('localhost', 'gamez', 'zentech2', 'gamez-db'); mysqli_set_charset($link, "utf8"); $cols = 7; //number of columns, you can set this to any positive integer $values = array(); $dupcheck= array(); $result = $link->query($query); $numrows = $result->num_rows; $rows_per_col = ceil($numrows / $cols); for ($c=1;$c<=$cols;$c++) { $values['col_'.$c] = array(); } $c = 1; $r = 1; unset($matches); unset($main); while ($row = $result->fetch_assoc()) { $catnv=stripslashes($row['name']); if( isset($dupcheck[$catnv]) ) continue; $dupcheck[$catnv]=1; $matches[$catnv]=$row['matches']; $main[$catnv]=$row['main']; $values['col_'.$c][$r] = stripslashes($row['name']); if ($r == $rows_per_col) { $c++; $r = 1; } else { $r++; } } echo ''; echo ''; for ($c=1;$c<=$cols;$c++) { echo ''; } for ($r=1;$r<=$rows_per_col;$r++) { echo ''; for ($c=1;$c<=$cols;$c++) { $name=$values['col_'.$c][$r]; $hits=$matches[$name]; $dclass="allcat"; if($main[$name]=="1" || $hits > 100 ){$dclass="allcatb"; } if ( $phone==1 || $tablet==1 ) { if($main[$name]=="1" || $hits > 50 ){$dclass="allcatbmobile"; } } if( isset($hits) && $hits >0 ){ $name = str_ireplace("adult","adult grown-up",$name); echo ""; } } echo ''; } $lessset=1; //echo $_SESSION['mainheader']; echo '
'; echo "".strtoupper($one)." top"; echo '
$name ($hits)
'; unset($values); echo "
"; } $lessset=1; // echo $_SESSION['mainheader']; //echo "  less..."; echo ''; unset($values); } else if ( isset($_GET['allcat']) ) { $query="select catid, name, icon from gamecat where status='0' order by name "; $result = $mysqli->query($query); $maincats="
"; echo $maincats; } else if ( $phone==1 || $tablet==1 ) { $maincats="All Learn Puzzle Girl Action Skill Fun Matching "; $result = $mysqli->query($query); $maincats="All Learn "; while($row = $result->fetch_assoc()) { $catid=$row['catid']; $name=$row['name']; $name=ucfirst($name); $iconvalue=""; $maincats=$maincats." $iconvalue $name "; } //echo $maincats; } else if ( $phone==0 && $tablet==0 ) { $result = $mysqli->query($query); $maincats="            All Learn "; while($row = $result->fetch_assoc()) { $catid=$row['catid']; $name=$row['name']; $name=ucfirst($name); $iconvalue=""; $maincats=$maincats." $iconvalue $name "; } $_SESSION['mainheader']=$maincats; if ( isset($_GET['allcat']) ) { $gs=$_REQUEST['gamesearch']; $gs=trim($_REQUEST['gamesearch']); if( strlen($gs) > 1 ) { $gs=cleangs($gs); } $lessset=1; $maincats=$maincats."less..."; } else { $gs=$_REQUEST['gamesearch']; $gs=trim($_REQUEST['gamesearch']); if( strlen($gs) > 1 ) { $gs=cleangs($gs); } // $maincats=$maincats."more..."; } // $maincats=$maincats."more..."; // echo $maincats; } if( !($lessset==1) ) { $maincats=$maincats."more..."; $lessset=0; } else { $maincats=$maincats."less..."; } ?>


            New | Popular | Top Rated | Feeling Lucky? | Game History    Hot:  Now Playing | Today | Week | Month | All Time | Mobile Games | IO Games  
'; } ?>
-1 AND ismobile='1' AND "; } // $whereclause="category="; // $orderby="order by status desc, score desc, plays desc, vendorweight desc "; // $orderby="order by status desc, vendorweight desc, score desc, plays desc"; // $orderby="order by plays desc, score desc, status desc, vendorweight desc "; // $orderby="order by plays30 desc, plays desc, kscore desc, score desc, status desc, vendorweight desc "; $orderby="order by (flashcheckresult > -1 ) DESC, plays30 desc, plays desc, kscore desc, score desc, status desc, vendorweight desc "; $orderby="order by promoted2 desc, promoted desc, (flashcheckresult > -1 ) DESC, plays desc, kscore desc, score desc, status desc, vendorweight desc "; $recentadd=""; $plays=""; $learning=""; $starrating=""; $shuffle=""; $nowplaying=""; $nowplayingmg=""; if ( isset($_GET['recentadd']) && $_GET['recentadd']==1 ) { $plays=""; $starrating=""; $shuffle=""; $nowplaying=""; $nowplayingmg=""; $recentadd=1; $setcategory="Most Recent"; $orderby=" order by seq desc "; } $learnwhereand=""; $learnreq=0; if(stripos($greq,'learning') !== false) $learnreq=1; if ( ( isset($_GET['learning']) && $_GET['learning']==1) || $learnreq==1 ) { $gs="learning"; $learning=1; $setcategory="Learning"; $learnwhereand=" AND islearning='1' "; $orderby="order by (flashcheckresult > -1 ) DESC, plays30 desc, plays desc, kscore desc, score desc, vendorweight desc, status desc "; if ( isset($_GET['recentadd'] ) ) { $orderby="order by seq desc, plays desc, kscore desc, score desc, vendorweight desc, status desc "; } } if($learnreq==1 && isset($_GET['recentadd']) && $_GET['recentadd']==1 ) { $setcategory="Most Recent Learning"; } if ( isset($_GET['starrating']) && $_GET['starrating']==1 ) { $recentadd=""; $plays=""; $shuffle=""; $nowplaying=""; $nowplayingmg=""; $setcategory="Highest Rated"; if ( isset($_GET['learning']) && $_GET['learning']==1 ) { $setcategory="Highest Rated Learning"; } $orderby=" order by score desc, plays desc, status desc, vendorweight desc "; $starrating=1; } if ( isset($_GET['plays']) && $_GET['plays']==1 ) { $recentadd=""; $starrating=""; $shuffle=""; $nowplaying=""; $nowplayingmg=""; $setcategory="Most Played"; if ( isset($_GET['learning']) && $_GET['learning']==1 ) { $setcategory="Most Played Learning"; } $plays=1; $orderby=" order by plays desc, score desc, status desc, vendorweight desc "; } if ( isset($_GET['shuffle']) ) { $recentadd=""; $plays=""; $starrating=""; $setcategory="Random"; if ( isset($_GET['learning']) && $_GET['learning']==1 ) { $setcategory="Random Learning"; } $shuffle=1; $orderby=" ORDER BY RAND() "; } $whereclause=" where $where2 status > $statusmarker $flashandcheck $gamedup "; $whereclausesearch=" $where2 status > $statusmarker "; if ( isset($_GET['nowplaying']) && $_GET['nowplaying']=='1' ) { // error_log(" AAAA ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Now playing request "); $recentadd=""; $plays=""; $starrating=""; $setcategory="Now Playing"; if ( isset($_GET['learning']) && $_GET['learning']==1 && $_GET['nowplaying']=='1' ) { $setcategory="Now Playing Education"; } $shuffle=1; $orderby=" ORDER BY changedate desc "; $whereclause=" where $where2 status > $statusmarker AND changedate > (NOW() - INTERVAL 120 MINUTE) and seq <>'192192' "; $query = "SELECT flashcheckresult, score, seq, source, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions FROM gamesplayed $whereclause $ismobileandwhere AND status > -1 $flashandcheck $orderby "; error_log(" NOW PLAYING QUERY ".$query); } else if ( isset($_GET['nowplayingmg']) && $_GET['nowplayingmg']=='1' && strlen($sessionid) > 10 ) { $recentadd=""; $plays=""; $starrating=""; $nowplaying=""; $setcategory="My Recently Played"; $shuffle=1; $orderby=" ORDER BY changedate desc "; // $sessionid = session_id(); $whereclause=" where $where2 status > $statusmarker "; $query = "SELECT flashcheckresult, score, seq, source, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions FROM gamesplayed $whereclause AND status > -1 AND sessionid = '".$sessionid."' $orderby "; //echo $query; } else { $query = "SELECT flashcheckresult, promoted, score, seq, source, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions FROM games $whereclause $ismobileandwhere AND status > -1 $flashandcheck $gamedup $orderby "; } // error_log(" ***************************************** NOW PLAYING *********************************************"); // echo $query; // $query = "SELECT * FROM games"; if ( isset($_REQUEST['gamesearch']) && strlen($_REQUEST['gamesearch']) > 1 ) { $gs=trim($_REQUEST['gamesearch']); $gs=trim($_REQUEST['gamesearch']); // echo " GS REQ $gs"; if( strlen($gs) > 1 ) { $gs=cleangs($gs); //echo " GS2 REQ $gs"; } $setcategory=$gs; $gs=$mysqli->real_escape_string($gs); // echo " GS REQ $category ".$setcategory; if(isset($gs) && strlen($gs) > 1) { // main search // echo "GS: $gs "; if ( !isset($catlistset) ) { $catquery="select name from gamecat where status='0' "; $catlistset = 1; $catresult = $mysqli->query($catquery); while($catrow = $catresult->fetch_assoc()) { $c=strtolower($catrow['name']); $thecatlist[$c]=1; //echo $c.' '; } } $gs =html_entity_decode($_REQUEST['gamesearch'], ENT_QUOTES | ENT_HTML5 | ENT_IGNORE, 'UTF-8'); $gs_stem = removeCommonWordsLarge($gs); $gs_stem = stemit($gs_stem); //echo "GS: ".$gs_stem; $query = "SELECT flashcheckresult, promoted, score, seq, vendorweight, category, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions FROM games WHERE status > $statusmarker $learnwhereand $ismobileandwhere AND status > -1 $flashandcheck $gamedup AND MATCH(title, tags, description, category, instructions) AGAINST ('\"$gs\"' IN BOOLEAN MODE) $orderby " ; $queryb = "SELECT flashcheckresult, promoted, score, seq, vendorweight, category, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions, stemed FROM games WHERE status > $statusmarker $learnwhereand $ismobileandwhere AND status > -1 $flashandcheck $gamedup AND MATCH(title, tags, description, category, instructions,stemed) AGAINST ('\"$gs_stem\"' IN BOOLEAN MODE) $orderby " ; $localset = 0; if ( isset($_REQUEST['localsearch']) && $_REQUEST['localsearch']=="1" || isset($_REQUEST['src']) && $_REQUEST['src']=="kzsearch" ) { error_log("LOCAL SEARCH SET "); $localset = 1; } // related=0&learning=0&recentadd=&starrating=&cat=&gamesearch=Racing&plays=1&catlist $gs_stem = trim($gs_stem); $query = "SELECT *, ( (2.3 * (MATCH(title) AGAINST ('$gs_stem' IN BOOLEAN MODE))) + (0.8 * (MATCH(tags) AGAINST ('$gs_stem' IN BOOLEAN MODE))) + (0.4 * (MATCH(description) AGAINST ('$gs_stem' IN BOOLEAN MODE))) + (0.4 * (MATCH(instructions) AGAINST ('$gs_stem' IN BOOLEAN MODE))) + (0.7 * (MATCH(category) AGAINST ('$gs_stem' IN BOOLEAN MODE))) + (2.3 * (MATCH(stemed) AGAINST ('$gs_stem' IN BOOLEAN MODE))) ) AS relevance FROM games WHERE (MATCH(title, tags,description, instructions, category, stemed) AGAINST ('$gs_stem' IN BOOLEAN MODE) ) AND STATUS > -1 and dup = '0' $flashandcheck order by (flashcheckresult > -1 ) DESC, relevance DESC, plays DESC "; if($localset==1) { $query = "SELECT *, ( (2.3 * (MATCH(title) AGAINST ('$gs_stem' IN BOOLEAN MODE))) + (0.8 * (MATCH(tags) AGAINST ('$gs_stem' IN BOOLEAN MODE))) + (0.4 * (MATCH(description) AGAINST ('$gs_stem' IN BOOLEAN MODE))) + (0.4 * (MATCH(instructions) AGAINST ('$gs_stem' IN BOOLEAN MODE))) + (0.7 * (MATCH(category) AGAINST ('$gs_stem' IN BOOLEAN MODE))) + (2.3 * (MATCH(stemed) AGAINST ('$gs_stem' IN BOOLEAN MODE))) ) AS relevance FROM games WHERE (MATCH(title, tags,description, instructions, category, stemed) AGAINST ('$gs_stem' IN BOOLEAN MODE) ) AND STATUS > -1 and dup = '0' order by relevance DESC, plays DESC "; } // // echo "GS: ".$gs.' | '.$thecatlist[ strtolower($gs)]; // print_r($thecatlist); // use for all cases if ( isset($_REQUEST['catlist']) || isset($thecatlist[ strtolower($gs)]) ) { $related=1; } //echo $querya; //echo $query4; if($related==1) { $matchterm=removeCommonWords2z($gs); $query = "SELECT flashcheckresult, promoted, score, seq, vendorweight, category, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions FROM games WHERE status > $statusmarker $learnwhereand $ismobileandwhere AND status > -1 $flashandcheck $gamedup AND MATCH(title, tags, description, category, instructions) AGAINST ('$matchterm' IN BOOLEAN MODE) $orderby " ; } } if($setcategory=="all" || $setcategory=="learning" ) { $query = "SELECT flashcheckresult, promoted, score, seq, vendorweight, category, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions FROM games $whereclause $ismobileandwhere AND status > -1 $flashandcheck $gamedup $learnwhereand $orderby " ; } // echo $query; } // error_log($query); // error_log("BBBBBBB ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Now playing request "); $thedevice="computer"; // echo "$setcategory "; if($tablet==1 || $phone==1) { $thedevice="mobile"; $query="SELECT flashcheckresult, promoted, score, seq, vendorweight, category, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions FROM games where status > -1 AND status <> '-4' AND status <> '-3' $flashandcheck $gamedup $ismobileandwhere $learnwhereand $orderby "; if ( isset($_GET['nowplaying']) && $_GET['nowplaying']=='1' ) { $orderby=" ORDER BY changedate desc "; $whereclause=" where $where2 status > $statusmarker AND changedate > (NOW() - INTERVAL 120 MINUTE) "; $query = "SELECT flashcheckresult, score, seq, source, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions FROM gamesplayed $whereclause AND status > -1 $flashandcheck $ismobileandwhere $orderby "; } if ( isset($_GET['nowplayingmg']) && $_GET['nowplayingmg']=='1' ) { $orderby=" ORDER BY changedate desc "; $whereclause=" where $where2 status > $statusmarker "; $query = "SELECT flashcheckresult, score, seq, source, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions FROM gamesplayed $whereclause AND status > -1 AND sessionid='".$sessionid."' $orderby "; } // error_log("++++++++++++++++++++++++++++++++++ GAME LOG FINAL QUERY "); // error_log($query); if( isset($setcategory) && strlen($setcategory) > 2 && !($setcategory=="all" || $setcategory=="learning" || $setcategory=="Most Recent" || $setcategory=="Most Played" || $setcategory=="Highest Rated" || $setcategory=="Random" ) ) { if(isset($gs) && strlen($gs) > 1) { $query = "SELECT flashcheckresult, promoted, score, seq, vendorweight, category, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions FROM games WHERE status > $statusmarker $learnwhereand AND status > -1 $flashandcheck $gamedup $ismobileandwhere AND MATCH(title, tags, description, category, instructions) AGAINST ('\"$gs\"' IN BOOLEAN MODE) $orderby " ; if($related==1) { $matchterm=removeCommonWords2z($gs); $query = "SELECT flashcheckresult, promoted, score, seq, vendorweight, category, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions FROM games WHERE status > $statusmarker $learnwhereand AND status > -1 $flashandcheck $gamedup $ismobileandwhere AND MATCH(title, tags, description, category, instructions) AGAINST ('$matchterm' IN BOOLEAN MODE) $orderby " ; } } } } //echo "SC: ".$setcategory; //if($setcategory == "All")$_GET['pop'] = 30; if ( isset($_GET['pop']) && $_GET['pop']>0 && is_numeric($_GET['pop']) ) { $popv=$_GET['pop']; $popv=$mysqli->real_escape_string($popv); if($popv==1) $setcategory="Today's Hot"; if($popv==7) $setcategory="Weekly Hot"; if($popv==30) $setcategory="Monthly Hot"; if($popv>300) $setcategory="All Time Hot"; $query="SELECT flashcheckresult, games.score, games.seq, games.vendorweight, games.category, games.status, games.counter, games.value, games.plays, games.cloud, games.seotitle, games.title, games.img1, hotgames.hits as gamehits, games.changedate, games.tags, games.description, games.instructions FROM games RIGHT JOIN hotgames ON games.seq=hotgames.seq WHERE hotgames.device='$thedevice' AND hotgames.cycle='$popv' AND games.status > -1 $flashandcheck $gamedup $ismobileandwhere ORDER BY hotgames.hits DESC"; } if( $ip=="104.60.17.86" ) { // echo "EDIT MODE "; // $query = "SELECT flashcheckresult, promoted, score, vendorweight, category, status, counter, value, plays, cloud, seotitle, flash_file, title, img1 FROM games where status < 0 order by plays desc"; //echo "$query
"; } //echo $query; $total_pages=0; $result = $mysqli->query($query); if ($result) { $total_pages = $result->num_rows; //error_log("FINAL QUERY"); //error_log($query); } $tpd=number_format($total_pages); // echo " RESULTS $tpd "; if($tpd < 1 ) { if(isset($gs) && strlen($gs) > 1) { $matchterm=removeCommonWords2z($gs); $query = "SELECT flashcheckresult, promoted, seq, score, vendorweight, category, status, counter, value, plays, cloud, seotitle, flash_file, title, img1, changedate, tags, description, instructions FROM games WHERE status > -1 $flashandcheck $gamedup $learnwhereand $ismobileandwhere AND MATCH(title, tags, description, category, instructions) AGAINST ('$matchterm' IN BOOLEAN MODE) $orderby " ; } if( $ip=="x104.60.17.86" ) { // echo "q2
$query
"; } //echo $query; //error_log($query); $result = $mysqli->query($query); $total_pages = $result->num_rows; $tpd=number_format($total_pages); } // error_log($query); if( strlen($setcategory)<2 ) $setcategory=""; $setcategoryd=ucwords(displaycat($setcategory)); if ( isset($_GET['plays']) && $_GET['plays']==1 ) { $setcategoryd="Most Played $setcategoryd"; } if ( isset($_GET['starrating']) && $_GET['starrating']==1 ) { $setcategoryd="Highest Rated $setcategoryd"; } if ( isset($_GET['shuffle']) && $_GET['shuffle']==1 ) { $setcategoryd="Random $setcategoryd"; } if (strpos($setcategoryd,'Most Played Most Played') !== false) { $setcategoryd="Most Played"; } if (strpos($setcategoryd,'Highest Rated Highest Rated') !== false) { $setcategoryd="Highest Rated"; } if (strpos($setcategoryd,'Random Random') !== false) { $setcategoryd="Random"; } $mbgame=""; if( $mobile==1 || $tablet==1) { $mbgame=" Mobile"; } 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 "
"; // error_log($query); if ( !isset($_GET['recentadd'] ) && !isset($_GET['gamesearch'] ) && !isset($_GET['recentadd'] ) && !isset($_GET['plays'] ) && !isset($_GET['related'] ) && !isset($_GET['learning'] ) && !isset($_GET['starrating'] ) && !isset($_GET['shuffle'] ) && !isset($_GET['featured'] ) && !isset($_GET['page'] ) && !isset($_GET['pop'] ) && !isset($_GET['nowplayingmg'] ) && !isset($_GET['nowplaying']) ) { // echo "
"; echo "
"; // echo "
   Featured Games

"; } elseif (false) { /** echo "   
  "; echo ' '; echo "
"; */ //echo "Ad3"; } // echo "
"; unset($duplist); $gamecounter=0; $gamecountervoted=0; $ksrows = []; $ksscore = []; $iscore=0; while($row = $result->fetch_assoc()) { $iscore++; $ksrows[] = $row; $ksscore[$iscore] = $iscore; if( $row['flashcheckresult'] < 0 ) { $ksscore[$iscore] = $ksscore[$iscore] + 100000; } } //print_r($ksscore); //die(); // sort return array by score // sort by score unless a specific search was done if($localset == 0) { array_multisort( $ksscore, SORT_ASC, $ksrows ); } // while($row = $result->fetch_assoc()) $gamehits=0; foreach($ksrows AS $row) { $gamecounter++; $isflashgame=$row['flashcheckresult']; $promoted=$row['promoted']; $title=htmlspecialchars($row['title']); $gpinstruction=$row['instructions']; $gpdescription=$row['description']; $gptags=$row['tags']; $dupindex=md5($title.'-'.$gpinstruction.'-'.$gpdescription); $linkplays=$row['plays']; if( isset($row['gamehits']) ) { $gamehits=$row['gamehits']; } $poptitle=''; if($linkplays > 5000 ) { $poptitle=" pop!"; $poptitle=''; } if($linkplays > 25000 ) { $poptitle=" hot!"; $poptitle=''; } if( !isset($_REQUEST['gamesearch'])) { $poptitle=''; } $title=str_replace("&#039;","'",$title); $title=html_entity_decode($title, ENT_QUOTES); //$title=htmlspecialchars($row['title']); //$title=str_replace("'", "", $title); //$title=str_replace("&", "and", $title); //$title=preg_replace('#[^a-zA-Z0-9 ]#', '', $title); //$title=str_replace("'s", "s", $title); //$title=str_replace("amp", "", $title); //$title=str_replace("and039s", "s", $title); //$title=html_entity_decode($title, ENT_QUOTES); if ( $row['seq'] < 1 ) continue; $status=$row['status']; $totalplays=$row['plays']; $totalcounter=$row['counter']; $totalvalue=$row['value']; $dstatus=$row['status']; $totalscore=0; $totalvotecount=0; $votevalue=$row['value']; $votecounter=$row['counter']; $votecountertotal=$votecounter + $votecountertotal; if($votecounter > 0 ){ $totalscore = round ( ((float)$votevalue / (float)$votecounter ), 1); $totalvotecount = $votecounter; } $seotitle=$row['seotitle']; $flash_file=$row['flash_file']; $thelink=$row['seotitle']; $displaythumbnail=$row['img1']; $cloud=$row['cloud']; // kzs3files on s3 if($cloud==1) { $displaythumbnail="https://s3.amazonaws.com/kzs3files/".$displaythumbnail; } else { $displaythumbnail="thumbs/".$displaythumbnail; } $width="106"; $height="80"; $width="190"; $height="120"; // 25% width 50% height $width="250"; $height="180"; // 25% increase //$width="250"; //$height="150"; $width="250"; $height="175"; $width="265"; $height="175"; $width="250"; $height="175"; if($phone==1 ) { $width="250"; $height="175"; } $width="222"; $height="158"; $width="210"; $height="158"; $checkit="0"; if($status =="0") {$checkit="6";} $title=trim($title); $dtitle = strlen($title) > 39 ? substr($title,0,39).".." : $title; $dtitle = strlen($title) > 31 ? substr($title,0,31).".." : $title; $dtitle=html_entity_decode($dtitle, ENT_QUOTES); $dtitle = preg_replace("/[^a-zA-Z0-9-.\s]/", "", $dtitle); $dtitle=$dtitle.$poptitle; $classdtitle="dtitle"; if ( $phone==1 || $tablet==1 ) { $classdtitle="dtitlemobile"; } if( $ip=="x162.201.250.6" ) { // $dtitle = $dtitle." ($dstatus) "; } if( isset($duplist[$dupindex]) && $duplist[$dupindex]=='1' && $numrows < 50 ) { continue; } $duplist[$dupindex]=1; if($total_pages < 3 ) { echo "
"; }; $dbx=preg_replace("/[^a-zA-Z0-9\s]+/", "", $title);; $dbx=str_replace("'","`",$title); echo "
"; }; echo"
"; $totalstars=$totalstars+$totalscore; showstars($totalscore, $totalplays, $totalvotecount ); if($isflashgame < 0 ) { // echo "(flash)"; } else { // echo "      "; } if($totalscore > 0) { $gamecountstars=$gamecountstars+1; } $iprop=''; if( $gamecountstars ==1 ){ $iprop="itemprop='image'"; } $iprop=''; /** if (stripos($flash_file, "https:") !== false) { echo "
"; echo "
$dtitle"; } else { echo "
"; echo "
$dtitle"; } */ echo "
"; echo "
$dtitle"; if ( (( isset($_GET['plays']) && $_GET['plays']==1 ) || ( isset($_GET['pop']) && $_GET['pop']> 0 ) ) && $totalplays >= 0 ) { $totalplays=number_format($totalplays); if( $gamehits > 0 ) $totalplays = number_format($gamehits); // echo "
($totalplays plays)"; $setcategory="Most Played"; } if($total_pages < 3 ) { echo "
"; } ?>

TOTAL STARS ".$totalstars." Total Games ".$gamecounter." Category "."Free ".ucfirst($gst); ?>
"; } $blockcopyright=0; if(stripos($x,'pacman') !== false || stripos($x,'pac man') !== false || stripos($x,'mcqueen') !== false || stripos($x,'anna and elsa') !== false || stripos($x,'frozen') !== false || stripos($x,'elsa') !== false || stripos($x,'anna') !== false || stripos($x,'disney') !== false || stripos($x,'cars') !== false || stripos($x,'onward') !== false || stripos($x,'aladdin') !== false || stripos($x,'tangled') !== false || stripos($x,'coco') !== false || stripos($x,'olaf') !== false ) { $blockcopyright=1; } if($tpds < 1 && $blockcopyright==0) { //$gsv=urlencode($_REQUEST['gamesearch']); $gs2=ucfirst($_REQUEST['gamesearch']); $gs3=ucwords($_REQUEST['gamesearch']); //$gsv=urldecode($gsv); $gsv=$_REQUEST['gamesearch']; /** echo "
  No Results Found.
Search for More $gs3 Free Online Games...



"; */ echo '

   Search for More '.$gs3.' Free Online Games...



'; } if($tpds > 0 ) { $gsv=urlencode($_REQUEST['gamesearch']); $gs2=ucfirst($_REQUEST['gamesearch']); $gs3=ucwords($_REQUEST['gamesearch']); echo "
   Search for More $gs3 Free Online Games...

"; } //echo "Query ".$query; $maintitlecat="Free ".ucfirst($gst)." Games"; $catdescription="Play the Best $maintitlecat on KidzSearch."; $starscore=0; if($totalstars >0 && $gamecountstars >0 ){ $starscore = round ( ((float)$totalstars / (float)$gamecountstars ), 1); } if (1==0 && is_numeric($totalstars) && $totalstars >0 && $starscore > 0 ) { //echo "
"; echo "$maintitlecat
$catdescription
"; $votecountertotal = number_format($votecountertotal); echo "$starscore  stars out of 5 ($votecountertotal votes)
"; } ?> 0 ) { echo ''; } ?>
     View Your Recently Played Games


'; } ?>

 

 


"; ?> Copyright 2005- KidzSearch.com 
"; ?>