require("include/top.php");
if($whichwhen)
{
list($which,$when) = explode("|",$whichwhen);
}
$when2d = substr($when,-2);
$when = intval($when);
if ($when < 50) {
$when += 2000;
} elseif ($when < 100) {
$when += 1900;
}
unset($submitok);
// check the submitted data
if(is_uploaded_file($resultsfile))
{
// check user account
if(!$_SESSION["SESSION"]||!$_SESSION["SCENEID"])
$errormessage[]="you need to be logged in first.";
// check if there is already an nfo file for thid prod
if(file_exists("results/".$which."_".$when2d.".txt"))
{
if($SESSION_LEVEL=='administrator' || $SESSION_LEVEL=='moderator' || $SESSION_LEVEL=='gloperator')
{
unlink("results/".$which."_".$when2d.".txt");
copy($resultsfile, "results/".$which."_".$when2d.".txt");
unlink($resultsfile);
$errormessage[]="there was already a results file for this party but since you're so leet and all i replaced it.";
} else {
$errormessage[]="there is already an nfo file for this prod";
}
}
// check if there are any prods from this party year
$query = "SELECT count(0) FROM prods WHERE party=".$which." AND party_year=".$when;
$result = mysql_query($query);
if(!mysql_result($result,0))
$errormessage[] = "Why do you want to submit results for a year of a party with no prods on the database? (\/) Oo (\/)";
// check the nfo file
if(filesize($nfofile)>65536) {
$errormessage[]="the size of the infofile must not be greater than 64Kb";
}
// if everything is ok
if(!$errormessage)
$submitok=true;
}
if(!$submitok&&file_exists($resultsfile)){
unlink($resultsfile);
}
// move the submitted nfo to the appropriate location
if($submitok){
copy($resultsfile, "results/".$which."_".$when2d.".txt");
unlink($resultsfile);
}
?>