require("include/top.php");
if($whichwhen)
{
list($which,$when) = explode("|",$whichwhen);
}
$when = intval($when);
if ($when < 50) {
$when += 2000;
} elseif ($when < 100) {
$when += 1900;
}
unset($submitok);
// check the submitted data
if($zxdemoflag)
{
// check user account
if(!$_SESSION["SESSION"]||!$_SESSION["SCENEID"])
$errormessage[]="you need to be logged in first.";
// check if this event exists
$query = "SELECT count(0) FROM prods WHERE party=".$which." AND party_year=".$when;
$result = mysql_query($query);
if(!mysql_result($result,0))
$errormessage[] = "Try with an event that actually took place will yah? (\/) o_O (\/) *clack*";
// check if zxdemo for this prod already exists
$query = "SELECT zxdemo FROM partylinks WHERE party=".$which." and year=".$when;
$result = mysql_query($query);
if(mysql_result($result,0)>0)
$errormessage[] = "zxdemo for this event already exists! (\/) O_o (\/)";
// if everything is ok
if(!$errormessage)
$submitok=true;
}
if($submitok){
$query = "SELECT id FROM partylinks WHERE party=".$which." and year=".$when;
$result = mysql_query($query);
$thisid = mysql_result($result,0);
if($thisid)
{
$query ="UPDATE partylinks SET zxdemo='".$zxdemoflag."' where id=".$thisid;
mysql_query($query);
}
else
{
$query ="INSERT INTO partylinks SET party=".$which.", year=".$when.", zxdemo='".$zxdemoflag."'";
mysql_query($query);
}
}
?>