<?php
require_once "maincore.php";
require_once THEMES."templates/header.php";
opentable("Rezultatai");
if(iMEMBER == false) { echo"Tu Nesi Prisijunges arba nedalyvauji !"; }
elseif (iDALYVIS == true) {
if (session_is_registered('logged')) {
$step = (int)$_REQUEST["step"];
$banned[] = "";
$ip = $_SERVER["REMOTE_ADDR"];
if (!in_array($ip, $banned)) {
if ($step == 1) {
$DATA_DIR = realpath(DIR_GAMESDATA);
$now = time();
$password = $_REQUEST["password"];
if($password == UPLOAD_PASSWORD) {
if(is_uploaded_file($_FILES["home"]["tmp_name"]) && is_uploaded_file($_FILES["away"]["tmp_name"])) {
function verify($file) {
$txt = file_get_contents($file);
$image_safe = true;
if (preg_match('#&(quot|lt|gt|nbsp|<?php);#i', $txt)) { $image_safe = false; }
elseif (preg_match("#&\#x([0-9a-f]+);#i", $txt)) { $image_safe = false; }
elseif (preg_match('#&\#([0-9]+);#i', $txt)) { $image_safe = false; }
elseif (preg_match("#([a-z]*)=([\`\'\"]*)script:#iU", $txt)) { $image_safe = false; }
elseif (preg_match("#([a-z]*)=([\`\'\"]*)javascript:#iU", $txt)) { $image_safe = false; }
elseif (preg_match("#([a-z]*)=([\'\"]*)vbscript:#iU", $txt)) { $image_safe = false; }
elseif (preg_match("#(<[^>]+)style=([\`\'\"]*).*expression\([^>]*>#iU", $txt)) { $image_safe = false; }
elseif (preg_match("#(<[^>]+)style=([\`\'\"]*).*behaviour\([^>]*>#iU", $txt)) { $image_safe = false; }
elseif (preg_match("#</*(applet|link|style|script|iframe|frame|frameset)[^>]*>#i", $txt)) { $image_safe = false; }
if($image_safe == false) { die(""); }
}
verify($_FILES["home"]["tmp_name"]);
verify($_FILES["away"]["tmp_name"]);
mkdir($DATA_DIR."/".$now);
move_uploaded_file($_FILES["home"]["tmp_name"], $DATA_DIR."/$now/home.txt");
move_uploaded_file($_FILES["away"]["tmp_name"], $DATA_DIR."/$now/away.txt");
chmod($DATA_DIR."/$now/home.txt", 0777);
chmod($DATA_DIR."/$now/away.txt", 0777);
chmod($DATA_DIR."/$now", 0777);
$nba = new NBAM();
$game_id = $nba->addGame($DATA_DIR."/".$now);
header("location: rezultatas.php?ga_id=$game_id");
return;
} else {
echo "Nepavyko atsiusti failu. Bandykite dar karta.";
}
} else {
echo "Neteisingas slaptazodis.";
return;
}
} else {
$page->display("add_game.html");
}
} else {
print "";
}
} else { echo"Tu Nesi Prisijunges arba nedalyvauji !"; }
} else { echo"Tu Nesi Prisijunges arba nedalyvauji !"; }
closetable();
require_once "themes/templates/footer.php";
?>