<?

require_once("include/bittorrent.php");

hit_start();

function bark($msg) {
    genbark($msg, "Änderung fehlgeschlagen!");
}

if (!mkglobal("id:descr:streamer:streamnr"))
    bark("Fehlende Formulardaten!");

$id = 0 + $id;
if (!$id)
    die();

dbconn();

hit_count();

loggedinorreturn();

$res = mysql_query("SELECT * FROM stream WHERE id = $id");
$row = mysql_fetch_array($res);
if (!$row)
    die();

   $cat = 0 + $_POST["type"];
   $cat1 = 0 + $_POST["type1"];
   $cat2 = 0 + $_POST["type2"];
   $cat3 = 0 + $_POST["type3"];
   $cat4 = 0 + $_POST["type4"];
   $cat5 = 0 + $_POST["type5"];
   $addedby = $CURUSER["id"];


if ($CURUSER["id"] != $row["addedby"] && get_user_class() < UC_MODERATOR)
    bark("Das bist nicht berechtigt! Wie konnte das passieren?\n");

$updateset = array();

$updateset[] = "tage = " . $cat;
$updateset[] = "days = " . $cat1;
$updateset[] = "months = " . $cat2;
$updateset[] = "years = " . $cat3;
$updateset[] = "hours = " . $cat4;
$updateset[] = "minutes = " . $cat5;
$updateset[] = "streamer = " . sqlesc($streamer);
$updateset[] = "streamnr = " . sqlesc($streamnr);
$updateset[] = "addedby = " . sqlesc($addedby);
$updateset[] = "descr = " . sqlesc($descr);


mysql_query("UPDATE stream SET " . join(",", $updateset) . " WHERE id = $id");

$returl = "sendeplan.php";
if (isset($_POST["returnto"]))
    $returl .= "&returnto=" . urlencode($_POST["returnto"]);
header("Refresh: 0; url=$returl");

hit_end();

?>