<?
require "include/bittorrent.php";
dbconn();
loggedinorreturn();
if (get_user_class() < UC_MODERATOR)
stderr("Error", "Access denied.");
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if ($_POST["username"] == "" || $_POST["invites"] == "" || $_POST["invites"] == "")
stderr("Error", "Missing form data.");
$username = sqlesc($_POST["username"]);
$invites = sqlesc($_POST["invites"]);

mysql_query("UPDATE users SET invites=$invites WHERE username=$username") or sqlerr(__FILE__, __LINE__);
$res = mysql_query("SELECT id FROM users WHERE username=$username");
$arr = mysql_fetch_row($res);
if (!$arr)
stderr("Error", "Unable to update account.");
header("Location: $BASEURL/userdetails.php?id=$arr[0]");
die;
}
stdhead("Update Invites");
?>

<table cellpadding="4" cellspacing="1" border="0" style="width:750px" class="tableinborder">
 <tr class="tabletitle" width="100%">
  <td colspan="10" width="100%"><span class="normalfont"><center><b>Invites vergeben</b></center></span></td> 
 </tr><tr><td width="100%" class="tablea">
<form method=post action=inviteadd.php>
<table border=0 cellspacing=0 cellpadding=5>
<tr><td class=tablea>Benutzername</td><td><input type=text name=username size=40></td></tr>
<tr><td class=tablea>Invites</td><td><input type=uploaded name=invites size=5> (Hier die Gesamtzahl der Invites eingeben die der User haben soll.)</td></tr>
<tr><td colspan=2 align=center><input type=submit value="Okay" class=btn></td></tr>
</table>
</form>
<? stdfoot(); ?>