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($dir)
{
// check user account
if(!$_SESSION["SESSION"]||!$_SESSION["SCENEID"])
$errormessage[]="you need to be logged in first.";
// check if there already exists a download directory
$query = "SELECT download FROM partylinks WHERE party=".$which." and year=".$when;
$result = mysql_query($query);
if(mysql_result($result,0))
$errormessage[] = "download dir for this party year already exists";
// if everything is ok
if(!$errormessage)
$submitok=true;
}
// submit the info
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 download='".$dir."' where id=".$thisid;
mysql_query($query);
}
else
{
$query ="INSERT INTO partylinks SET party=".$which.", year=".$when.", download='".$dir."'";
mysql_query($query);
}
}
?>