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($_POST["artcitytags"])
{
// 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 artcity FROM partylinks WHERE party=".$which." and year=".$when;
$result = mysql_query($query);
if(mysql_result($result,0))
$errormessage[] = "artcity 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 artcity='".mysql_real_escape_string($_POST["artcitytags"])."' where id=".$thisid;
mysql_query($query);
}
else
{
$query ="INSERT INTO partylinks SET party=".$which.", year=".$when.", artcity='".mysql_real_escape_string($_POST["artcitytags"])."'";
mysql_query($query);
}
}
?>