<?

require_once("include/bittorrent.inc.php");

dbconn();

loggedinorreturn();

stdhead("Upload");

?>
<SCRIPT LANGUAGE="JavaScript">

var max=1500;  		// 1500 caractères maximum

function compter(f) {
	var txt=f.descr.value;
	var nb=txt.length;
	if (nb>max) { 
		alert("You are limited to "+max+" characters for comments !");
		f.zone.value=txt.substring(0,max);
		nb=max;
	}
	f.nbcar.value=nb;
}

function timer() {
	compter(document.forms["form1"]);
	setTimeout("timer()",100);
}

</SCRIPT>
<body onload="setTimeout('timer()',100)">



<form enctype="multipart/form-data" action="takeupload.php" method="post" name="form1">
<input type="hidden" name="MAX_FILE_SIZE" value="<?=$max_torrent_size?>" />
<p>The tracker's announce url is <b><?= $announce_urls[0] ?></b></p>
<p>You can upload torrents from external trackers , but please do so only if you are seeding them !</p>
<p><b>Only upload torrents you're going to seed!</b> Uploaded torrents won't be visible on the main page until you start seeding them.</p>
<table class="table1" border="2" cellspacing="0" cellpadding="5">
<?

tr("Upload file", "<input class=\"input\" type=\"file\" name=\"file\" size=\"60\" />\n", 1);
tr("Torrent name", "<input class=\"input\" type=\"text\" name=\"name\" size=\"80\" /><br />(Taken from filename if not specified. <b>Please use descriptive names.</b>)\n", 1);
tr("Description<br />(no html allowed)", "<textarea class=\"input\" name=\"descr\" rows=\"10\" cols=\"80\" onkeypress=\"compter(this.form)\"></textarea><br/>You are currently using : <INPUT type=\"text\" name=\"nbcar\" size=3> characters out of 1500 authorized !", 1);

$s = "<select class=\"input\" name=\"type\">\n<option value=\"0\">(choose one)</option>\n";

$cats = genrelist();
foreach ($cats as $row)
	$s .= "<option value=\"" . $row["id"] . "\">" . htmlspecialchars($row["name"]) . "</option>\n";

$s .= "</select>\n";
tr("Type", $s, 1);

?>
<tr><td align="center" colspan="2"><input class="input" type="submit" value="Do it!" /></td></tr>
</table>
</form>
<?

stdfoot();

?>

