<?php
include("captainsafecore.php");
include("captainsafeconfig.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\">";
$bcon = connectdb();
if (!$bcon)
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"themes$bgi.php?sid=$sid\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Doh!<br/></div>";
echo "<p align=\"center\">";
echo "<img src=\"images/exit.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 "You can temporary use our other <a href=\"http://wapirate.madpage.com/chat/index.php\">chatroom</a> while wapirate is offline<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"];
$uid = getuid_sid($sid);
$date = $_GET['date'];
$cnt = $_GET['cnt'];
$wea = $_GET['wea'];
$theme = mysql_fetch_array(mysql_query("SELECT theme, folder, background_image FROM ibwf_users WHERE id='".$uid."'"));
$folder = $theme[1];
if($theme[2]!=""){
$bgi = "1";
}
cleardata();
if((islogged($sid)==false)||($uid==0))
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"themes$bgi.php?sid=$sid\">";
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();
}
if(isipbanned($uip,$ubr))
{
if(!isshield(getuid_sid($sid)))
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"themes$bgi.php?sid=$sid\">";
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 "</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$bgi.php?sid=$sid\">";
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();
}
$res = mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");
/////////////////////////////main
if($action=="main")
{
addonline(getuid_sid($sid),"Weather!","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"themes$bgi.php?sid=$sid\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Weather<br/></div>";
///////////////hey Pg :P
/////////////////write url below
$url="http://weather.sendwap.com/weather.php";
//////////////////////[dont touch this]
preg_match("/^(https?:\/\/)?([^\/]*)(.*)/i", "$url", $matches);
$domain = "http://" . $matches[2];
$page = $matches[3];
$code = file_get_contents($domain.$page);
//////////////////////[/dont touch this]
/////////////////////write a word or sentance thats in the source below (where u want to start)
$start= strpos($code, "Choose the country:");
////////////////////same again below but finishing postion
$finish= strpos($code, "<a href=\".\">Weather in Europe</a>");
//////////////////////[dont touch this]
$length= $finish-$start;
$code=substr($code, $start, $length);
$newcode = preg_replace("/(href=\"?)(\/[^\"\/]+)/", "\\1" . $domain . "\\2", $code);
//////////////////////[/dont touch this]
///////////////////this is the string replacement to code all the crap you dont want
/////////eg: $newcode = str_replace("crap","wapirate",$newcode);
////////////(changes the word crap to wapirate) but below changes it to nothing
$newcode = str_replace("</p>","",$newcode);
$newcode = str_replace("<p>","",$newcode);
$newcode = str_replace(".wml","",$newcode);
////////////////////also can change there links into our links with it (below)
$newcode = str_replace("<a href=\"cnt","<a href=\"weather.php?action=country&sid=$sid&cnt=cnt",$newcode);
echo "<p align=\"center\">";
echo "<img src=\"/smilies/sunny.gif\" alt=\"*\"/><br/>";
echo "<br/>";
///////////////it echo your new page here!
echo "$newcode<br/>";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images$folder/home.gif\" alt=\"*\"/>Home</a><br/><br/>";
echo "</p>\n";
echo "<div>wapirate.net</div>";
echo "</body>";
echo "</html>";
exit();
}
/////////////////////////////////
if($action=="country")
{
addonline(getuid_sid($sid),"Weather!","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"themes$bgi.php?sid=$sid\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Weather<br/></div>";
$url="http://weather.sendwap.com/$cnt.wml";
preg_match("/^(https?:\/\/)?([^\/]*)(.*)/i", "$url", $matches);
$domain = "http://" . $matches[2];
$page = $matches[3];
$code = file_get_contents($domain.$page);
$start= strpos($code, "Choose the city:");
$finish= strpos($code, "<a href=\".\">Weather in Europe</a>");
$length= $finish-$start;
$code=substr($code, $start, $length);
$newcode = preg_replace("/(href=\"?)(\/[^\"\/]+)/", "\\1" . $domain . "\\2", $code);
$newcode = str_replace("</p>","",$newcode);
$newcode = str_replace("<p>","",$newcode);
$newcode = str_replace(".wml","",$newcode);
$newcode = str_replace("<a href=\"weather","<a href=\"weather.php?action=weather&sid=$sid&wea=weather",$newcode);
$newcode = str_replace("<a href=\"cnt","<a href=\"weather.php?action=country&sid=$sid&cnt=cnt",$newcode);
echo "<p align=\"center\">";
echo "<img src=\"/smilies/sunny.gif\" alt=\"*\"/><br/>";
echo "<br/>";
echo "$newcode<br/>";
echo "<br/><a href=\"weather.php?action=main&sid=$sid\">Back</a><br/><br/>";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images$folder/home.gif\" alt=\"*\"/>Home</a><br/><br/>";
echo "</p>\n";
echo "<div>wapirate.net</div>";
echo "</body>";
echo "</html>";
exit();
}
/////////////////////////////////
if($action=="weather")
{
addonline(getuid_sid($sid),"Weather!","");
echo "<head>";
echo "<title>wapirate</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"themes$bgi.php?sid=$sid\">";
echo "</head>";
echo "<body>";
echo "<div><br/>Weather!<br/></div>";
$url="http://weather.sendwap.com/$wea.wml";
preg_match("/^(https?:\/\/)?([^\/]*)(.*)/i", "$url", $matches);
$domain = "http://" . $matches[2];
$page = $matches[3];
$code = file_get_contents($domain.$page);
$start= strpos($code, "weather\">");
$finish= strpos($code, "<p align=\"right\">");
$length= $finish-$start;
$code=substr($code, $start, $length);
$newcode = preg_replace("/(href=\"?)(\/[^\"\/]+)/", "\\1" . $domain . "\\2", $code);
$newcode = str_replace("weather\">","",$newcode);
$newcode = str_replace("</p>","",$newcode);
$newcode = str_replace("<p>","",$newcode);
$newcode = str_replace("<p align=\"center\">","",$newcode);
echo "<p align=\"center\">";
echo "<img src=\"/smilies/sunny.gif\" alt=\"*\"/><br/>";
echo "<br/>";
echo "$newcode<br/>";
echo "<br/><a href=\"weather.php?action=main&sid=$sid\">Back</a><br/><br/>";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images$folder/home.gif\" alt=\"*\"/>Home</a><br/><br/>";
echo "</p>\n";
echo "<div>wapirate.net</div>";
echo "</body>";
echo "</html>";
exit();
}
echo "</html>";
?>