<?
include("connect.inc");
include("reqlogin.inc");
include("userprefs.inc");
?>
<html>
<title>Mozart: Add New User</title>
<body bgcolor=<? echo $bgcolor ?> text=<? echo $txtcolor ?>>
<?
include("links.inc");
$Input_Error = 1;
if ($submit) {
if (!($NewID)) {
$Message = "System ID is required";
$Input_Error = 0;
}
if (!($Password)) {
$Message = "Password is required";
$Input_Error = 0;
}
if (!($Password == $Verify)) {
$Message = "Password and verification do not match";
$Input_Error = 0;
}
}
if (($Input_Error == 1) and ($submit)) {
$salt = "mz";
$EncryptPass = crypt($Password, $salt);
$CalledFromAddUser = "Y";
$CNTType = 2;
include("inscontact.php");
$InsUserSQL = "INSERT INTO users (user_id, system_id, password, gmail, bgcolor, txtcolor, bordercolor, admin, assistant) VALUES ('$NewContactID', '$NewID', '$EncryptPass', '$Gmail', '$BGcolor', '$Textcolor', '$Bordercolor', '$Admin', '$Assist')";
$InsUser = mysql_query($InsUserSQL);
$NewAssistID = mysql_insert_id($db);
$errno = mysql_errno($db);
$error = mysql_error($db);
if (!($errno == 0)) {
$Message = "Error at users %errno: %error";
}
else {
$Message = "User Added Successfully";
}
if ($Assist) {
$Assist = "Y";
$InsUserXAssistSQL = "INSERT INTO userxassist (userxassist_id, assist_id, owner_id) VALUES (NULL, '$NewContactID', '$ForUser')";
$InsUserXAssist = mysql_query($InsUserXAssistSQL);
$errno = mysql_errno($db);
$error = mysql_error($db);
if (!($errno == 0)) {
$Message = "Error at userxassist $errno: $error";
}
else {
$Message = "User Added Successfully";
}
}
else {
$Assist = "N";
}
}
elseif (!($Message)) {
$Message = "Ready to add new user";
}
?>
<center>
Add New User
<br>
<?
print("<font color=red>$Message</font>");
include("newcontact.frm");
include("links.inc");
?>
</center>
</body>
</html>