connect($logindbhost, $logindbuser, $logindbpass, $logindbname); $db->query("set NAMES gbk"); $row = $db->fetch_first("select gameservers from users_game where username='".$username."'"); if(!empty($row)){//最近没有玩过游戏的话 $games=explode('|',$row['gameservers']); $dbs = new mysql; $dbs->connect($logdbhost, $logdbuser, $logdbpass, $logdbname); $dbs->query("set NAMES gbk"); foreach($games as $k =>$arr){//上次玩过 if(count($last)>2)break; //echo count($last); $arr=explode(',',$arr); $game=$arr[0]; $server=$arr[1]; $lase['game']=$game; $lase['server']='s'.$server; $res = $dbs->fetch_first("select servername,gamename from dede_gameserver where gname='".$game."' and server='s".$server."'"); if($res['gamename']!=''){ $lase['gamename']=$res['gamename']; $servernames=explode(' ',$res['servername']); $lase['servername']=$servernames[0]; $last[$lase['game']][]=$lase; } } //print_r($last); foreach($last as $k =>$val){//推荐服 $game=$k; $res = $dbs->query("select servername,server,gname from dede_gameserver where gname='".$game."' and delay<'".time()."' and state!='ready' order by id desc limit 3"); while($rs=mysql_fetch_assoc($res)){ $tuijian[$game][]=$rs; } } //print_r($tuijian); $db = mysql_connect($wwwdbhost,$wwwdbuser,$wwwdbpass) or die("fail"); mysql_select_db($wwwdbname); mysql_query("SET NAMES gbk"); foreach($last as $k =>$val){//图片 链接 $game=$k; $sql="select typeid,xsk,homepage from dede_addongames where gamename='".$game."'"; $query=mysql_query($sql); $asr=mysql_fetch_assoc($query); $link[$game]=$asr; } //var_dump($last); //echo $sql; } ?> 我的游戏
我的游戏
$val){?>
<?=$val[0]['gamename']?>

新服推荐:

玩过的服:

进入官网领取礼包

您还未玩过任何游戏!
';}?>