require("include/top.php");
unset($submitok);
// check the submitted data
if(is_uploaded_file($nfofile))
{
// 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("nfo/".$which.".nfo"))
{
if($SESSION_LEVEL=='administrator' || $SESSION_LEVEL=='moderator' || $SESSION_LEVEL=='gloperator')
{
unlink("nfo/".$which.".nfo");
copy($nfofile,"nfo/".$which.".nfo");
unlink($nfofile);
$errormessage[]="there was already an infofile for this prod but since you're so strong and handsome i allowed you to caress my tail and replace it.";
} else {
$errormessage[]="there is already an nfo file for this prod";
}
}
// check if this prod exists
$query = "SELECT count(0) FROM prods WHERE id=".$which;
$result = mysql_query($query);
if(!mysql_result($result,0))
$errormessage[] = "I can't find this prod o_O";
// check the nfo file
if(filesize($nfofile)>32768) {
$errormessage[]="the size of the infofile must not be greater than 32Kb";
}
// if everything is ok
if(!$errormessage)
$submitok=true;
}
if(!$submitok&&file_exists($nfofile)){
unlink($nfofile);
}
// move the submitted nfo to the appropriate location
if($submitok){
copy($nfofile, "nfo/".$which.".nfo");
unlink($nfofile);
// reward the user
$query ="INSERT INTO nfos SET ";
$query.="prod=".$which.",";
$query.="user=".$_SESSION["SCENEID_ID"].",";
$query.="added=NOW()";
mysql_query($query);
}
?>