<?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\">";
connectdb();
$wapirate = "Wapirate Fantasy";
$addy = "wapirate.net";
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$site="wapirate.net";
$time = date('dmHis');
$uid = getuid_sid($sid);
$theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
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 "You are not logged in<br/>";
echo "Or<br/>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();
}
//////////////////////////
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 "</p>";
echo "<div>$addy</div>";
echo "</body>";
echo "</html>";
exit();
}
////////////////////////////////////////
if($action=="pend")
{
//addonline(getuid_sid($sid),"$wapirate","");
if(pending($uid))
{
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!<br/></div>";
echo "<p align=\"center\">";
$info = mysql_fetch_array(mysql_query("SELECT uid, who FROM ibwf_rpgame WHERE uid='".$uid."'"));
$tnick = getnick_uid($info[1]);
echo "<img src=\"images/ok.gif\" alt=\"o\"/> You have a pending game with $tnick<br/>";
echo "<a href=\"fantasy.php?action=cancel&sid=$sid&who=$info[1]\">Cancel this Game</a><br/>----<br/>";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>---<br/>";
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>";
echo "</html>";
exit();
}
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"images/notok.gif\" alt=\"x\"/> You Don't Have a Pending Game!<br/>";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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 if($action=="cancel")
{
//addonline(getuid_sid($sid),"$wapirate","");
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!<br/></div>";
echo "<p align=\"center\">";
$info = mysql_fetch_array(mysql_query("SELECT uid, who FROM ibwf_rpgame WHERE uid='".$uid."'"));
$tnick = getnick_uid($info[1]);
$tries2 = mysql_fetch_array(mysql_query("SELECT health FROM ibwf_users WHERE id='".$uid."'"));
$mama3= $tries2[0];
if($mama3>49)
{
echo "Cancelling this game means that you loose!<br/>";
echo "<a href=\"fantasy.php?action=cannow&sid=$sid\">continue</a><br/>";
}else{
echo "<img src=\"images/ok.gif\" alt=\"o\"/> You have Succesfully Cancelled the Game!<br/>";
$msg = "".getnick_uid(getuid_sid($sid))." cancelled the game!"."";
autopm($msg, $info[1]);
mysql_query("UPDATE ibwf_users SET hit='1' WHERE id='".$info[1]."'");
mysql_query("DELETE FROM ibwf_rpg WHERE byuid='".$uid."'");
mysql_query("DELETE FROM ibwf_rpgame WHERE uid='".$uid."'");
mysql_query("DELETE FROM ibwf_rpgame WHERE uid='".$info[1]."'");
mysql_query("UPDATE ibwf_users SET hit='1' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET lastdamage='0' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET givedamage='0' WHERE id='".$uid."'");
}
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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 if($action=="cannow")
{
//addonline(getuid_sid($sid),"$wapirate","");
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!<br/></div>";
echo "<p align=\"center\">";
$info = mysql_fetch_array(mysql_query("SELECT uid, who, bet FROM ibwf_rpgame WHERE uid='".$uid."'"));
$tnick = getnick_uid($info[1]);
echo "<img src=\"images/ok.gif\" alt=\"o\"/> You have Succesfully Cancelled the Game!<br/>";
$msg = "".getnick_uid(getuid_sid($sid))." cancelled the game!"."";
autopm($msg, $info[1]);
mysql_query("UPDATE ibwf_users SET plusses=plusses-'$info[2]' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET plusses=plusses+'$info[2]' WHERE id='".$info[1]."'");
mysql_query("UPDATE ibwf_users SET loss=loss+'1' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET wins=wins+'1' WHERE id='".$info[1]."'");
mysql_query("UPDATE ibwf_users SET hit='1' WHERE id='".$info[1]."'");
mysql_query("DELETE FROM ibwf_rpg WHERE byuid='".$uid."'");
mysql_query("DELETE FROM ibwf_rpgame WHERE uid='".$uid."'");
mysql_query("DELETE FROM ibwf_rpgame WHERE uid='".$info[1]."'");
mysql_query("UPDATE ibwf_users SET hit='1' WHERE id='".$uid."'");
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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 if($action=="main")
{
//addonline(getuid_sid($sid),"$wapirate","");
if(notactive($uid))
{
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!<br/></div>";
echo "<p align=\"center\">";
echo "Your Wapirate Fantasy Game Is Not Activated.<br/>---<br/>";
echo "<a href=\"fantasy.php?action=activate&sid=$sid\">Activate</a><br/>---<br/>";
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>";
echo "</html>";
exit();
}
////////////////
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/>";
$tnick = getnick_uid($uid);
echo "<a href=\"fantasy.php?sid=$sid\">Battle Arena</a><br/>";
echo "<a href=\"fantasy.php?action=clinic&sid=$sid\">Hospital</a><br/>";
if(pending($uid))
{
echo "<a href=\"fantasy.php?action=pend&sid=$sid\">Pending Game</a><br/>";
}
echo "<a href=\"fantasy.php?action=shop&sid=$sid\">Weapons Shop</a><br/>";
echo "<a href=\"fantasy.php?action=fantmsg&sid=$sid\">Your Fantasy Mood</a><br/>";
echo "<a href=\"fantasy.php?action=player&sid=$sid\">$wapirate Top Players</a><br/>";
echo "<a href=\"index.php?action=rpg&sid=$sid&who=$uid\">Your $wapirate Stats</a><br/>";
echo "<a href=\"fantasy.php?action=weapons&sid=$sid\">Your Weapons</a><br/>";
echo "<a href=\"fantasy.php?action=status&sid=$sid\">Fantasy Status</a><br/>";
echo "<a href=\"fantasy.php?action=character&sid=$sid\">Characters</a><br/>----<br/>";
echo "<a href=\"fantasy.php?action=help&sid=$sid\">HELP!</a><br/>----<br/>";
if(!notactive($uid))
{
echo "<a href=\"fantasy.php?action=deactivate&sid=$sid\">De-Activate Game!</a><br/>----<br/>";
}
//////////////death
$dea = mysql_fetch_array(mysql_query("SELECT id FROM fantasy_magic WHERE uid='".$uid."' && name='Death'"));
if($dea[0]>0){
$death = rand(1,2);
if($death=="1"){
echo "</p>";
echo "<p>";
echo "<img src=\"/images/deathhomer.gif\" alt=\"*\"/><br/>";
echo "I Am Death. Buy My Help for 1500 Gold!<br/>";
echo "</p>";
echo "<form action=\"fantasy.php?action=buydeath&sid=$sid\" method=\"post\">";
echo "<input type=\"hidden\" name=\"code\" value=\"4289\"/>";
echo "<input type=\"submit\" value=\"BUY DEATH!\"/>";
echo "</form>";
echo "<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 if($action=="activate")
{
//addonline(getuid_sid($sid),"$wapirate","");
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/>";
if(notactive($uid))
{
$res = mysql_query("UPDATE ibwf_users SET activate='2' WHERE id='".$uid."'");
if($res)
{
echo "<img src=\"images/ok.gif\" alt=\"O\"/>Activated successfully you can now start playing!<br/><br/>";
}else{
echo "<img src=\"images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
}
}else{
echo "<img src=\"images/notok.gif\" alt=\"O\"/>Your Already Have An Activated Game!";
}
echo "<br/>---<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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 if($action=="deactivate")
{
//addonline(getuid_sid($sid),"$wapirate","");
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/>";
$res = mysql_query("UPDATE ibwf_users SET activate='0' WHERE id='".$uid."'");
if($res)
{
echo "<img src=\"images/ok.gif\" alt=\"O\"/>Game De-activated Successfully<br/><br/>";
}else{
echo "<img src=\"images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
}
echo "<br/>---<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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 if($action=="clinic")
{
//addonline(getuid_sid($sid),"$wapirate","");
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 Hospital!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/doctor.gif\" alt=\"*\"/><br/>";
$tnick = getnick_uid($uid);
$info = mysql_fetch_array(mysql_query("SELECT gplus, health FROM ibwf_users WHERE id='".$uid."'"));
$healthko = 100 - $info[1];
$kano = $healthko * 2;
if($healthko<1){
echo "No Health Required! Your As Fit As A Fiddle!";
}else{
echo "Here You can Buy Health Which Costs 2GP(game plusses) Per HEALTH<br/>";
echo "You Need $healthko Of Health Which Costs $kano GP<br/>";
echo "Bugdet: $info[0]GP<br/>";
if($info[0]>$healthko){
echo "<a href=\"fantasy.php?action=clinic2&sid=$sid\">Buy</a>";
}else{
echo "More GP Required!";
}
}
echo "<br/>-----<br/>";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">$wapirate</a><br/>----<br/>";
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 if($action=="clinic2")
{
//addonline(getuid_sid($sid),"$wapirate","");
if(notactive($uid))
{
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/>";
echo "$wapirate account is not activated.<br/>";
echo "----<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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>";
echo "</html>";
exit();
}
if(pending($uid))
{
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/>";
echo "You have a pending game!<br/>";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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>";
echo "</html>";
exit();
}
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/doctor.gif\" alt=\"*\"/><br/>";
$info = mysql_fetch_array(mysql_query("SELECT gplus, health FROM ibwf_users WHERE id='".$uid."'"));
$healthko = 100 - $info[1];
$kano = $healthko * 2;
$gpst = mysql_fetch_array(mysql_query("SELECT gplus FROM ibwf_users WHERE id='".$uid."'"));
if($gpst[0]>=$kano)
{
mysql_query("UPDATE ibwf_users SET gplus=gplus-'$kano' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET health=health+'$healthko' WHERE id='".$uid."'");
echo "Congratulations you can Now Play $wapirate again :)<br/>";
}else{
echo "Insufficient Game Plusses<br/>";
}
echo "<a href=\"fantasy.php?action=main&sid=$sid\">$wapirate</a><br/>----<br/>";
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 if($action=="chal")
{
$who = $_GET["who"];
$unick = getnick_uid($who);
//addonline(getuid_sid($sid),"$wapirate","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Bet $unick!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/>";
echo "</p>";
echo "<form action=\"fantasy.php?action=chalnow&sid=$sid\" method=\"post\">";
echo "Gold:<br/><input name=\"share\" maxlength=\"4\" format=\"*N\"/><br/>";
echo "<input type=\"hidden\" name=\"who\" value=\"$who\"/>";
echo "<input type=\"submit\" value=\"Submit\"/>";
echo "</form>";
echo "<p align=\"center\">";
echo "<br/>----<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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 if($action=="chalnow")
{
$who = $_POST["who"];
$share = $_POST["share"];
$tnick = getnick_uid($who);
//addonline(getuid_sid($sid),"$wapirate","");
if(notactive($who))
{
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
echo "<img src=\"images/notok.gif\" alt=\"x\"/> $tnick's $wapirate Game Is Not Activated.<br/>";
echo "------<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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>";
echo "</html>";
exit();
}
if(notactive($uid))
{
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
echo "<img src=\"images/notok.gif\" alt=\"x\"/> Your $wapirate Game Is Not Activated.<br/>";
echo "----<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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>";
echo "</html>";
exit();
}
if(pending($who))
{
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
echo "<img src=\"images/notok.gif\" alt=\"x\"/> $tnick Has A Pending Game!<br/>";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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>";
echo "</html>";
exit();
}
if(pending($uid))
{
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
echo "<img src=\"images/notok.gif\" alt=\"x\"/> You have a pending game!<br/>";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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>";
echo "</html>";
exit();
}
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
if($uid==$who)
{
echo "<img src=\"images/notok.gif\" alt=\"x\"/> Are You Crazy and trying to Challenge YourSelf.?<br/>";
}else{
if($share<=0)
{
echo "<img src=\"images/notok.gif\" alt=\"x\"/> 0 BET is not allowed!<br/>";
}else{
$gpsf = mysql_fetch_array(mysql_query("SELECT gold FROM ibwf_users WHERE id='".$uid."'"));
$gpst = mysql_fetch_array(mysql_query("SELECT gold FROM ibwf_users WHERE id='".$who."'"));
$health = mysql_fetch_array(mysql_query("SELECT health FROM ibwf_users WHERE id='".$uid."'"));
$health2 = mysql_fetch_array(mysql_query("SELECT health FROM ibwf_users WHERE id='".$who."'"));
if($gpsf[0]>=$share)
{
if($gpst[0]>=$share)
{
if($health[0]>=100)
{
if($health2[0]>=100)
{
$res = mysql_query("INSERT INTO ibwf_rpg SET touid='".$who."', byuid='".$uid."', accept='1', bet='".$share."', actime='".time()."'");
if($res)
{
mysql_query("UPDATE ibwf_users SET hit='3' WHERE id='".$who."'");
mysql_query("INSERT INTO ibwf_rpgame SET uid='".$uid."', who='".$who."', bet='".$share."', owner='".$uid."'");
mysql_query("INSERT INTO ibwf_rpgame SET uid='".$who."', who='".$uid."', bet='".$share."', owner='".$uid."'");
echo "<img src=\"images/ok.gif\" alt=\"o\"/> A challenge for $wapirate has been sent!.<br/>Wait till $tnick accepts your Challenge<br/>";
}else{
echo "<img src=\"images/notok.gif\" alt=\"x\"/> Database Error Try Again Later Or Contact Admin If Problem Continues!!<br/>";
}
}else{
echo "<img src=\"images/notok.gif\" alt=\"x\"/> $tnick Has Insufficient Health!<br/>";
}
}else{
echo "<img src=\"images/notok.gif\" alt=\"x\"/> You Have Insufficient Health!<br/>";
}
}else{
echo "<img src=\"images/notok.gif\" alt=\"x\"/> $tnick Has Insufficient Gold!<br/>";
}
}else{
echo " <img src=\"images/notok.gif\" alt=\"x\"/> You Have Insufficient Gold!<br/>";
}
}
}
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>---<br/>";
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 if($action=="acc")
{
$who = $_GET["who"];
$unick = getnick_uid($who);
//addonline(getuid_sid($sid),"$wapirate","");
if(!ingame($uid))
{
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
echo "<img src=\"images/notok.gif\" alt=\"x\"/>Access Denied You are not in a Game!<br/>";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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>";
echo "</html>";
exit();
}
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
$info = mysql_fetch_array(mysql_query("SELECT uid, who FROM ibwf_rpgame WHERE uid='".$uid."'"));
$accept = $_GET["accept"];
$uid = getuid_sid($sid);
$ncl = mysql_fetch_array(mysql_query("SELECT id, bet, byuid, touid FROM ibwf_rpg WHERE touid='".$uid."' ORDER BY id DESC LIMIT 1"));
mysql_query("UPDATE ibwf_rpg SET accept='2' WHERE touid='".$uid."'");
echo "<img src=\"images/ok.gif\" alt=\"o\"/> You have accepted the Challenge<br/>";
echo "<a href=\"fantasy.php?action=sfight&sid=$sid\">";
echo "Go to Battle Field</a><br/>- - -<br/>";
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 if($action=="decline")
{
$who = $_GET["who"];
$unick = getnick_uid($who);
//addonline(getuid_sid($sid),"$wapirate","");
if(!ingame($uid))
{
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
echo "<img src=\"images/notok.gif\" alt=\"x\"/>Access Denied You Are Not In A Game!<br/>";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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>";
echo "</html>";
exit();
}
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Decline Challange!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
$info = mysql_fetch_array(mysql_query("SELECT uid, who FROM ibwf_rpgame WHERE uid='".$uid."'"));
$tnick = getnick_uid($info[1]);
mysql_query("DELETE FROM ibwf_rpg WHERE touid='".$uid."' AND byuid='".$info[1]."'");
mysql_query("DELETE FROM ibwf_rpg WHERE byuid='".$who."'");
mysql_query("DELETE FROM ibwf_rpgame WHERE uid='".$uid."'");
mysql_query("DELETE FROM ibwf_rpgame WHERE uid='".$who."'");
mysql_query("UPDATE ibwf_users SET hit='1' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET hit='1' WHERE id='".$who."'");
echo "You have successfully declined the challenge!<br/>";
$gpsf = mysql_fetch_array(mysql_query("SELECT byuid, touid FROM ibwf_users WHERE id='".$uid."'"));
$msg = "".getnick_uid(getuid_sid($sid))." declined to your rpg challenge!"."";
autopm($msg, $who);
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
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();
}
//////////////////////////////////Top Players
else if($action=="player")
{
//addonline(getuid_sid($sid),"$wapirate","");
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 Top Players!<br/></div>";
//////ALL LISTS SCRIPT <<
if($page=="" || $page<=0)$page=1;
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE activate='2' AND wins>='1'"));
$num_items = $noi[0]; //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
//changable sql
$sql = "SELECT id, name, wins, loss, activate, fantasymsg FROM ibwf_users WHERE wins>0 ORDER BY wins DESC LIMIT $limit_start, $items_per_page";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
if($item[5]!=""){
$text = parsepm($item[5],$sid);
$nos = substr_count($text,"<img src=");
$noext = substr_count($text,"<img src=\"h");
$noextb = substr_count($text,"<img src=\"H");
$noexts = substr_count($text,"<img src=\" h");
$noextbs = substr_count($text,"<img src=\" H");
if($nos>2){
$active = "<b><i>Im greedy when it comes to smileys!</i></b>";
}else if($noext>0||$noextb>0||$noexts>0||$noextbs>0){
$active = "<b><i>External Images Not Allowed!</i></b>";
}else{
$active = "$text";
}
}else if($item[4]=="2")
{
$active = "Is Ready For A Challange!";
}else{
$active = "Is To Scared To Play! lol";
}
if($item[3]==""){
$lse = "0";
}else{
$lse = "$item[3]";
}
if(isonline($item[0]))
{
$iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
}else{
$iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
}
$lnk = "<a href=\"index.php?action=rpg&who=$item[0]&sid=$sid\">$item[1]</a> $active<br/> Wins: $item[2] Losses: $lse<br/>---";
echo "$iml $lnk<br/>";
}
}
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"kindatrpg.php?action=player&page=$ppage&sid=$sid&view=$view\">«PREV</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"kindatrpg.php?action=player&page=$npage&sid=$sid&view=$view\">Next»</a>";
}
echo "<br/>$page/$num_pages<br/>";
echo "</p>";
if($num_pages>2)
{
$rets = "<form action=\"kindatrpg.php\" method=\"get\">";
$rets .= "Jump to page<input name=\"page\" format=\"*N\" size=\"3\"/>";
$rets .= "<input type=\"submit\" value=\"GO\"/>";
$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
$rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
$rets .= "</form>";
echo $rets;
}
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
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();
}
//////////////////////////////////////////////////////////Help
if($action=="help")
{
addvisitor();
//addonline(getuid_sid($sid),"Weapons Shop","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Fantasy Help!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/>";
echo "</p>";
echo "<p align=\"left\">";
echo "<img src=\"/images/point.gif\" alt=\"*\" align=\"middle\"/>You Can Not Enter The Battle Field Untill A Challange Has Been Accepted!<br/>";
echo "<img src=\"/images/point.gif\" alt=\"*\" align=\"middle\"/>You Must Have A Minumum Of 100 Health Points To Challange Another Player To A Battle!<br/>";
echo "<img src=\"/images/point.gif\" alt=\"*\" align=\"middle\"/>To Get Health You Must Pay A Visit To Fantasy Hospital!<br/>";
echo "<img src=\"/images/point.gif\" alt=\"*\" align=\"middle\"/>You May Also Buy Food In The Fantasy Shop To Boost Your Energy More!<br/>";
echo "<img src=\"/images/point.gif\" alt=\"*\" align=\"middle\"/>You Will Find Weapons In The Shop. Each Weapon You Buy Improves Your Max Power. You Will Only Be Able To Use Your Own Weapons When You Have Bought A Minimum Of 3 Weapons. The More You Play The More Weapons Will Be Opened Up To Help You!<br/>";
echo "<img src=\"/images/point.gif\" alt=\"*\" align=\"middle\"/>To Challange A Player Click On There Profile And Then Click On Fantasy Stats And Then You Will Be Able To Challange A player There!<br/>";
echo "<img src=\"/images/point.gif\" alt=\"*\" align=\"middle\"/>If At Any Point You Get Bored Of Friends Trying To Battle You.... You Can Simply Deactivate Your Game!<br/>";
echo "<img src=\"/images/point.gif\" alt=\"*\" align=\"middle\"/>You May Only Hold 10 Weapons At any 1 Time!<br/>";
echo "<img src=\"/images/point.gif\" alt=\"*\" align=\"middle\"/>To Discard A Weapon Click on Your Profile Stats And Delete Weapon Of your Choice!<br/>";
echo "<img src=\"/images/point.gif\" alt=\"*\" align=\"middle\"/>Any Attempt At Cheating May Result In Loss Of Weapons, Gold Or A Permanent Ban From $wapirate!<br/>";
echo "<img src=\"/images/point.gif\" alt=\"*\" align=\"middle\"/>Enjoy And Have Fun!<br/>";
echo "</p>";
echo "<p align=\"center\">";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\" align=\"middle\"/>Home</a>";
echo "</p>";
echo "<div>$addy</div>";
echo "</body>";
exit();
}
//////////////////////////////////////////////////////////shop
if($action=="shop")
{
addvisitor();
//addonline(getuid_sid($sid),"Weapons Shop","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Fantasy Shop!<br/></div>";
echo "<p align=\"center\">";
$plu = mysql_fetch_array(mysql_query("SELECT gold, wins FROM ibwf_users WHERE id='".$uid."'"));
//$weps = mysql_fetch_array(mysql_query("SELECT name, price, damage FROM ibwf_attacks WHERE wins<='".$plu[1]."'"));
echo "<b>Welcome To Wapirate Fantasy Shop</b><br/><br/>The More You Play The More Weapons Will Open Up To You!<br/>";
echo "<br/>";
echo "</p>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirate.gif\" alt=\"*\"/><br/>";
echo "The Weapons You Can Buy Are Listed Below:<br/></p>";
echo "<p align=\"left\">";
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_attacks WHERE uid'".$uid."'"));
if($noi<10){
$sql = "SELECT id, name, price, damage FROM ibwf_attacks WHERE wins<='".$plu[1]."' AND uid='3' ORDER BY id";
$items = mysql_query($sql);
while ($item = mysql_fetch_array($items))
{
echo "$item[1] Price: $item[2] Gold<br/>Max Damage: $item[3] <a href=\"fantasy.php?action=buy&ice=$item[0]&sid=$sid\">BUY </a><br/><br/>";
}
}else{
echo "Sorry But You Can Not Hold Any More Weapons!<br/>";
}
$info = mysql_fetch_array(mysql_query("SELECT gplus, health FROM ibwf_users WHERE id='".$uid."'"));
if($info[1]<200&&$info[1]>99){
echo "Food: 200 Gold<br/>Boosts Health <a href=\"fantasy.php?action=buy&sid=$sid\">BUY </a><br/><br/>";
}
echo "</p>";
echo "<p align=\"center\">";
$num = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_attacks WHERE uid='".$uid."'"));
if($num[0]>2&&$plu[0]>199){
echo "<a href=\"fantasy.php?action=upgrade&sid=$sid\">";
echo "Upgrades</a><br/>----<br/>";
}
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
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();
}
//////////////////////////////////////////////////////////shop buy
if($action=="buy")
{
addvisitor();
$ice = $_GET["ice"];
//addonline(getuid_sid($sid),"Weapons Shop","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Fantasy Shop!<br/></div>";
echo "<p align=\"center\">";
$plu = mysql_fetch_array(mysql_query("SELECT gold, wins, health FROM ibwf_users WHERE id='".$uid."'"));
$wep = mysql_fetch_array(mysql_query("SELECT name, price, wins, damage FROM ibwf_attacks WHERE id='".$ice."'"));
$check = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_attacks WHERE name='".$wep[0]."' AND uid='".$uid."'"));
echo "<img src=\"/smilies/pirate.gif\" alt=\"*\"/><br/><br/>";
if($ice==""){
if($plu[0]<200){
echo "<img src=\"/images/notok.gif\" alt=\"X\"/>You Do Not Have Enough Gold To Buy Food<br/>";
}else if($plu[2]<100){
echo "<img src=\"/images/notok.gif\" alt=\"X\"/>Oi Stop Cheating!<br/>";
}else{
$remain = $plu[0] - 200;
$res = mysql_query("UPDATE ibwf_users SET gold='".$remain."', health='200' WHERE id='".$uid."'");
if($res){
echo "<img src=\"/images/ok.gif\" alt=\"O\"/>Congratulations You Now Have 200 Health<br/>";
}else{
echo "<img src=\"/images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
}
}
}else{
if($plu[0]<$wep[1]){
echo "<img src=\"/images/notok.gif\" alt=\"X\"/>You Do Not Have Enough Gold To Buy $wep[0]<br/>";
}else if($plu[1]<$wep[2]){
echo "<img src=\"/images/notok.gif\" alt=\"X\"/>Oi Stop Cheating!<br/>";
}else if($check[0]>0){
echo "<img src=\"/images/notok.gif\" alt=\"X\"/>Sorry You Already Own a $wep[0]<br/>";
}else{
$res = mysql_query("INSERT INTO ibwf_attacks SET uid='".$uid."', name='".$wep[0]."', damage='".$wep[3]."', maxdamage='".$wep[3]."' ");
if($res){
echo "<img src=\"/images/ok.gif\" alt=\"O\"/>Congratulations You Now Own A $wep[0]<br/>";
$remain = $plu[0] - $wep[1];
mysql_query("UPDATE ibwf_users SET gold='".$remain."' WHERE id='".$uid."'");
}else{
echo "<img src=\"/images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
}
}
}
echo "<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
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();
}
//////////////////////////////////////////buy Death
else if($action=="buydeath")
{
addonline(getuid_sid($sid),"Updating Character","");
$code = $_POST["code"];
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Death<br/></div>";
echo "<p align=\"center\">";
//$uid = getuid_sid($sid);
$dea = mysql_fetch_array(mysql_query("SELECT id FROM fantasy_magic WHERE uid='".$uid."' && name='Death'"));
if($dea[0]>0){
echo "<img src=\"images/notok.gif\" alt=\"x\"/>You Already Have Bought Death!<br/>";
}else{
if($code!="4289"){
echo "<img src=\"images/notok.gif\" alt=\"x\"/>Stop Cheating!<br/>";
}else{
$plu = mysql_fetch_array(mysql_query("SELECT gold FROM ibwf_users WHERE id='".$uid."'"));
if($plu[0]<1500){
echo "<img src=\"images/notok.gif\" alt=\"x\"/>You Do Not Have Enough Gold!<br/>";
}else{
$res = mysql_query("INSERT INTO fantasy_magic SET uid='".$uid."', name='Death', Power='max', type='w'");
if($res)
{
echo "<img src=\"images/ok.gif\" alt=\"o\"/>Death Bought Successfully!<br/>";
$remain = $plu[0] - 1500;
mysql_query("UPDATE ibwf_users SET gold='".$remain."' WHERE id='".$uid."'");
}else{
echo "<img src=\"images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
}
}
}
}
echo "<br/>";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">$wapirate</a><br/>----<br/>";
echo "<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();
}
//////////////////////////////////////////////////////////upgrade
if($action=="upgrade")
{
addvisitor();
//addonline(getuid_sid($sid),"Weapons Upgrades","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Fantasy Shop!<br/></div>";
echo "<p align=\"center\">";
$plu = mysql_fetch_array(mysql_query("SELECT gold, wins FROM ibwf_users WHERE id='".$uid."'"));
//$weps = mysql_fetch_array(mysql_query("SELECT name, price, damage FROM ibwf_attacks WHERE wins<='".$plu[1]."'"));
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirate.gif\" alt=\"*\"/><br/>";
echo "Weapon Upgrades Increase The Max Power Of Your Weapons<br/></p>";
echo "<p align=\"left\">";
if($plu[0]>199){
$sql = "SELECT id, name, damage, upgrade FROM ibwf_attacks WHERE uid='".$uid."' ORDER BY id";
$items = mysql_query($sql);
while ($item = mysql_fetch_array($items))
{
$upgrade = rand(1,3);
if($upgrade=="1"){
$name = "Super";
}else if($upgrade=="2"){
$name = "Explosive";
}else if($upgrade=="3"){
$name = "Hyper";
}
$mp = $item[2] + 10;
if($item[3]<1){
$hmm = "$item[1] To $name-$item[1]<br/>Max Power: $mp Price: 200 Gold<br/> <a href=\"fantasy.php?action=upgraded&ice=$item[0]&sid=$sid&upname=$name\">Upgrade </a><br/><br/>";
}else{
$hmm = "";
}
echo "$hmm";
}
}else{
echo "<img src=\"images/notok.gif\" alt=\"x\"/> You Do Not Currently Have Enough Gold<br/>";
}
echo "<br/></p>";
echo "<p align=\"center\">";
$num = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_attacks WHERE uid='".$uid."'"));
if($num[0]>2){
echo "<a href=\"fantasy.php?action=upgrade&sid=$sid\">";
echo "Upgrades</a><br/>----<br/>";
}
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
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();
}
//////////////////////////////////////////////////////////upgade buy
if($action=="upgraded")
{
addvisitor();
$ice = $_GET["ice"];
$upname = $_GET["upname"];
//addonline(getuid_sid($sid),"Weapons Shop","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Fantasy Shop!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirate.gif\" alt=\"*\"/><br/><br/>";
$plu = mysql_fetch_array(mysql_query("SELECT gold, wins, health FROM ibwf_users WHERE id='".$uid."'"));
$wep = mysql_fetch_array(mysql_query("SELECT name, upgrade, damage FROM ibwf_attacks WHERE id='".$ice."'"));
if($plu[0]>199){
if($wep[0]<1){
$dam = $wep[2] + 10;
$newname = "$upname-$wep[0]";
$res = mysql_query("UPDATE ibwf_attacks SET name='".$newname."', upgrade='1', damage='".$dam."', maxdamage='".$dam."', WHERE id='".$ice."'");
if($res){
echo "<img src=\"/images/ok.gif\" alt=\"O\"/>Congratulations $wep[0] Upgraded!<br/>";
$remain = $plu[0] - 200;
mysql_query("UPDATE ibwf_users SET gold='".$remain."' WHERE id='".$uid."'");
}else{
echo "<img src=\"/images/notok.gif\" alt=\"X\"/>Data Base Error!<br/>";
}
}else{
echo "<img src=\"/images/notok.gif\" alt=\"X\"/>Sorry This Weapon Has Already Been Upgraded!<br/>";
}
}else{
echo "<img src=\"/images/notok.gif\" alt=\"X\"/>You Do Not Have enough Gold!<br/>";
}
echo "<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
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();
}
/////////////////////////////////////////////////weapons
else if($action=="weapons")
{
$who = $_GET["who"];
//addonline(getuid_sid($sid),"Fantasy Stats","index.php?action=rpg&who=$who");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
$tnick = getnick_uid($who);
echo "<div>";
echo "<br/>Weapons<br/>";
echo "</div>";
echo "<p align=\"center\">";
echo "<b>Weapons: </b><br/><br/>";
$sql = "SELECT id, name, price, damage, upgrade, upname, maxdamage FROM ibwf_attacks WHERE uid='".$uid."' ORDER BY id";
$items = mysql_query($sql);
while ($item = mysql_fetch_array($items))
{
$cos = $item[6] - $item[3];
$cost = $cos * 2;
$del = "<a href=\"fantasy.php?action=delwep&wep=$item[0]&sid=$sid\">[x]</a>";
if($item[3]!=$item[6]){
$repair = "<a href=\"fantasy.php?action=repair&wep=$item[0]&sid=$sid\">Repair ($cost Gold) </a> ";
}
echo "$item[5] $item[1] - Damage: $item[3]/$item[6] $repair $del<br/><br/>";
}
echo "<a href=\"fantasy.php?action=main&sid=$sid\">Wapirate Fantasy</a><br/>";
echo "<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();
}
//////////////////////////////////////////Repair Weapon
else if($action=="repair")
{
addonline(getuid_sid($sid),"Repairing Weapon","");
$wep = $_GET["wep"];
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Repair Weapon<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
$gold = mysql_fetch_array(mysql_query("SELECT gold FROM ibwf_users WHERE id='".$uid."'"));
$repair = mysql_fetch_array(mysql_query("SELECT uid, maxdamage, damage FROM ibwf_attacks WHERE id='".$wep."'"));
$cos = $repair[1] - $repair[2];
$cost = $cos * 2;
if($repair[0]==$uid){
if($gold[0]<$cost){
echo "<img src=\"images/notok.gif\" alt=\"x\"/>Not Enough Gold!<br/>";
}else{
$res = mysql_query("UPDATE ibwf_attacks SET damage='".$repair[1]."' WHERE id='".$wep."'");
$upd = $gold[0] - $cost;
$gol = mysql_query("UPDATE ibwf_users SET gold='".$upd."' WHERE id='".$uid."'");
if($res&&$gol)
{
echo "<img src=\"images/ok.gif\" alt=\"o\"/>Weapon Repaired Successfully!<br/>";
}else{
echo "<img src=\"images/notok.gif\" alt=\"x\"/>Unable to Repair!<br/>";
}
}
}else{
echo "<img src=\"images/notok.gif\" alt=\"x\"/>This is not your weapon!<br/>";
}
echo "<br/>";
echo "<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
echo "<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();
}
///////////////////////////////////////////////fantasy message
else if($action=="fantmsg")
{
addonline(getuid_sid($sid),"Fantasy Mood","");
echo "<head>";
echo "<title>[$umsg] wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div>";
echo "<br/>Fantasy Mood<br/>";
echo "</div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
echo "</p>";
$fmsg = mysql_fetch_array(mysql_query("SELECT fantasymsg FROM ibwf_users WHERE id='".$uid."'"));
echo "<form action=\"fantasy.php?action=upmsg&sid=$sid\" method=\"post\">";
echo "Text: <input name=\"fmsg\" maxlength=\"100\" value=\"$fmsg[0]\"/><br/>";
echo "<input type=\"submit\" value=\"GO\"/>";
echo "</form><br/>";
echo "<p align=\"center\">";
echo "<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
echo "<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();
}
//////////////////////////////////////////Update fantasy message
else if($action=="upmsg")
{
addonline(getuid_sid($sid),"Fantasy Mood","");
$fmsg = $_POST["fmsg"];
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Update Fantasy Mood<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
$res = mysql_query("UPDATE ibwf_users SET fantasymsg='".$fmsg."' WHERE id='".$uid."'");
if($res)
{
echo "<img src=\"images/ok.gif\" alt=\"o\"/>Fantasy Mood Updated Successfully<br/>";
}else{
echo "<img src=\"images/notok.gif\" alt=\"x\"/>Can't Update Your Fantasy Mood<br/>";
}
echo "<br/>";
echo "<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
echo "<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();
}
///////////////////////////////////////////////////////////////delete weapon confirm
else if($action=="delwep")
{
//addonline(getuid_sid($sid),"$wapirate","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
$wep = $_GET["wep"];
echo "<div><br/>$wapirate!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
$test = mysql_fetch_array(mysql_query("SELECT name, upname FROM ibwf_attacks WHERE id='".$wep."'"));
echo "Are You Sure You Want To Throw Your $test[1] $test[0] Away?<br/>";
echo "<a href=\"index.php?action=rpg&sid=$sid&who=$uid\">NO</a><br/>----<br/>";
echo "<a href=\"fantasy.php?action=delwep2&wep=$wep&sid=$sid\">YES</a>";
echo "<br/>---<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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();
}
///////////////////////////////////////////////////////////////delete weapon final
else if($action=="delwep2")
{
//addonline(getuid_sid($sid),"$wapirate","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
$wep = $_GET["wep"];
echo "<div><br/>$wapirate!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
$test = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_attacks WHERE id='".$wep."'"));
if($test[0]==$uid){
$res = mysql_query("DELETE FROM ibwf_attacks WHERE id='".$wep."'");
if($res)
{
echo "<img src=\"images/ok.gif\" alt=\"O\"/>Weapon Discared Successfully<br/><br/>";
}else{
echo "<img src=\"images/notok.gif\" alt=\"O\"/>Database Error!<br/><br/>";
}
}else{
echo "<img src=\"images/notok.gif\" alt=\"O\"/>This Weapon Does Not Belong To You!<br/><br/>";
}
echo "<br/>---<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>------<br/>";
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();
}
//////////////////////////////////////////Fantasy Status
else if($action=="status")
{
addonline(getuid_sid($sid),"Fantasy Status","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Fantasy Status<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
$noob = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>0 AND wins<10"));
$snoob = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=10 AND wins<25"));
$tyro = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=25 AND wins<50"));
$member = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=50 AND wins<75"));
$amem = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=75 AND wins<250"));
$vital = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=250 AND wins<500"));
$vein = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=500 AND wins<750"));
$guru = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=750 AND wins<1000"));
$vip = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=1000 AND wins<1500"));
$fan = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=1500 AND wins<2000"));
$pio = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=2000 AND wins<2500"));
$vate = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=2500 AND wins<3000"));
$tre = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=3000 AND wins<4000"));
$master = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=4000 AND wins<5000"));
$icon = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=5000 AND wins<10000"));
$mor = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins>=10000"));
echo "Required Wins<br/><br/>";
echo "1-9 » <b>".fantasystatus(9)."</b> (<a href=\"fantasy.php?action=stat&top=10&min=0&sid=$sid\">$noob[0] </a> Members)<br/>";
echo "10-24 » <b>".fantasystatus(24)."</b> (<a href=\"fantasy.php?action=stat&top=25&min=9&sid=$sid\">$snoob[0] </a> Members)<br/>";
echo "25-49 » <b>".fantasystatus(49)."</b> (<a href=\"fantasy.php?action=stat&top=50&min=24&sid=$sid\">$tyro[0] </a> Members)<br/>";
echo "50-74 » <b>".fantasystatus(74)."</b> (<a href=\"fantasy.php?action=stat&top=75&min=49&sid=$sid\">$member[0] </a> Members)<br/>";
echo "75-99 » <b>".fantasystatus(99)."</b> (<a href=\"fantasy.php?action=stat&top=100&min=74&sid=$sid\">$amem[0] </a> Members)<br/>";
echo "100-149 » <b>".fantasystatus(149)."</b> (<a href=\"fantasy.php?action=stat&top=150&min=99&sid=$sid\">$vital[0] </a> Members)<br/>";
echo "150-199 » <b>".fantasystatus(199)."</b> (<a href=\"fantasy.php?action=stat&top=200&min=149&sid=$sid\">$vein[0] </a> Members)<br/>";
echo "200-249 » <b>".fantasystatus(249)."</b> (<a href=\"fantasy.php?action=stat&top=250&min=199&sid=$sid\">$vip[0] </a> Members)<br/>";
echo "250-299 » <b>".fantasystatus(299)."</b> (<a href=\"fantasy.php?action=stat&top=300&min=249&sid=$sid\">$fan[0] </a> Members)<br/>";
echo "300-349 » <b>".fantasystatus(349)."</b> (<a href=\"fantasy.php?action=stat&top=350&min=299&sid=$sid\">$pio[0] </a> Members)<br/>";
echo "350-399 » <b>".fantasystatus(399)."</b> (<a href=\"fantasy.php?action=stat&top=400&min=349&sid=$sid\">$vate[0] </a> Members)<br/>";
echo "400-449 » <b>".fantasystatus(449)."</b> (<a href=\"fantasy.php?action=stat&top=450&min=399&sid=$sid\">$tre[0] </a> Members)<br/>";
echo "450-499 » <b>".fantasystatus(499)."</b> (<a href=\"fantasy.php?action=stat&top=500&min=349&sid=$sid\">$master[0] </a> Members)<br/>";
echo "500-599 » <b>".fantasystatus(599)."</b> (<a href=\"fantasy.php?action=stat&top=600&min=499&sid=$sid\">$icon[0] </a> Members)<br/>";
echo "600+ » <b>".fantasystatus(600)."</b> (<a href=\"fantasy.php?action=stat&top=99999&min=599&sid=$sid\">$mor[0] </a> Members)<br/>";
echo "<br/>";
echo "<br/><a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
echo "<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();
}
//////////////////////////////////stats
else if($action=="stat")
{
//addonline(getuid_sid($sid),"$wapirate","");
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 Status!<br/></div>";
$top = $_GET["top"];
$min = $_GET["min"];
//////ALL LISTS SCRIPT <<
if($page=="" || $page<=0)$page=1;
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE wins<$top AND wins>$min"));
$num_items = $noi[0]; //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
//changable sql
$sql = "SELECT id, name, wins, loss, activate, fantasymsg FROM ibwf_users WHERE wins>$min AND wins>$min ORDER BY wins DESC LIMIT $limit_start, $items_per_page";
if($noi[0]>1)
{
$ss = "`s";
}
$num = $top - 1;
$status = fantasystatus($num);
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/>";
echo "$status$ss<br/><br/>";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
if($item[5]!=""){
$text = parsepm($item[5],$sid);
$nos = substr_count($text,"<img src=");
$noext = substr_count($text,"<img src=\"h");
$noextb = substr_count($text,"<img src=\"H");
$noexts = substr_count($text,"<img src=\" h");
$noextbs = substr_count($text,"<img src=\" H");
if($nos>2){
$active = "<b><i>Im greedy when it comes to smileys!</i></b>";
}else if($noext>0||$noextb>0||$noexts>0||$noextbs>0){
$active = "<b><i>External Images Not Allowed!</i></b>";
}else{
$active = "$text";
}
}else if($item[4]=="2")
{
$active = "Is Ready For A Challange!";
}else{
$active = "Is To Scared To Play! lol";
}
if($item[3]==""){
$lse = "0";
}else{
$lse = "$item[3]";
}
if(isonline($item[0]))
{
$iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
}else{
$iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
}
$lnk = "<a href=\"index.php?action=rpg&who=$item[0]&sid=$sid\">$item[1]</a> $active<br/> Wins: $item[2] Losses: $lse<br/>---";
echo "$iml $lnk<br/>";
}
}
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"kindatrpg.php?action=player&page=$ppage&sid=$sid&view=$view\">«PREV</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"kindatrpg.php?action=player&page=$npage&sid=$sid&view=$view\">Next»</a>";
}
echo "<br/>$page/$num_pages<br/>";
echo "</p>";
if($num_pages>2)
{
$rets = "<form action=\"kindatrpg.php\" method=\"get\">";
$rets .= "Jump to page<input name=\"page\" format=\"*N\" size=\"3\"/>";
$rets .= "<input type=\"submit\" value=\"GO\"/>";
$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
$rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
$rets .= "</form>";
echo $rets;
}
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"fantasy.php?action=status&sid=$sid\">";
echo "Status</a><br/>----<br/>";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
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();
}
//////////////////////////////////Characters
else if($action=="character")
{
addonline(getuid_sid($sid),"Characters List","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Characters<br/></div>";
if($page=="" || $page<=0)$page=1;
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fantasy_characters"));
$num_items = $noi[0]; //changable
$items_per_page= 5;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
//changable sql
$sql = "SELECT id, piclink FROM fantasy_characters ORDER BY id DESC LIMIT $limit_start, $items_per_page";
echo "<p align=\"center\">";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
if (isadmin(getuid_sid($sid))){
$del = "<a href=\"admproc.php?action=delchar&sid=$sid&chid=$item[0]\">[X]</a><br/>";
}
echo "<img src=\"$item[1]\" alt=\"*\"/><br/>";
echo "<a href=\"fantasy.php?action=upchar&sid=$sid&chid=$item[0]\">SELECT</a> $del<br/>";
echo "<br/>";
}
}
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"fantasy.php?action=$action&page=$ppage&sid=$sid&view=$view\">«PREV</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"fantasy.php?action=$action&page=$npage&sid=$sid&view=$view\">Next»</a>";
}
echo "<br/>$page/$num_pages<br/>";
echo "</p>";
if($num_pages>2)
{
$rets = "<form action=\"fantasy.php\" method=\"get\">";
$rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
$rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
$rets .= "<input type=\"submit\" value=\"Go To Page\"/>";
$rets .= "</form>";
echo $rets;
}
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">$wapirate</a><br/>----<br/>";
echo "<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();
}
//////////////////////////////////////////Select Character
else if($action=="upchar")
{
addonline(getuid_sid($sid),"Updating Character","");
$chid = $_GET["chid"];
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Update Character<br/></div>";
echo "<p align=\"center\">";
//$uid = getuid_sid($sid);
$piclnk = mysql_fetch_array(mysql_query("SELECT piclink FROM fantasy_characters WHERE id='".$chid."'"));
$res = mysql_query("UPDATE ibwf_users SET fantasypic='".$piclnk[0]."' WHERE id='".$uid."'");
if($res)
{
echo "<img src=\"images/ok.gif\" alt=\"o\"/>Character Selected Successfully<br/>";
}else{
echo "<img src=\"images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
}
echo "<br/>";
echo "<a href=\"fantasy.php?action=main&sid=$sid\">$wapirate</a><br/>----<br/>";
echo "<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();
}
/////////////////////////////////////////////GAME
else{
$hit = $_POST["hit"];
$who = $_GET["who"];
$rpg = $_GET["rpg"];
$wepn = $_POST["wepn"];
$act = explode("_",$wepn);
$wepn = $act[1];
$type = $act[2];
$ncl = mysql_fetch_array(mysql_query("SELECT id, bet, byuid, touid FROM ibwf_rpg WHERE touid='".$uid."' ORDER BY id DESC LIMIT 1"));
$ncl2 = mysql_fetch_array(mysql_query("SELECT id, bet, byuid, touid FROM ibwf_rpg WHERE byuid='".$uid."' ORDER BY id DESC LIMIT 1"));
$unick2 = getnick_uid($ncl2[3]);
$unick = getnick_uid($ncl[2]);
//addonline(getuid_sid($sid),"$wapirate","");
//addonline(getuid_sid($sid),"Challenge with $unick$unick2 with BET $ncl[1]$ncl2[1]","");
if(!ingame($uid))
{
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
echo "Access Denied You are not in a game!<br/>";
mysql_query("UPDATE ibwf_users SET hit='1' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET lastdamage='0' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET givedamage='0' WHERE id='".$uid."'");
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>----<br/>";
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>";
echo "</html>";
exit();
}
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!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"/smilies/pirates.gif\" alt=\"*\"/><br/><br/>";
$info = mysql_fetch_array(mysql_query("SELECT uid, who FROM ibwf_rpgame WHERE uid='".$uid."'"));
$unick = getnick_uid($info[1]);
$tmsg = getpmcount(getuid_sid($sid));
$umsg = getunreadpm(getuid_sid($sid));
if($umsg>0){
echo "<a href=\"inbox.php?action=main&sid=$sid&tid=$tid\">Inbox [$umsg/$tmsg]</a><br/>";
}
//echo getshoutbox($sid);
echo "<br/>";
$info = mysql_fetch_array(mysql_query("SELECT health FROM ibwf_users WHERE id='".$uid."'"));
if($rpg==game)
{
mysql_query("UPDATE ibwf_rpg SET accept='0' WHERE byuid='".$uid."'");
}
if(!turn($uid))
{
if($act[0]=="w"){
////////////////////////////////////////id weapons damage
$rpgds = mysql_fetch_array(mysql_query("SELECT id, name, damage, uid, loss FROM ibwf_attacks WHERE id='".$wepn."'"));
$attack = $rpgds[1];
$damage = $rpgds[2];
////damage to player
$hwdamage = rand(10,$damage);
////damage to weapon
if($rpgds[3]!=2){
$wepdam = rand(5,$rpgds[4]);
$next = $rpgds[2] - $wepdam;
mysql_query("UPDATE ibwf_attacks SET damage='".$next."' WHERE id='".$wepn."'");
}
//////////////////////magic action
}else if($act[0]=="m"){
$magix = mysql_fetch_array(mysql_query("SELECT id, name, power, uid, type FROM fantasy_magic WHERE id='".$wepn."'"));
///////////magicweapon
if($magix[4]=="w"){
$attack = $magix[1];
$damage = $magix[2];
////damage to player
if($damage=="max"){
$hwdamage = $damage;
}else{
$hwdamage = rand(10,$damage);
}
mysql_query("DELETE FROM fantasy_magic WHERE id='".$wepn."'");
/////////////////magicHeal
}else if($magix[4]=="h"){
$res = mysql_query("UPDATE ibwf_users SET health=health+'$magix[2]' WHERE id='".$uid."'");
if($res){
mysql_query("DELETE FROM fantasy_magic WHERE id='".$wepn."'");
}
$attack = $magix[1];
$hwdamage = $magix[2];
}
//////////////////guardian action fuck knows lol
}else if($act[0]=="g"){
}
//$arr = array('".$act[0]."','".$attack."','".$type."');
//$newattack = implode("_",$arr);
//$newattack = "$act[0]_$attack_$type";
$newattack = "$act[0]_$attack";
if($type!="")
$newattack = "$newattack_$type";
}
echo "Debug attack: $newattack<br/>";
$info = mysql_fetch_array(mysql_query("SELECT uid, who, bet FROM ibwf_rpgame WHERE uid='".$uid."'"));
if(!turn($uid))
{
if($hit=="1")
{
mysql_query("UPDATE ibwf_users SET hit='1' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET hit='0' WHERE id='".$info[1]."'");
if($hwdamage=="max"){
mysql_query("UPDATE ibwf_users SET health='1' WHERE id='".$info[1]."'");
}else{
mysql_query("UPDATE ibwf_users SET health=health-'$hwdamage' WHERE id='".$info[1]."'");
}
mysql_query("UPDATE ibwf_users SET lastattack='".$newattack."' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET damages='$hwdamage' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET weploss='".$wepdam."' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET giveattack='".$newattack."' WHERE id='".$info[1]."'");
mysql_query("UPDATE ibwf_users SET givedamage='$hwdamage' WHERE id='".$info[1]."'");
mysql_query("UPDATE ibwf_users SET lastdamage='0' WHERE id='".$uid."'");
}
}
$damages = mysql_fetch_array(mysql_query("SELECT damages, weploss FROM ibwf_users WHERE id='".$uid."'"));
$attacks = mysql_fetch_array(mysql_query("SELECT lastattack FROM ibwf_users WHERE id='".$uid."'"));
$lat = explode("_",$attacks[0]);
$givedamages = mysql_fetch_array(mysql_query("SELECT givedamage FROM ibwf_users WHERE id='".$uid."'"));
$giveattacks = mysql_fetch_array(mysql_query("SELECT giveattack FROM ibwf_users WHERE id='".$uid."'"));
$gat = explode("_",$giveattacks[0]);
if(!noact($uid))
{
$tries = mysql_fetch_array(mysql_query("SELECT health FROM ibwf_users WHERE id='".$uid."'"));
$mama= $tries[0];
if($mama>0)
{
$tries2 = mysql_fetch_array(mysql_query("SELECT health FROM ibwf_users WHERE id='".$info[1]."'"));
$mama2= $tries2[0];
if($mama2>0)
{
if(!turn($uid))
{
if($gat[0]=="w"&&$givedamages[0]!="0"){
echo "You Received A $gat[1] From $unick!<br/>";
echo "Damage: $givedamages[0]<br/><br/>";
}else if($gat[0]=="m"){
if($gat[2]=="h"){
echo "$unick Healed Themselfs With A $gat[1]!<br/>";
echo "Health Up: $givedamages[0]<br/><br/>";
}else if($gat[2]=="w"){
if($gat[1]=="Death"){
echo "<img src=\"/images/deathhomer.gif\" alt=\"DEATH\"/> Death Touched You!<br/>";
}else{
echo "You Received A $gat[1] From $unick!<br/>";
}
echo "Damage: $givedamages[0]<br/><br/>";
}
}else if($gat[0]=="g"){
}else{
echo "<b>START FIGHT!</b><br/><br/>";
}
}else{
if($lat[0]=="w"){
echo "You Hit $unick With A $lat[1]!<br/>";
echo "Damage: $damages[0]<br/>";
echo "Weapon Damage: $damages[1]<br/><br/>";
}else if($lat[0]=="m"){
if($lat[2]=="h"){
echo "You Healed Yourself With A $lat[1]!<br/>";
echo "Health Up: $damages[0]<br/><br/>";
}else if($lat[2]=="w"){
if($lat[1]=="Death"){
echo "<img src=\"/images/deathhomer.gif\" alt=\"DEATH\"/> Death Touched $unick!<br/>";
echo "Damage: $damages[0]<br/>";
}else{
echo "You Hit $unick With A $lat[1]!<br/>";
echo "Damage: $damages[0]<br/>";
}
}
}else if($lat[0]=="g"){
}else{
echo "<b>GET READY TO FIGHT!</b><br/><br/>";
}
}
$unick3 = getnick_uid($uid);
$health = mysql_fetch_array(mysql_query("SELECT health, fantasypic FROM ibwf_users WHERE id='".$uid."'"));
$health2 = mysql_fetch_array(mysql_query("SELECT health, fantasypic FROM ibwf_users WHERE id='".$info[1]."'"));
///////////////chacacter
if($health[1]!=""){
$picx = "<img src=\"$health[1]\" alt=\"$unick3\"/>";
}
if($health2[1]!=""){
$picz = "<img src=\"$health2[1]\" alt=\"$unick\"/>";
}
echo "<b>HEALTH LEFT</b><br/>";
echo "$picx --- $picz<br/>";
echo "$health[0] :<a href=\"index.php?action=rpg&sid=$sid&who=$uid\">$unick3</a> --- ";
echo " <a href=\"index.php?action=rpg&sid=$sid&who=$info[1]\">$unick</a>: $health2[0] <br/>";
if(!turn($uid))
{
//////////////////Select Weapons
echo "</p><center><form action=\"fantasy.php?sid=$sid\" method=\"post\">";
$countrss = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_attacks WHERE uid='".$uid."' AND damage>5"));
$rss = mysql_query("SELECT id, name, damage FROM ibwf_attacks WHERE uid='".$uid."' AND damage>5");
echo "Select Weapon:<br/><select name=\"wepn\">";
if($countrss[0]>0){
echo "<optgroup label=\"Power Weapons\">";
while($rs=mysql_fetch_array($rss))
{
echo "<option value=\"w_$rs[0]\">$rs[1] ($rs[2])</option>";
}
echo "</optgroup>";
}
echo "<optgroup label=\"Standard Weapons\">";
$sta = mysql_query("SELECT id, name, damage FROM ibwf_attacks WHERE uid='2'");
while($st=mysql_fetch_array($sta))
{
echo "<option value=\"w_$st[0]\">$st[1] ($st[2])</option>";
}
echo "</optgroup>";
//////////////////select magic
$magnum = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fantasy_magic WHERE uid='".$uid."'"));
if($magnum[0]>0){
echo "<optgroup label=\"Magic\">";
$magics = mysql_query("SELECT id, name, power, type FROM fantasy_magic WHERE uid='".$uid."'");
while($magic=mysql_fetch_array($magics))
{
echo "<option value=\"m_$magic[0]_$magic[3]\">$magic[1] ($magic[2])</option>";
}
echo "</optgroup>";
}
//////////////////////////select guardian
$guanum = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fantasy_guardians WHERE uid='".$uid."'"));
if($guanum[0]>0){
echo "<optgroup label=\"Guardians\">";
$guardians = mysql_query("SELECT id, name, health FROM fantasy_guardians WHERE uid='".$uid."'");
while($guardian=mysql_fetch_array($guardians))
{
echo "<option value=\"g_$guardian[0]\">$guardian[1] ($guardian[2])</option>";
}
echo "</optgroup>";
}
echo "</select><br/>";
echo "<input name=\"hit\" type=\"hidden\" value=\"1\"/>";
echo "<input type=\"submit\" value=\"HIT\"/>";
echo "</form>";
echo "</center><p align=\"center\">";
////////////
//echo "<a href=\"fantasy.php?&sid=$sid&hit=1&t=$time\">HIT!</a><br/>";
echo "<a href=\"fantasy.php?action=cancel&sid=$sid\">Cancel</a><br/>---<br/>";
}else{
echo "<a href=\"fantasy.php?&sid=$sid&t=$time\">Refresh</a><br/>---<br/>";
}
$whos = $info[1];
}else{
$yes = mysql_fetch_array(mysql_query("SELECT health FROM ibwf_users WHERE id='".$uid."'"));
if($yes[0]>100){
echo "<b>CONGRATULATIONS!</b><br/>You Killed $unick And You’ve Won $info[2] Gold!<br/>";
}else{
echo "<b>CONGRATULATIONS!</b><br/>You Killed $unick And You’ve Won $info[2] Gold!<br/> And Your Health Has Been Updated To 100!<br/>";
mysql_query("UPDATE ibwf_users SET health='100' WHERE id='".$uid."'");
}
mysql_query("UPDATE ibwf_users SET wins=wins+'1' WHERE id='".$uid."'");
mysql_query("DELETE FROM ibwf_rpgame WHERE uid='".$uid."'");
mysql_query("UPDATE ibwf_users SET hit='1' WHERE id='".$uid."'");
mysql_query("DELETE FROM ibwf_rpg WHERE byuid='".$uid."'");
mysql_query("UPDATE ibwf_rpg SET accept='0' WHERE byuid='".$uid."'");
mysql_query("UPDATE ibwf_users SET health='0' WHERE id='".$info[1]."'");
mysql_query("UPDATE ibwf_users SET lastdamage='0' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET givedamage='0' WHERE id='".$uid."'");
}
}else{
$lose = rand(1,10);
if($lose=="5"){
$hum = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_attacks WHERE uid='".$uid."'"));
if($hum[0]>3){
$rpgd = mysql_query("SELECT id, name FROM ibwf_attacks WHERE uid='".$uid."' ORDER by RAND() LIMIT 1");
while($rpgds=mysql_fetch_array($rpgd))
{
$attack = $rpgds[0];
$weapon = $rpgds[1];
}
$res = mysql_query("DELETE FROM ibwf_attacks WHERE id='".$attack."'");
if($res){
echo "<b>SORRY!</b><br/>You Have Been Killed By $unick!<br/>And You Lost Your $weapon!<br/>";
}else{
echo "<b>SORRY!</b><br/>You Have Been Killed By $unick!<br/>";
}
}else{
echo "<b>SORRY!</b><br/>You Have Been Killed By $unick!<br/>";
}
}else{
echo "<b>SORRY!</b><br/>You Have Been Killed By $unick!<br/>";
}
mysql_query("UPDATE ibwf_users SET health='0' WHERE id='".$uid."'");
$info = mysql_fetch_array(mysql_query("SELECT uid, who, bet FROM ibwf_rpgame WHERE uid='".$uid."'"));
mysql_query("UPDATE ibwf_users SET gold=gold-'$info[2]' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET gold=gold+'$info[2]' WHERE id='".$info[1]."'");
mysql_query("UPDATE ibwf_users SET hit='1' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET loss=loss+'1' WHERE id='".$uid."'");
mysql_query("DELETE FROM ibwf_rpgame WHERE uid='".$uid."'");
mysql_query("DELETE FROM ibwf_rpgame WHERE uid='".$uid."'");
mysql_query("DELETE FROM ibwf_rpg WHERE byuid='".$uid."' AND id='".$ncl2[0]."'");
mysql_query("UPDATE ibwf_rpg SET accept='0' WHERE touid='".$uid."'");
mysql_query("UPDATE ibwf_users SET lastdamage='0' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_users SET givedamage='0' WHERE id='".$uid."'");
}
}else{
//echo "You gave $unick a $attacks[0] attack!<br/>";
//echo "Damage: 0 <br/><br/>";
$unick3 = getnick_uid($uid);
$health = mysql_fetch_array(mysql_query("SELECT health, fantasypic FROM ibwf_users WHERE id='".$uid."'"));
$health2 = mysql_fetch_array(mysql_query("SELECT health, fantasypic FROM ibwf_users WHERE id='".$info[1]."'"));
///////////////chacacter
if($health[1]!=""){
$picx = "<img src=\"$health[1]\" alt=\"$unick3\"/>";
}
if($health2[1]!=""){
$picz = "<img src=\"$health2[1]\" alt=\"$unick\"/>";
}
echo "<b>HEALTH LEFT</b><br/>";
echo "$picx --- $picz<br/>";
echo "$health[0] :<a href=\"index.php?action=rpg&sid=$sid&who=$uid\">$unick3</a> --- ";
echo " <a href=\"index.php?action=rpg&sid=$sid&who=$info[1]\">$unick</a>: $health2[0]<br/><br/>";
echo "<a href=\"fantasy.php?&sid=$sid&t=$time\">refresh</a><br/>---<br/>";
}
echo "<a href=\"fantasy.php?action=main&sid=$sid\">";
echo "$wapirate</a><br/>---<br/>";
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();
}
?>
</html>