<?php
include("core.php");
include("config.php");
header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
$addy = "wapirate.net";
$bcon = connectdb();
if (!$bcon)
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/red_medium.css\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Doh!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"images/error.gif\" alt=\"*\"/><br/>";
echo "ERROR! cannot connect to database<br/><br/>";
echo "This error usually happens when backing up the database, please be patient, The site will be up as soon as possible<br/><br/>";
echo "<b>THANK YOU VERY MUCH</b>";
echo "</p>";
echo "<div>$addy</div>";
echo "</body>";
echo "</html>";
exit();
}
$brws = explode(" ",$HTTP_USER_AGENT);
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$wnick = getnick_uid($who);
$uid = getuid_sid($sid);
$theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
cleardata();
if(isipbanned($uip,$ubr))
{
if(!isshield(getuid_sid($sid)))
{
echo "<head>";
echo "<title>Ip Block!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/red_medium.css\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Doh!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
echo "This IP address is blocked<br/>";
echo "<br/>";
echo "However we grant a shield against IP-Ban for our best users, you can try to see if you are shielded by trying to login, if you keep coming to this page that means you are not shielded, so come back when the ip-ban period is over<br/><br/>";
$banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
//echo mysql_error();
$remain = $banto[0] - time();
$rmsg = gettimemsg($remain);
echo " IP: $rmsg<br/><br/>";
echo "</p>";
// echo "<p>";
echo "<form action=\"login.php\" method=\"get\">";
echo "username:<br/> <input name=\"loguid\" format=\"*x\" size=\"8\" maxlength=\"30\"/><br/>";
echo "password:<br/> <input type=\"password\" name=\"logpwd\" size=\"8\" maxlength=\"30\"/><br/>";
echo "<input type=\"submit\" value=\"login »\"/>";
echo "</form>";
echo "<div>$addy</div>";
// echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
}
if(($action != "") && ($action!="terms"))
{
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/red_medium.css\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Doh!<br/></div>";
echo "<p align=\"center\">";
echo "You are not logged in<br/>";
echo "Or Your session has been expired<br/><br/>";
echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo "<div>$addy</div>";
echo "</body>";
echo "</html>";
exit();
}
}
//echo isbanned($uid);
if(isbanned($uid))
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/red_medium.css\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Doh!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
echo "You are <b>Banned</b><br/>";
$banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'"));
$banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
$remain = $banto[0]- time();
$rmsg = gettimemsg($remain);
echo "Time to finish your penalty: $rmsg<br/><br/>";
echo "Ban Reason: $banres[0]";
//echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo "<div>$addy</div>";
echo "</body>";
echo "</html>";
exit();
}
$res = mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");
////////////////////////////////////////MAIN PAGE
if($action=="bank")
{
addvisitor();
addonline(getuid_sid($sid),"Bank","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Wapirate Bank!<br/></div>";
echo "<p align=\"center\">";
$asset = "plusses";
$plussid = mysql_fetch_array(mysql_query("SELECT plusses, name, gold, gplus, battlep FROM ibwf_users WHERE id='".$uid."'"));
echo "<b>Welcome $plussid[1] To Wapirate Bank</b><br/>";
echo "<img src=\"/images/bank.jpg\" alt=\"*\"/><br/>";
echo "<br/>";
echo "Your Current gold is: <b>$plussid[2]</b><br/>";
echo "</p>";
echo "<p align=\"left\">";
echo "Exchange Rate is currently set at:<br/>";
echo "1 Gold to every 1 plus<br/>";
echo "1 Gold to every 10 Game Plusses<br/>";
echo "2 Gold to every 1 battle Point<br/>";
echo "<br/>";
$who = $plussid[1];
echo "<a href=\"bank.php?action=plus&sid=$sid&who=$plussid[1]&whoid=$uid\">Exchange Plusses</a><br/>";
echo "<a href=\"bank.php?action=game&sid=$sid&who=$plussid[1]&whoid=$uid\">Exchange Game Plusses</a><br/>";
echo "<a href=\"bank.php?action=battle&sid=$sid&who=$plussid[1]&whoid=$uid\">Exchange Battle Points</a><br/>";
echo "</p>";
echo "<p align=\"center\">";
echo "<br/><a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "<div>$addy</div>";
echo "</body>";
exit();
}
//////////////////////////////////////////////plus
else if($action=="plus")
{
addvisitor();
addonline(getuid_sid($sid),"Exchanging Plusses","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Exchange Plusses<br/></div>";
echo "<p align=\"center\">";
$who=$_GET["who"];
$plussid = mysql_fetch_array(mysql_query("SELECT plusses, name, gold, gplus, battlep FROM ibwf_users WHERE id='".$uid."'"));
Echo "<b>Wapirate Bank</b><br/>";
echo "<img src=\"/smilies/treasure.gif\" alt=\"*\"/><br/>";
echo "<b>Exchange Plusses</b><br/><br/>";
if(getplusses(getuid_sid($sid))<0){
echo "You Currently dont have any plusses to exchange, post in the forums to earn plusses or ask a member of staff other ways to earn plusses<br/>";
}else{
echo "Your Have $plussid[0] Pluses to Exchange!<br/><br/>";
echo "</p><form action=\"bank.php?action=plus2&sid=$sid&who=$who&uid=$uid\" method=\"post\">";
echo "Pluses to exchange: <input name=\"plus\" maxlength=\"4\"/><br/>";
echo "<input type=\"submit\" value=\"[EXCHANGE]\"/>";
echo "</form><p align=\"center\">";
}
echo "<br/><a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "<div>$addy</div>";
echo "</body>";
exit();
}
else if($action=="plus2")
{
addonline(getuid_sid($sid),"Exchanging Plusses","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "<div><br/>Exchange Plusses<br/></div>";
$plus = $_POST["plus"];
$plussid = mysql_fetch_array(mysql_query("SELECT plusses, name, gold, gplus, battlep FROM ibwf_users WHERE id='".$uid."'"));
$who = $plussid[1];
if(getplusses(getuid_sid($sid))<$plus){
echo "You Currently dont have $plus plusses<br/>";
}else{
$rplus = $plussid[0] - $plus;
mysql_query("UPDATE ibwf_users SET plusses='".$rplus."' WHERE id='".$uid."'");
$rgold = $plussid[2] + $plus;
mysql_query("UPDATE ibwf_users SET gold='".$rgold."' WHERE id='".$uid."'");
echo "Thankyou. You now have $rgold Gold! <br/>";
echo "and $rplus plusses remaining! <br/>";
echo "<br/>";
}
echo "</p><p align=\"center\">";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a>";
echo "</p>";
echo "<div>$addy</div>";
echo "</body>";
exit();
}
/////////////////////////////////////////Game plus
else if($action=="game")
{
addvisitor();
addonline(getuid_sid($sid),"Exchanging GP","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Exchange Game Plusses<br/></div>";
echo "<p align=\"center\">";
$who=$_GET["who"];
$plussid = mysql_fetch_array(mysql_query("SELECT plusses, name, gold, gplus, battlep FROM ibwf_users WHERE id='".$uid."'"));
Echo "<b>Wapirate Bank</b><br/>";
echo "<img src=\"/smilies/treasure.gif\" alt=\"*\"/><br/>";
echo "<b>Exchange Game Plusses</b><br/><br/>";
if($plussid[3]<0){
echo "You Currently dont have any Game plusses to exchange, Play games to earn Game plusses or ask a friend to lend you some<br/>";
}else{
echo "Your Have $plussid[3] Game Pluses to Exchange!<br/><br/>";
echo "</p><form action=\"bank.php?action=game2&sid=$sid&who=$who&uid=$uid\" method=\"post\">";
echo "Game Pluses to exchange: <input name=\"game\" maxlength=\"4\"/><br/>";
echo "<input type=\"submit\" value=\"[EXCHANGE]\"/>";
echo "</form><p align=\"center\">";
}
echo "<br/><a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "<div>$addy</div>";
echo "</body>";
exit();
}
else if($action=="game2")
{
addonline(getuid_sid($sid),"Exchanging GP","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Exchange Game Plusses<br/></div>";
echo "<p align=\"center\">";
$game = $_POST["game"];
$plussid = mysql_fetch_array(mysql_query("SELECT plusses, name, gold, gplus, battlep FROM ibwf_users WHERE id='".$uid."'"));
$who = $plussid[1];
if($plussid[3]<$game){
echo "You Currently dont have $game Game Plusses<br/>";
}else{
$rplus = $plussid[3] - $game;
mysql_query("UPDATE ibwf_users SET gplus='".$rplus."' WHERE id='".$uid."'");
$new = $game / 10;
$rgold = $plussid[2] + round($new);
mysql_query("UPDATE ibwf_users SET gold='".$rgold."' WHERE id='".$uid."'");
echo "Thankyou. You now have $rgold Gold! <br/>";
echo "and $rplus Game Plusses remaining! <br/>";
echo "<br/>";
}
echo "</p><p align=\"center\">";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a>";
echo "</p>";
echo "<div>$addy</div>";
echo "</body>";
exit();
}
/////////////////////////////////////////Battle points
else if($action=="battle")
{
addvisitor();
addonline(getuid_sid($sid),"Exchanging BP","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Exchange Battle Points<br/></div>";
echo "<p align=\"center\">";
$who=$_GET["who"];
$plussid = mysql_fetch_array(mysql_query("SELECT plusses, name, gold, gplus, battlep FROM ibwf_users WHERE id='".$uid."'"));
Echo "<b>Wapirate Bank</b><br/>";
echo "<img src=\"/smilies/treasure.gif\" alt=\"*\"/><br/>";
echo "<b>Exchange Game Plusses</b><br/><br/>";
if($plussid[4]<0){
echo "You Currently dont have any Battle points to exchange, Earn battle points in the forums!<br/>";
}else{
echo "Your Have $plussid[4] Battle Points to Exchange!<br/><br/>";
echo "</p><form action=\"bank.php?action=battle2&sid=$sid&who=$who&uid=$uid\" method=\"post\">";
echo "Battle Points to exchange: <input name=\"battle\" maxlength=\"4\"/><br/>";
echo "<input type=\"submit\" value=\"[EXCHANGE]\"/>";
echo "</form><p align=\"center\">";
}
echo "<br/><a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "<div>$addy</div>";
echo "</body>";
exit();
}
else if($action=="battle2")
{
addonline(getuid_sid($sid),"Exchanging BP","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Exchange Battle Points<br/></div>";
echo "<p align=\"center\">";
$battle = $_POST["battle"];
$plussid = mysql_fetch_array(mysql_query("SELECT plusses, name, gold, gplus, battlep FROM ibwf_users WHERE id='".$uid."'"));
$who = $plussid[1];
if($plussid[4]<$battle){
echo "You Currently dont have $battle Battle Points<br/>";
}else{
$rplus = $plussid[4] - $battle;
mysql_query("UPDATE ibwf_users SET battlep='".$rplus."' WHERE id='".$uid."'");
$new = $battle * 2;
$rgold = $plussid[2] + round($new);
mysql_query("UPDATE ibwf_users SET gold='".$rgold."' WHERE id='".$uid."'");
echo "Thankyou. You now have $rgold Gold! <br/>";
echo "and $rplus Battle Points remaining! <br/>";
echo "<br/>";
}
echo "</p><p align=\"center\">";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a>";
echo "</p>";
echo "<div>$addy</div>";
echo "</body>";
exit();
}
else{
addonline(getuid_sid($sid),"Trying To Rob The Bank","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Doh!<br/></div>";
echo "<p align=\"center\">";
echo "I don't know how did you get into here, but there's nothing to show<br/><br/>";
echo "<a href=\"/xhtml/index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "<div>$addy</div>";
echo "</body>";
exit();
}
echo "</html>";
?>