<?

require_once("include/bittorrent.php");

hit_start();

if (!mkglobal("id"))
    die();

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

dbconn();

hit_count();

loggedinorreturn();

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

stdhead("Datei " . $row["title"] . " bearbeiten");

if (!isset($CURUSER) || ($CURUSER["id"] != $row["user"] && get_user_class() < UC_MODERATOR)) {
?>
<table cellpadding="4" cellspacing="1" border="0" style="width:650px" class="tableinborder">
 <tr class="tabletitle" width="100%">
  <td colspan="10" width="100%"><span class="normalfont"><center><b> Du darfst diese Datei nicht bearbeiten </b></center></span></td> 
 </tr><tr><td width="100%" class="tablea">Du bist nicht
 der rechtm&auml;&szlig;ige Besitzer, oder Du bist nicht korrekt
 <a href="login.php?returnto=<?=urlencode($_SERVER["REQUEST_URI"])?>&amp;nowarn=1">eingeloggt</a>.
</td></tr></table>
<?
}
else {

    print("<form name=editdata method=post action=takeeditdata.php enctype=multipart/form-data>\n");
    print("<input type=\"hidden\" name=\"id\" value=\"$id\">\n");
    if (isset($_GET["returnto"]))
        print("<input type=\"hidden\" name=\"returnto\" value=\"" . htmlspecialchars($_GET["returnto"]) . "\" />\n");
?>
<br>
<table cellpadding="4" cellspacing="1" border="0" style="width:650px" class="tableinborder">
 <tr class="tabletitle" width="100%">
  <td colspan="10" width="100%"><span class="normalfont"><center><b>Datei <?=$row["title"]?> bearbeiten</b></center></span></td> 
 </tr>
<?      
    tr("Datei", "<input type=radio name=fileaction value='keep' checked>Aktuelle beibehalten<br>".
    "<input type=radio name=fileaction value='update'>Ändern:<br><input type=file name=file size=60>", 1);  
    tr("Name", "<input type=\"text\" name=\"title\" value=\"" . htmlspecialchars($row["title"]) . "\" size=\"80\" />", 1);
        tr("Beschreibung", "<input type=\"text\" name=\"descr\" value=\"" . htmlspecialchars($row["description"]) . "\" size=\"80\" />", 1);


    print("<tr><td class=\"tableb\" colspan=\"2\" align=\"center\"><input type=\"submit\" value='Ändern!' style='height: 25px; width: 100px'> <input type=reset value='Verwerfen' style='height: 25px; width: 100px'></td></tr>\n");
    print("</table>\n");
    print("</form>\n");
    print("<br>\n");

}

stdfoot();

hit_end();

?>