Geschrieben von MikeD.76 am 25.11.2003 um 21:26:
Hier mal die Proarcade
<?php
$filename="proarcade.php";
// * Arcade Hack By © jwi
http://jwi-forum.de *
// * Der Hack darf nur bei jwi-forum.de Angeboten werden. *
// * Die Games zum Hack gibt es hier!!! *
// *
http://games.jwi-forum.de *
// * Die Datei ist 2,51MB groß *
require("./global.php");
require("./acp/lib/class_useronline.php");
if(!$wbbuserdata['can_arcade_play']) access_error();
//*************Abfrage ob Spiel ein oder ausgeschalten ist*************************
{
$result = $db->query_first("SELECT einaus FROM bb".$n."_arcadeconfig" );
$einaus = $result[0];
if ($einaus == 0){
eval("\$tpl->output(\"".$tpl->get("vbproarcade_arcade_aus")."\");");
exit;
}
}
//************* Versionsnummer *************************
$version ="V1.7";
// little debug thing
if (isset($showallheaders)) {
$headers = getallheaders();
foreach ($headers as $name => $content)
echo "headers[$name] = $content<br>\n";
}
$result = $db->query_first("SELECT username FROM bb".$n."_users WHERE userid='$wbbuserdata[userid]'" );
$username1 = $result[0];
// defines how many people to display per page on the scoreboard
if (!isset($perpage) or ($perpage > 50) or ($perpage < 1))
$perpage = 25;
// get userid/username from session data
$username = $username1;
$userid = $wbbuserdata[userid];
// access check (here for future expansion)
switch($action) {
case "arcade":
case "scoreboard":
case "topscoreboard":
break;
case "play":
case "gameover":
break;
default:
// if no action specified, go to arcade page
$action = "arcade";
break;
}
// admin access check (here for future expansion)
switch($bbuserinfo[usergroupid]) {
case 6:
$allaccess = true;
break;
default:
$allacess = false;
break;
}
// game checks
if (!isset($game) and ($action != "arcade")) {
echo "vbProArcade Error: No game specified (todo: put something pretty here later)";
exit();
}
// get informaton about the arcade and the game we are using
$arcadeinfo = $db->query_first("SELECT * FROM bb".$n."_arcadeconfig");
$gameinfo = $db->query_first("SELECT * FROM bb".$n."_arcadegames WHERE name='$game'");
if (!arcadeinfo) {
echo "vbProArcade Error: Arcade configuration information could not be retrieved from the database.";
exit();
}
if (!gameinfo) {
echo "vbProArcade Error: Invalid game name specified (todo: put something pretty here later)";
exit();
}
// get the score value
eval("\$thescore = \"$gameinfo[scorevar]\";");
// get the path to the arcade games
$gamepath = $arcadeinfo[path];
// get the title of the game
$gametitle = $gameinfo[title];
// put the correct suffix on a number
function suffixlogic($number,$mode=0) {
// some simple logic to get the grammar correct
if (($number%10) == 1) {
if (($number%100) == 11) {
$returnval = "th";
} else {
$returnval = "st";
}
} elseif (($number%10) == 2) {
if (($number%100) == 12) {
$returnval = "th";
} else {
$returnval = "nd";
}
} elseif (($number%10) == 3) {
if (($number%100) == 13) {
$returnval = "th";
} else {
$returnval = "rd";
}
} else {
$returnval = "th";
}
if ($mode == 0)
$returnval = $number . $returnval;
return $returnval;
}
// reduce a url to everything following the "http://something.com"
function reduceurl($url) {
if (strpos($url,"http://") === false) {
$test = strpos($url,"/");
if ($test === false)
$zv = "";
else
$zv = substr($url,$test);
} else {
$xv = explode("//",$url);
$yv = $xv[count($xv)-1];
$test = strpos($yv,"/");
if ($test === false)
$zv = "";
else
$zv = substr($yv,$test);
}
return $zv;
}
// we are playing
if ($action == "play") {
//******************************counter***********************
$count1 = $db->query_first("SELECT counter FROM bb".$n."_arcadegames WHERE title='$game'" );
$count = $count1[0];
if ($count1 = $count + 1)
$db->query("UPDATE bb".$n."_arcadegames SET counter='$count1' WHERE title='$game'" );
//******************************counter***********************
if ($wbbuserdata[userid] == 0)
eval ("\$keingeld .= \"".$tpl->get("vbproarcade_arcade_nicht_berechtigt2")."\";");
if($wbbuserdata[userid]){
$highscore_q = $db-> query("SELECT * FROM bb".$n."_arcade WHERE game='$game' ORDER BY score DESC LIMIT 1");
$highscore_a = $db->fetch_array($highscore_q);
$highscore = $highscore_a[score];
// get the information to call the game with
$vpa_filename = $gamepath . $gameinfo[filename];
$vpa_width = $gameinfo[width];
$vpa_height = $gameinfo[height];
$vpa_codebase = $gameinfo[codebase];
$oparams = addslashes($gameinfo[objectparam]);
$eparams = addslashes($gameinfo[embedparam]);
// get the relative URL of the forum
$result = $db->query_first("SELECT url FROM bb".$n."_arcadeconfig" );
$vpa_bburl = $result[0];
{
if ($vpa_bburl == "")
$vpa_bburl = "$url2board";
else
$vpa_bburl;
}
// query string and param lists must be eval'd since it contains PHP vars
eval("\$vpa_qstring = \"$gameinfo[querystring]\";");
eval("\$vpa_oparams = \"$oparams\";");
eval("\$vpa_eparams = \"$eparams\";");
// get the code to call the game, then send the page
eval ("\$threadbit .= \"".$tpl->get("vbproarcade_playgame_flashcode")."\";");
eval("\$tpl->output(\"".$tpl->get("vbproarcade_playgame")."\");");
}
}
// register a new score
if ($action == "gameover") {
if ($userid == 0)
eval("\$tpl->output(\"".$tpl->get("vbproarcade_arcade_nicht_berechtigt")."\
");");
else
if ($thescore != 0) {
if (!$currYear) { $currYear = date("Y"); }
if (!$currMonth) { $currMonth = date("n"); }
if (!$currDay) { $currDay = date("j"); }
if (!$currTime) { $currTime = date("H:i:s"); }
$currDate = $currYear . "-" . sprintf("%02d", $currMonth) . "-" . $currDay;
$score_update = $db-> query("INSERT INTO bb".$n."_arcade (game,date,time,userid,username,score)
VALUES ('$game','$currDate','$currTime','$userid','$username','$thescore')");
$newscoreid = mysql_insert_id();
$newscorequery = $db-> query("SELECT scoreid,score FROM bb".$n."_arcade WHERE game='$game' ORDER BY score DESC");
$position = 0;
$foundscore = 0;
while (($newscoreloop=$db->fetch_array($newscorequery)) && ($foundscore == 0)) {
$thisid = $newscoreloop['scoreid'];
$position++;
if ($newscoreid==$thisid) {
$foundscore = 1;
}
}
// we have a new champion!
if ($position == 1) {
if ($userid == 0)
eval("\$tpl->output(\"".$tpl->get("vbproarcade_arcade_nicht_berechtigt")."\
");");
else
$champupdate = $db-> query("UPDATE bb".$n."_arcadegames SET championid='$userid' WHERE name='$gameinfo[name]'");
}
// set up vars for leader_bit template
$lb_userid = $userid;
$lb_username = $username;
$lb_score = number_format($thescore);
$lb_position = number_format($position);
// make date/time look good
$lb_date = date("d.m Y", strtotime($currDate));
$lb_time = date("H:i ", strtotime($currTime));
$suffix = suffixlogic($position,1);
$position = number_format($position);
eval ("\$lb_comment = \"".$tpl->get("vbproarcade_gameover_comment")."\";");
eval ("\$scorebit .= \"".$tpl->get("vbproarcade_scorebit")."\";");
eval ("\$tpl->output(\"".$tpl->get("vbproarcade_gameover")."\");");
} else {
// score of zero; just go to the scoreboard
$subaction = "";
$action = "scoreboard";
}
}
// display the scoreboard
if ($action == "scoreboard") {
// here we are adding a comment
if ($subaction=="addcomment") {
// comment is left blank
if ($comment == "") {
$comment = "No comment";
}
$comment = addslashes($comment);
if ($userid == 0)
eval("\$tpl->output(\"".$tpl->get("vbproarcade_arcade_nicht_berechtigt")."\
");");
else
$comment_insert = $db-> query("UPDATE bb".$n."_arcade SET comment='$comment' WHERE scoreid='$newscoreid' AND userid='$wbbuserdata[userid]'");
}
// find out how many scores we have in the database for this game
$scorecount_q = $db->query_first("SELECT COUNT(*) AS scorecount FROM bb".$n."_arcade WHERE game='$game' AND score > 0");
// figure out the correct # of pages
$numpages = $scorecount_q[scorecount] / $perpage;
$numpages = ceil($numpages);
// if no argument is passed in, or pagenum is out of range, go to page 1
if (!isset($pagenumber) or ($pagenumber < 1) or ($pagenumber > $numpages))
$pagenumber = 1;
// get the page navigation going
// start at the correct position
$position = ($pagenumber-1) * $perpage;
$scoreboard_q = $db-> query("SELECT * FROM bb".$n."_arcade WHERE game='$game' ORDER BY score DESC LIMIT $position, $perpage");
while ($sb_loop=$db->fetch_array($scoreboard_q)) {
// rotate background colors for scoreboard
if (($counter++ % 2) != 0)
$backcolor="{firstaltcolor}";
else
$backcolor = "{secondaltcolor}";
// set up vars for templates to grab
$lb_userid = $sb_loop[userid];
$lb_username = $sb_loop[username];
$lb_score = number_format($sb_loop[score]);
$lb_comment = $sb_loop[comment];
// make date/time look good
$pre_date = $sb_loop[date];
$pre_time = $sb_loop[time];
$lb_date = date("d.m Y", strtotime($pre_date));
$lb_time = date("H:i ", strtotime($pre_time));
// increase position by one
$position++;
// display king icon instead of "1" if king icon is turned on
if (($arcadeinfo[usekingicon] == 1) and ($position == 1))
$lb_position = "<img src=\"$arcadeinfo[kingiconname]\"><br>";
else
$lb_position = number_format($position);
eval ("\$scorebit .= \"".$tpl->get("vbproarcade_scorebit")."\";");
}
//***********Gäste können die Seite nicht durch ein direkt link aufrufen********
if ($userid == 0)
eval("\$tpl->output(\"".$tpl->get("vbproarcade_arcade_nicht_berechtigt")."\
");");
else
eval("\$tpl->output(\"".$tpl->get("vbproarcade_scoreboard")."\");");
}
//*************************************************************************
******
// display the top score board
if ($action == "topscoreboard") {
// get the count
$scorecount_q = $db-> query("SELECT DISTINCT username FROM bb".$n."_arcade WHERE game='$game'");
$scorecount = mysql_num_rows($scorecount_q);
// get the average
$average_q = $db-> query("SELECT game,username,max(score) as maxscore
FROM bb".$n."_arcade
WHERE game='$game'
GROUP BY username");
while ($avgloop = $db->fetch_array($average_q))
$average += $avgloop['maxscore'];
if ($scorecount > 0)
$average = number_format(floor($average/$scorecount));
else
$average = 0;
// figure out the correct # of pages
$numpages = $scorecount / $perpage;
$numpages = ceil($numpages);
// if no argument is passed in, or pagenum is out of range, go to page 1
if (!isset($pagenumber) or ($pagenumber < 1) or ($pagenumber > $numpages))
$pagenumber = 1;
// get the page navigation going
// start at the correct position
$position = ($pagenumber-1) * $perpage;
// get the data
$topscoreboard_q = $db-> query("SELECT game,userid,username,date,time,comment,max(score) as maxscore
FROM bb".$n."_arcade
WHERE game='$game'
GROUP BY username
ORDER BY maxscore DESC
LIMIT $position, $perpage");
while ($tsb_loop=$db->fetch_array($topscoreboard_q)) {
// rotate background colors for scoreboard
if (($counter++ % 2) != 0)
$backcolor="{firstaltcolor}";
else
$backcolor = "{secondaltcolor}";
// set up vars for templates to grab
$lb_userid = $tsb_loop[userid];
$lb_username = $tsb_loop[username];
$lb_score = number_format($tsb_loop[maxscore]);
$lb_comment = $tsb_loop[comment];
// make date/time look good
$pre_date = $tsb_loop[date];
$pre_time = $tsb_loop[time];
$lb_date = date("d.m Y", strtotime($pre_date));
$lb_time = date("H:i ", strtotime($pre_time));
// increase position by one
$position++;
// display king icon instead of "1" if king icon is turned on
if (($arcadeinfo[usekingicon] == 1) and ($position == 1))
$lb_position = "<img src=\"$arcadeinfo[kingiconname]\"><br>";
else
$lb_position = $position;
eval ("\$scorebit .= \"".$tpl->get("vbproarcade_scorebit")."\";");
}
//***********Gäste können die Seite nicht durch ein direkt link aufrufen********
if ($userid == 0)
eval("\$tpl->output(\"".$tpl->get("vbproarcade_arcade_nicht_berechtigt")."\
");");
else
eval("\$tpl->output(\"".$tpl->get("vbproarcade_topscoreboard")."\");");
}
//*************************************************************************
*******
// the main arcade page
if ($action == "arcade") {
// get games info
$allgames_q = $db-> query("SELECT * FROM bb".$n."_arcadegames ORDER BY title ASC");
// do one game at a time
while ($allgames = mysql_fetch_array($allgames_q)) {
$gameid = $allgames[gameid];
$gamename = $allgames[name];
$gametitle = $allgames[title];
$gametext = $allgames[description];
$gameicon = $allgames[thumbnailname];
$einaus = $allgames[active];
$thumbgame = "<img src=\"$gameicon\" border=\"0\">";
$count = $allgames[counter];
// get user's highest score for this game
$highscore_q = $db-> query_first("SELECT score,username,userid FROM bb".$n."_arcade WHERE game='$gamename' ORDER BY score DESC LIMIT 1");
$highscore_user_info = $db-> query_first("SELECT userid FROM bb".$n."_users WHERE username='".$highscore_q[username]."' ");
$highscore = "$highscore_q[score]";
if ($highscore > 0)
$highscoreuser = "<a href=\"profile.php?userid=$highscore_user_info[userid]&sid=$session[hash]\"
target=\"_blank\">$highscore_q[username]</a>";
else
$highscoreuser = "Noch kein Spiel !";
// get the viewing user's highest score
if ($wbbuserdata[userid] != 0) {
//************** Eigene Punkte vom Spiel Anzeigen ********************
$userscore_q = $db-> query_first("SELECT max(score) as maxscore FROM bb".$n."_arcade WHERE game='$gamename' AND userid='$userid' ");
$deinuserscore = $userscore_q[maxscore];
//************* Eigene Punkte vom Spiel Anzeigen ende *********************
// user has played the game and has a valid score
$totalusers_q = $db-> query("SELECT DISTINCT username, max(score) as maxscore FROM bb".$n."_arcade WHERE game='$gamename' GROUP BY username ORDER BY maxscore DESC");
$totalusers = mysql_num_rows($totalusers_q);
$userposition = 1;
$foundpos = 0;
while (($positionloop = $db->fetch_array($totalusers_q)) and ($foundpos == 0))
if ($positionloop[maxscore] > $userscore)
$userposition++;
else
$foundpos++;
// get the right suffix
$userposition = suffixlogic($userposition);
// make the number pretty
$userscore = number_format($userscore);
if (($userposition == "1st") and ($arcadeinfo[usekingicon] == 1))
// eval("\$thisuserscore = \"".gettemplate("vbproarcade_arcade_userscore_king")."\";");
eval ("\$thisuserscore = \"".$tpl->get("vbproarcade_arcade_userscore_king")."\";");
else
// eval("\$thisuserscore = \"".gettemplate("vbproarcade_arcade_userscore_notking")."\";");
eval ("\$thisuserscore = \"".$tpl->get("vbproarcade_arcade_userscore_notking")."\";");
}
else $thisuserscore = "Sie müssen angemeldet sein um zu spielen.";
//********Gäste bekommen keinen Link zum Spiel Angezeigt stattdessen den Text Du musst Registriert sein!*********
if ($userid == 0)
$gamelink = "<span class='normalfont'>Du musst Registriert sein !</span>";
else
//*************************************** ein aus geschalten Anfang ******************
If ($einaus == 1)
$gamelink = "<b><font color=#FF0000>Das Game ist Ausgeschaltet !!!</font></b>";
else
//*************************************** ein aus geschalten Ende *********************
$gamelink = "<a title='$gametext' href=\"proarcade.php?game=$allgames[name]&action=play\">$allgames[title]</a
>";
//*************************************************************************
*********
//********Scorelisten nicht für Gäste Sichtbar**************************************
if ($userid == 0)
$scoredat = "<span class='normalfont'>Du musst Registriert sein !</span>";
else
$scoredat = "<a href=proarcade.php?game=$gamename&action=scoreboard><img src=images/arcade_images/icon-scoreboard.gif border=0 alt=Scoreboard $gametitle></a>
<a href=proarcade.php?game=$gamename&action=topscoreboard><img src=images/arcade_images/icon-scoreboard.gif border=0 alt=Topscoreboard $gametitle></a>";
//*************************************************************************
**********
eval ("\$arcadebits .= \"".$tpl->get("vbproarcade_arcadebit")."\";");
}
//***********************************Admin Text************************************************
$result = $db->query_first("SELECT admintext FROM bb".$n."_arcadeconfig" );
$admintext = $result[0];
if ($admintext == "")
eval ("\$admintext1 .= \"".$tpl->get("vbproarcade_admintextno")."\";");
else
eval ("\$admintext1 .= \"".$tpl->get("vbproarcade_admintext")."\";");
//*********************************Admin Text ende***********************************************
// do total output
eval("\$tpl->output(\"".$tpl->get("vbproarcade_arcade")."\");");
}
?>
Zitat: |
Ich hoffe es kann einer Helfen |