View file wapirate/wml/weather.php

File size: 3.86Kb
<?php 
include("head.php"); 
 
$date = $_GET['date']; 
$cnt = $_GET['cnt']; 
$wea = $_GET['wea']; 
////////////////////////////////////////MAIN PAGE 

if($action=="main") 
{ 

addonline(getuid_sid($sid),"Weather!",""); 
echo "<card id=\"main\" title=\"wapirate\">"; 
echo "<p align=\"center\">"; 
echo "<b>Weather!</b><br/>"; 
$url="http://weather.sendwap.com/weather.php"; 
preg_match("/^(https?:\/\/)?([^\/]*)(.*)/i", "$url", $matches); 
$domain = "http://" . $matches[2]; 
$page = $matches[3]; 
$code = file_get_contents($domain.$page); 
$start= strpos($code, "Choose the country:"); 
$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("<a href=\"cnt","<a href=\"weather.php?action=country&amp;cnt=cnt",$newcode); 
$newcode = str_replace(".wml","",$newcode); 
echo "<img src=\"/smilies/sunny.gif\" alt=\"*\"/><br/>"; 
echo "<br/>"; 
echo "$newcode<br/>"; 
echo "<a href=\"index.php?action=main\"><img src=\"images$folder/home.gif\" alt=\"*\"/>Home</a><br/><br/>"; 
echo "</p>"; 
echo "</card>"; 
} 
////////////////////////////////////////////// 
else if($action=="country") 
{ 
addvisitor(); 
addonline(getuid_sid($sid),"Weather",""); 
echo "<card id=\"main\" title=\"Bandit\">"; 
echo "<p align=\"center\">"; 
echo "<b>Weather!</b><br/>"; 
$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&amp;wea=weather",$newcode); 
$newcode = str_replace("<a href=\"cnt","<a href=\"weather.php?action=country&amp;cnt=cnt",$newcode); 

echo "<img src=\"/smilies/sunny.gif\" alt=\"*\"/><br/>"; 
echo "<br/>"; 
echo "$newcode<br/>"; 
echo "<br/><a href=\"weather.php?action=main\">Back</a><br/><br/>"; 
echo "<a href=\"index.php?action=main\"><img src=\"images$folder/home.gif\" alt=\"*\"/>Home</a><br/><br/>"; 
echo "</p>\n"; 
echo "</card>"; 
} 
//////////////////////////////////////////// 
else if($action=="weather") 
{ 

addonline(getuid_sid($sid),"Weather!",""); 
echo "<card id=\"main\" title=\"wapirate\">"; 
echo "<p align=\"center\">"; 
echo "<b>Weather!</b><br/>"; 
$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 "<img src=\"/smilies/sunny.gif\" alt=\"*\"/><br/>"; 
echo "<br/>"; 
echo "$newcode<br/>"; 
echo "<br/><a href=\"weather.php?action=main\">Back</a><br/><br/>"; 
echo "<a href=\"index.php?action=main\"><img src=\"images$folder/home.gif\" alt=\"*\"/>Home</a><br/><br/>"; 
echo "</p>"; 
echo "</card>"; 
} 
?> 
</wml>