<?
require "include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_MODERATOR)
stderr("Error", "Verlaufen?");
$action = $_GET["action"];
if ($action == 'delete')
{
$id = $_GET["id"];
if (!is_valid_id($id))
stderr("Error","Not true id");
$returnto = $_GET["returnto"];
$sure = $_GET["sure"];
if (!$sure)
stderr("Löschen?","Wirklich löschen? Drücke\n" .
"<a href=?action=delete&id=$id&returnto=$returnto&sure=1>Hier</a> wenn du dir sicher bist....");
mysql_query("DELETE FROM indexrelases WHERE id=$id") or sqlerr(__FILE__, __LINE__);
if ($returnto != "")
header("Location: $returnto");
else
$warning = "It is successfully removed.";
}
if ($action == 'edit')
{
$id = (int) $_GET["id"];
if (!is_valid_id($id))
stderr("Error","Not true id");
$res = mysql_query("SELECT * FROM indexrelases WHERE id=$id") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) != 1)
stderr("Error", "There is no release with ID $id.");
$arr = mysql_fetch_array($res);
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$name = $_POST['name'];
if ($name == "")
stderr("Error", "Name des Kinofilms?!");
//$date = $_POST['date'];
//if ($date == "")
//stderr("Error", "Kinostart?!");
$cat = $_POST['cat'];
$poster = $_POST['poster'];
$opisalovo = $_POST['opisalovo'];
if ($poster == "")
stderr("Error", "Coverlink??!");
$zanr = $_POST['zanr'];
if ($zanr == "")
stderr("Error", "Genre??!");
$reziser = $_POST['reziser'];
if ($reziser == "")
stderr("Error", "Regisseur?!");
$vroliah = $_POST['vroliah'];
if ($opisalovo == "")
stderr("Error", "Beschreibung?!");


$url = $_POST['url'];
if ($url == "")
stderr("Error", "Enter URL Release?!");
$imd = $_POST['imd'];

$cat = sqlesc($cat);
$poster = sqlesc($poster);
$name = sqlesc($name);
//$date = sqlesc($date);
$zanr = sqlesc($zanr);
$reziser = sqlesc($reziser);
$vroliah = sqlesc($vroliah);
$opisalovo = sqlesc($opisalovo);
$kacestvo = sqlesc($kacestvo);
$video = sqlesc($video);
$audio = sqlesc($audio);
$time = sqlesc($time);
$lang = sqlesc($lang);
$url = sqlesc($url);
$imd = sqlesc($imd);

mysql_query("UPDATE indexrelases SET cat=$cat,poster=$poster,name=$name,zanr=$zanr,
reziser=$reziser,vroliah=$vroliah,opisalovo=$opisalovo,kacestvo=$kacestvo,
audio=$audio,time=$time,lang=$lang,url=$url,imd=$imd WHERE id=$id") or sqlerr(__FILE__, __LINE__);
$returnto = $_POST['returnto'];
if ($returnto != "")
header("Location: $returnto");
else
$warning = "Error,Error..........";
}
else
{
$returnto = $_GET['returnto'];
stdhead();
begin_frame("To edit");
print("<form method=post action=?action=edit&id=$id>\n");
print("<table border=0 cellspacing=0 cellpadding=5>\n");
print("<tr><td><input type=hidden name=returnto value=$returnto></td></tr>\n");
print("<tr><td>Name des Kinofilms und Kinostart<font color=#ff0000>*</font></td><td colspan=2 align=left><input type=text size=60 name=name value=\"" . htmlspecialchars($arr["name"]) . "\"><br></tr>\n");
print("<tr><td>Coverlink<font color=#ff0000>*</font></td><td colspan=2 align=left><input type=text size=60 name=poster value=\"" . htmlspecialchars($arr["poster"]) . "\"><br>(Hier ein Cover hochladen <a href=http://img293.imageshack.us>http://img293.imageshack.us</a>)</tr>\n");
print("<tr><td>Genre:<font color=#ff0000>*</font></td><td colspan=2 align=left><input type=text size=60 name=zanr value=\"" . htmlspecialchars($arr["zanr"]) . "\"><br></tr>\n");
print("<tr><td>Regisseur:<font color=#ff0000>*</font></td><td colspan=2 align=left><input type=text size=60 name=reziser value=\"" . htmlspecialchars($arr["reziser"]) . "\"><br></tr>\n");
print("<tr><td>Beschreibung:<font color=#ff0000>*</font></td><td colspan=2 align=left><textarea name=opisalovo rows=8 cols=60>" . htmlspecialchars($arr["opisalovo"]) . "</textarea></tr>\n");
print("<tr><td>Link zum Trailer<font color=#ff0000>*</font></td><td colspan=2 align=left><input type=text size=60 name=url value=\"" . htmlspecialchars($arr["url"]) . "\"> z.B http://www.moviemaze.de
<br></tr>\n");
print("<tr><td>Link IMDB:</td><td colspan=2 align=left><input type=text size=60 name=imd value=\"" . htmlspecialchars($arr["imd"]) . "\"> (http://www.imdb.com/....)
<br></tr>\n");
print("<tr><td align=center><input type=submit value='OK!' class=btn></td></tr>\n");
print("</table>\n");
print("</form>\n");
end_frame();
stdfoot();
die;
}
}


?>