UP
<?php
if (!defined('MODULE_FILE')) {
Header("Location: ../../index.php");
exit;
}
/*
======================
©Serg_pnz, 2007
e-mail: print58@yandex.ru
www.ponedelnikov.net
======================
Update by GizmoKoenig
e-mail: gizmokoenig@rambler.ru
www.gizmokoenig.freehostia.com
======================
*/
$module_name = basename(dirname(__FILE__));
require_once("config/config_pogoda.php");
function readservis($link) {
$fd = fopen($link, "r");
if ($fd == 0) {
return "Не удаётся загрузить прогноз!";}
else {
while (!feof ($fd)) {
$text .= fgets($fd, 4096);}}
fclose ($fd);
return $text;}
if (isset($_COOKIE["pogoda"]))
{list($kod,$city) = explode ("=", $_COOKIE["pogoda"]);}
$zamena = array ("http://img.gismeteo.ru/images/cloud.gif" => "images/pogoda/cloud.gif",
"http://img.gismeteo.ru/images/moon.gif" => "images/pogoda/moon.gif", "http://img.gismeteo.ru/images/moond.gif" => "images/pogoda/moond.gif",
"http://img.gismeteo.ru/images/moonc.gif" =>"images/pogoda/moonc.gif","http://img.gismeteo.ru/images/mooncl.gif"=>"images/pogoda/mooncl.gif",
"http://img.gismeteo.ru/images/nrain.gif"=>"images/pogoda/nrain.gif","http://img.gismeteo.ru/images/nrains.gif"=>"images/pogoda/nrains.gif",
"http://img.gismeteo.ru/images/nsky.gif" => "images/pogoda/nsky.gif","http://img.gismeteo.ru/images/nstrm.gif" =>"images/pogoda/nstrm.gif",
"http://img.gismeteo.ru/images/rain.gif" => "images/pogoda/rain.gif","http://img.gismeteo.ru/images/rains.gif" => "images/pogoda/rains.gif",
"http://img.gismeteo.ru/images/sky.gif" => "images/pogoda/sky.gif","http://img.gismeteo.ru/images/strm.gif" => "images/pogoda/strm.gif",
"http://img.gismeteo.ru/images/sun.gif" => "images/pogoda/sun.gif","http://img.gismeteo.ru/images/sunc.gif" => "images/pogoda/sunc.gif",
"http://img.gismeteo.ru/images/suncl.gif" => "images/pogoda/suncl.gif", "width=40 height=40" => "width=$imageobl1 height=$imageobl2",
"http://img.gismeteo.ru/images/snow.gif" => "images/pogoda/snow.gif", "http://img.gismeteo.ru/images/nsnow.gif" => "images/pogoda/nsnow.gif",
"width=40 height=20" => "width=$imageosad1 height=$imageosad2", "FFF0F0" => $styleytro, "FFFFF0" => "$styleden",
"F0FFF0" => "$stylevecher", "F0F0FF" => "$stylenoch", "F0F0F0" => "$stylestr", "FFFFFF" => "$stylestr2",
"border=0" => "border=$styleborder", "cellpadding=1" => "cellpadding=$stylecellpadding", "cellspacing=2" => "cellspacing=$stylecellspacing" );
if (isset($_POST["cityfind"])) {
$cityfind = $_POST["cityfind"];
$file = file("config/config_pogoda_cities.php");
for ($i=0;$i<count($file);$i++){
list($fromfile["kod"],$fromfile["city"]) = explode("=",$file[$i]);
if (ucwords($cityfind) == trim($fromfile["city"])) {
$ifnofound = $fromfile["city"];
$city = $fromfile["city"];
$kod = $fromfile["kod"];
if (isset($_POST["saveincookie"])) {setcookie ("pogoda", "$kod=$city", time() +31536000);}}}
if (!$ifnofound){$errorcity = "<center><font class=\"option\">Город не найден!</font></center>";}}
$pagetitle = "$defis Погода г.$city";
include("header.php");
OpenTable();
echo "<center><font class=\"title\"><b>Погода, г.$city</b></font><br></font></center>";
CloseTable();
OpenTable();
$out = readservis("http://www.gismeteo.ru/towns".$kod.".htm");
preg_match('/var frc=\'(.*)\'; var prhdr=/sUi',$out,$tabl);
$tablpogoda = preg_replace("#<tr><td colspan=8>(.*?)Печать</a></b></span></td></tr>#si","",$tabl[1]);
echo strtr($tablpogoda,$zamena);
echo "<br>$errorcity<table><tr><td>Выбрать другой город:</td>
<td><FORM ACTION=\"\" METHOD=POST NAME=\"GET_CITY\">
<INPUT TYPE=\"text\" name=\"cityfind\" maxlength=\"24\" SIZE=\"30\" VALUE=\"\">
<INPUT TYPE=\"checkbox\" name=\"saveincookie\" checked VALUE=\"\"> Запомнить?   
<INPUT TYPE=\"submit\" VALUE=\"Показать \"></FORM></td></tr></table>";
CloseTable();
include("footer.php");
?>






