sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql); } $Amount_Of_Posts = $db->sql_numrows( $result ); if($Amount_Of_Posts < $posts) { $diff_posts = $posts - $Amount_Of_Posts; if($arcade_config['limit_type']=='posts') { $message = "You need $posts posts to play the arcade.
You need $diff_posts more posts."; } else { $message = "You need $posts posts in the last $days days to play the arcade.
You need $diff_posts more posts."; } message_die(GENERAL_MESSAGE, $message); } } //End Limit Play mod if (!empty($HTTP_POST_VARS['gid']) || !empty($HTTP_GET_VARS['gid'])) { $gid = (!empty($HTTP_POST_VARS['gid'])) ? intval($HTTP_POST_VARS['gid']) : intval($HTTP_GET_VARS['gid']); } else { message_die(GENERAL_ERROR, "No game is specified"); } $sql = "SELECT g.* , u.username, MAX(s.score_game) as highscore FROM " . GAMES_TABLE . " g left join " . SCORES_TABLE . " s on g.game_id = s.game_id left join " . USERS_TABLE . " u on g.game_highuser = u.user_id WHERE g.game_id = $gid GROUP BY g.game_id,g.game_highscore"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, "Could not read games table", '', __LINE__, __FILE__, $sql); } if (!($row = $db->sql_fetchrow($result)) ) { message_die(GENERAL_ERROR, "This game does not exist", '', __LINE__, __FILE__, $sql); } $mode = $HTTP_GET_VARS['mode']; if($mode == "done") { $gamename = $row['game_name']; // set page title $page_title = "Current Highscore's for " .$gamename; $gen_simple_header = TRUE; include("includes/page_header_review.php"); $template->set_filenames(array( 'body' => 'gamespopup_finish.tpl')); $template->assign_vars(array( 'GAMENAME' => $gamename, 'PLAYAGAIN' => append_sid("gamespopup.$phpEx?gid=$gid", true), 'RETURN' => append_sid("arcade.$phpEx", true), )); $sql = "SELECT s.* , u.username FROM " . SCORES_TABLE . " s left join " . USERS_TABLE . " u on s.user_id = u.user_id WHERE game_id = $gid ORDER BY s.score_game DESC, s.score_date ASC LIMIT 0,15 "; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, "Could not read from scores table", '', __LINE__, __FILE__, $sql); } $pos = 0; $posreelle = 0; $lastscore = 0; while ($row = $db->sql_fetchrow($result)) { $posreelle++; if ($lastscore!=$row['score_game']) { $pos = $posreelle; } $lastscore = $row['score_game']; $class = ($class == 'row1') ? 'row2' : 'row1'; $template->assign_block_vars('scorerow', array( 'CLASS' => $class, 'POS' => $pos , 'USERNAME' => $row['username'], 'URL_STATS' => '' . "" . $lang[" . ' ', 'SCORE' => number_format($row['score_game']), 'DATEHIGH' => create_date($board_config['default_dateformat'] , $row['score_date'] , $board_config['board_timezone'])) ); } // // Generate the page end // $template->pparse('body'); include("includes/page_tail_review.php"); exit; } $liste_cat_auth_play = get_arcade_categories($userdata['user_id'], $userdata['user_level'],'play'); $tbauth_play = array(); $tbauth_play = explode(',',$liste_cat_auth_play); if (!in_array($row['arcade_catid'],$tbauth_play)) { message_die(GENERAL_MESSAGE, $lang['game_forbidden']); } //chargement du template $template->set_filenames(array( 'body' => 'gamespopup_body.tpl') ); $sql = "DELETE FROM " . GAMEHASH_TABLE . " WHERE hash_date < " . (time() - 72000); if (!$db->sql_query($sql)) { message_die(GENERAL_ERROR, "Could not delete from the hash table", '', __LINE__, __FILE__, $sql); } // Type V2 Game Else Type V1 if ($row['game_type'] == 3) { $type_v2 = true; $template->assign_block_vars('game_type_V2',array()); $gamehash_id = md5(uniqid($user_ip)); $sql = "INSERT INTO " . GAMEHASH_TABLE . " (gamehash_id , game_id , user_id , hash_date) VALUES ('$gamehash_id' , '$gid' , '" . $userdata['user_id'] . "' , '" . time() . "')"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, "Could not delete from the hash table", '', __LINE__, __FILE__, $sql); } } elseif ($row['game_type'] == 4 or $row['game_type'] == 5) { if ($row['game_type'] == 5) { $template->assign_block_vars('game_type_V5',array()); } else { $template->assign_block_vars('game_type_V2',array()); } setcookie('gidstarted', '', time() - 3600); setcookie('gidstarted',$gid); setcookie('timestarted', '', time() - 3600); setcookie('timestarted', time()); $gamehash_id = md5($user_ip); $sql = "INSERT INTO " . GAMEHASH_TABLE . " (gamehash_id , game_id , user_id , hash_date) VALUES ('$gamehash_id' , '$gid' , '" . $userdata['user_id'] . "' , '" . time() . "')"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, "Couldn't update hashtable", '', __LINE__, __FILE__, $sql); } } else { message_die(GENERAL_ERROR, "Game Type no longer supported, please contact the admin and have him/her delete it."); } setcookie('arcadepopup', '', time() - 3600); setcookie('arcadepopup', '1'); $scriptpath = substr($board_config['script_path'] , strlen($board_config['script_path']) - 1 , 1) == '/' ? substr($board_config['script_path'] , 0 , strlen($board_config['script_path']) - 1) : $board_config['script_path']; $scriptpath = "http://" . $board_config['server_name'] .$scriptpath; $sql = "SELECT arcade_cattitle FROM " . ARCADE_CATEGORIES_TABLE . " WHERE arcade_catid = " . $row['arcade_catid']; $result = $db->sql_query($sql); $ourrow = $db->sql_fetchrow($result); $cat_title = $ourrow['arcade_cattitle']; $template->assign_vars(array( 'SWF_GAME' => $row['game_swf'] , 'GAMEHASH' => $gamehash_id, 'L_GAME' => $row['game_name'], 'HIGHUSER' => ($row['username']!= '') ? "'s Highscore: ".$row['username']." - ": " : No Highscore", 'HIGHSCORE' => $row['highscore']) ); // // Output page header $page_title = $lang['arcade_game']; $template->pparse('body'); ?>