jquery - Randomly Rotate PHP files in sidebar on page refresh -


i have 4 php files have small php , jquery game inside.

the files follows:

/game1.php /game2.php /game3.php /game4.php 

every time page refreshed want 1 of games show in sidebar. when page refreshed again, different game , so.

is there way include files in sidebar @ random via kind of query on page refresh, if so, please me code. thanks!

$games = array('game1.php','game2.php','game3.php','game4.php'); session_start(); $used = array(); if (isset($_session['used'])){     $used = $_session['used']; } $usable = array_diff($games,$used); if (sizeof($usable)==0){     $usable = $games;     $_session['used'] = array(); }  $inuse = $usable[array_rand($usable)]; $_session['used'][] = $inuse;  include($inuse); 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -