'; // prevent loading without a page $use_header = '1'; $path_var = "Home "; $connectdb = '1'; // get config file include('config.php'); // set up random icon picking range($start,$stop); $rand_set = range(1,50); shuffle($rand_set); shuffle($rand_set); $max_icons_available = 104; // init the counter $rand_cntr = 1; // set title $titlebar_text = "Most Recently Added Games"; $title_text = "Most Recently Added Games"; $intro_text = "These are the most recently added games at Jokes'nFun.com. Enjoy!"; include('/var/www/jokesnfun.com/web/header.php'); include('/var/www/jokesnfun.com/web/games/topmenu.php'); print <<$title_text $intro_text EOM; while ($myrow = mysqli_fetch_array($result2)) { // get the vars $game_id = trim($myrow['game_id']); $display_name = trim($myrow['display_name']); $image_name = trim($myrow['image_name']); $times_played = trim($myrow['times_played']); $rating = trim($myrow['rating']); $ratimg = round($rating) . "stars"; $display_name = preg_replace('|-|', ' ', $display_name); // correct for missing icons if($image_name == "stand_in.jpg"){ $image_name = image_picker(); } print <<

EOM; //////////////////////////////////// // get newest games by date // how many items to display? // total is max_across * max_down $max_across = 2; $max_down = 8; $max_items = ($max_across * $max_down); print <<

EOM; $query2 ="SELECT * FROM game_list WHERE enabled = '1' ORDER BY add_date DESC LIMIT $max_items"; //print "Q: $query2
"; $result2 = mysqli_query($dbcon, $query2) or die(mysqli_error()); //print "RESULT: $result2
"; $cellcounter = 0; print <<
$display_name

Played $times_played times
EOM; $cellcounter++; $itemcounter++; if($cellcounter == $max_across){ print "\n"; $cellcounter = 0; if($itemcounter != $max_items){ print "\n"; } } } if($cellcounter == '1'){print "  ";} if($cellcounter == '2'){print " ";} print "\n

\n\n"; print << EOM; // get footer include('/var/www/jokesnfun.com/web/footer.php'); /////////////////////////////////////////// function image_picker(){ // selects an icon for games without an image global $image_name, $rand_set, $max_icons_available, $start, $stop, $rand_cntr; $rand_image = $rand_set[$rand_cntr]; $rand_cntr++; // check to make sure we didn't run out of numbers // if so, refresh the rand_set array if($rand_cntr){ // create a new array range($start,$stop); // fill it $rand_set = range(1,$max_icons_available); // 50 icons available // randomize it shuffle($rand_set); shuffle($rand_set); // reset the counter $rand_cntr = 1; } $image_name = "stand_in$rand_image.jpg"; return $image_name; } ?>