Location: PHPKode > projects > phpBandwidth > phpbandwidth/user_add.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_add_user($conn, $name, $limit))
		echo "Error adding user!";
	echo "<h2>User added</h2>";
	$name = "";
	$limit= "";
}
?>
<h2>Add 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="step_2" value="1">
<input type="submit" value="Add user">
</form></td><td>
<form action="./user_configure.php" method="post">
<input type="submit" value="Return">
</form></td></tr></table>

Return current item: phpBandwidth