Location: PHPKode > projects > phpBandwidth > phpbandwidth/user_edit.php
<?
// phpbandwith by Alexander Wigen
include("db_config.php");
include("db_$db[type].php");
if (array_search($REMOTE_ADDR, $phpbandwidth[trusted_ips]) === FALSE){
	echo "Security violation";
	exit;
}

$conn = db_connect();
if ($conn === FALSE)
{
	echo "Cant connect to the database, have you connfigured it at <a href=\"db_install.php\">db_install.php</a> ?";
	exit;
}
include("header.php");

if ($step_2 && strlen($name) < 1)
	echo "<font color=\"red\">Please provide a username</font>";
else if ($step_2 && ! is_numeric($limit))
	echo "<font color=\"red\">Limit must be numeric</font>";
else if ($step_2)
{
	if (!db_edit_user($conn, $uid, $name, $limit))
		echo "Error editing user!";
	echo "<h2>User edited</h2>";
	$name = "";
	$limit= "";
}
$users = db_get_users($conn);
$name = $users[$uid];
$limit = db_get_user_download_limit($conn, $uid);
?>
<h2>Edit user</h2>
<form action="<?=$PHP_SELF?>" method="post">
<table border=0><tr>
<td align="right">Name</td>
<td><input name="name" type="text" value="<?=$name?>"></td></tr>
<tr><td>Bandwidth Limit</td>
<td><input name="limit" type="text" size=5 dir="rtl" maxlength=8 value="<?=$limit?>">Mega Bytes</td></tr>
</table><table border=0><tr><td>
<input type="hidden" name="uid" value="<?=$uid?>">
<input type="hidden" name="step_2" value="1">
<input type="submit" value="Edit user">
</form></td><td>
<form action="./user_configure.php" method="post">
<input type="submit" value="Return">
</form></td></tr></table>

Return current item: phpBandwidth