tervise@hot.ee"; $jooksevtekst=""; if ($down == "1") { $laiend=".htm"; } else { $link="index.php?p="; } include("inc-header.php"); include("filelist.php"); $p = str_replace('/','',$_GET['p']); if ($p == "inc-header") { include("error.php"); } elseif ($p == "inc-footer") { include("error.php"); } elseif ($p == "inc-jooksevtekst") { include("error.php"); } elseif ($p == "filelist") { include("error.php"); } elseif (strpos($p, ".") === 0) { include("error.php"); } elseif (strpos($p, "/") === 0) { include("error.php"); } elseif ($update != "1" && $p != "" && !is_readable("$p.php")) { include("missing.php"); clearstatcache(); } elseif ($update == "1") { $source_file = "ajutine.txt"; $aeg = date("d.M.Y H:i:s"); if (is_writeable($source_file)) { $ftp_server = "karel.tt.ee"; $ftp_user_name = "tervise"; $ftp_user_pass = "oleterve"; $conn_id = ftp_connect($ftp_server); clearstatcache(); $aeg = date("d.M.Y H:i:s"); $missed= 0; $cant= 0; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); if ((!$conn_id) || (!$login_result)) { echo "$aeg - Serveriga $ftp_server ei saa ühendust!\n
"; die; } else { echo "$aeg - Ühendus loodud serveriga $ftp_server kasutajana $ftp_user_name.\n
"; } if ($p == "") { $end= 0; $n= 0; $summa= 0; $fnr= 0; do { include("filelist.php"); if ($end != "1") { if (is_readable("$ulp.php")) { $aeg = date("d.M.Y H:i:s"); clearstatcache(); $fpin = fopen("http://kuressaare.advent.ee/tervise/index.php?p=$ulp&down=1", "r"); $in_string=''; while (!feof($fpin)) { $in_string .= fread($fpin, 8192); } // $in_string = fread($fpin, 524288); fclose($fpin); $tmpfile = fopen("$source_file", "w"); $fpout = fwrite($tmpfile,$in_string); fclose($tmpfile); $destination_file = "$ulp.htm"; $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); if (!$upload) { $cant= $cant + 1; echo "$aeg - $n. faili nimega $ulp.htm ei õnnestunud serverisse $ftp_server saata!\n
"; } else { $fsize = filesize($source_file); $summa= $summa + $fsize; $fnr= $fnr + 1; echo "$aeg - $n. fail nimega $ulp.htm suurusega $fsize baiti on serverisse edukalt saadetud.\n
"; } } else { $missed= $missed + 1; echo "$aeg - $n. dokumenti nimega $ulp pole olemas!\n
"; } } else { echo "$aeg - failide saatmise tsükli lõpp, kokku saadetud $fnr faili kogusuuruses $summa baiti.\n
"; $puudu= $cant + $missed; if ($puudu > 0) { echo "$aeg - saatmata jäi kokku $puudu faili, neist $missed puuduvat dokumenti ja $cant faili, mida ei õnnestunud saata!\n
"; } } } while (++$n <= 100 && $end != "1"); } elseif (is_readable("$p.php")) { include("filelist.php"); $aeg = date("d.M.Y H:i:s"); clearstatcache(); $fpin = fopen("http://kuressaare.advent.ee/tervise/index.php?p=$p&down=1", "r"); $in_string=''; while (!feof($fpin)) { $in_string .= fread($fpin, 8192); } // $in_string = fread($fpin, 524288); fclose($fpin); $tmpfile = fopen("$source_file", "w"); $fpout = fwrite($tmpfile,$in_string); fclose($tmpfile); $destination_file = "$p.htm"; $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); if (!$upload) { echo "$aeg - faili nimega $p.htm ei õnnestunud serverisse $ftp_server saata!\n
"; } else { $fsize = filesize($source_file); echo "$aeg - fail nimega $p.htm suurusega $fsize baiti on serverisse edukalt saadetud.\n
"; } } else { echo "$aeg - dokumenti nimega $p pole olemas!\n
"; } ftp_quit($conn_id); echo "$aeg - Ühendus serveriga $ftp_server on lahutatud ja kõik toimingud lõpetatud.\n
"; } else { echo "$aeg - Ajutine fail serveris pole kirjutatav või puudub. Palun teata sellest kodulehe haldajale!\n
"; } } elseif ($p == "" && is_readable("avaleht.php")) { include("avaleht.php"); } elseif (!is_readable("avaleht.php") && $all == "1") { echo "


Avalehe fail ei ole loetav või puudub
"; } elseif (!is_readable("avaleht.php")) { echo ""; } elseif ($p == "index") { include("avaleht.php"); } else { include("$p.php"); } if ($p == "" || $p == "index") { include("loendur.lisa"); } include("inc-footer.php"); if ($p == "" || $p == "index") { if (is_readable("avaleht.php")) { echo " Viimati uuendatud: "; echo (date("d.M.Y H:i:s T", filemtime(basename("avaleht.php")))); } } elseif (is_readable("$p.php") && $p != "inc-header" && $p != "inc-footer" && $p != "inc-jooksevtekst" && $p != "filelist" && (strpos($p, ".") !== 0) && (strpos($p, "/") !== 0)) { echo " Viimati uuendatud: "; echo (date("d.M.Y H:i:s T", filemtime(basename("$p.php")))); } echo "\n \n \n\n\n\n\n\n\n"; if ($jooksevtekst != "") { include ("inc-jooksevtekst.php"); } echo "\n\n\n"; clearstatcache(); ?>