session_start();
if (!session_is_registered("LLC"))
{
// if session check fails, invoke error handler
header("Location: ../loginform.php");
exit();
}
$user = $_SESSION['UNAME'];
$mmuser = trim($_POST['username']);
$pass1 = trim($_POST['pass1']);
$Pass2 = trim($_POST['pass2']);
if ($mmuser == '')
{
print "
You must enter the user name. Please go back and try again.
";
exit();
}
if (strlen($pass1) < 3)
{
print "Your password must be at least 3 letters/digits. Please go back and try again.
";
exit();
}
if ($pass1 != $pass2)
{
print "Your password is not confirmed. Please go back and try again.
";
exit();
}
include("../include/dbconfig.php");
$connection = mysql_connect($db_host, $db_user, $db_pass) or die ("Unable to connect!");
mysql_select_db($db_name);
$query = "insert into MM_user set UserName='$mmuser', Password=Password('$pass1')";
$result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
header("Location: adduser.php");
exit();
?>