/* New User Registration colin@lavconsulting.com v 1.2 */ require($DOCUMENT_ROOT."/libs/constants.inc"); require($DOCUMENT_ROOT."/classes/userObjects.inc"); $privs = new userPermissions(); $track = new siteTracker($privs->getSessionId(), $privs->getUserId()); $layout = new spudCore(0, 0); if ($submit == "S U B M I T") { $objVal = new validation(); $objVal->check_field("First Name", $firstName, 1, "ALPHA", 1, 30); $objVal->check_field("Last Name", $lastName, 1, "LNAME", 1, 30); $objVal->check_field("User Name", $userName, 1, "ALPHANUM", 1, 30); $objVal->check_unique("User Name", "spud_user", "user_name", $userName); $objVal->check_field("Email Address", $emailAddr, 1, "EMAIL", 1, 60); $objVal->check_field("Password", $password, 1, "ALPHANUM", 1, 30); if ($password != $confirmPass) { $objVal->add_error_msg("Password and confirmation password", "do not match."); } if (trim($firstName) == trim($lastName)) { $objVal->add_error_msg("First name & Last Name","shouldn't be the same."); if ($objVal->num_errors() == 0) { $encodedPass = base64_encode($password); $insertUserQuery = "INSERT INTO spud_user (id, user_name, first_name, last_name, email, password, register_date) VALUES (0, '$userName', '$firstName', '$lastName', '$emailAddr', '$encodedPass', NOW())"; $insertUser = new dbInterface($DB_NAME, $DB_USER, $DB_PASS, $insertUserQuery); $userId = $insertUser->newId(); $insertPrivs = new dbInterface($DB_NAME, $DB_USER, $DB_PASS, "INSERT INTO spud_role_map VALUES ($userId, 4)"); if (sizeof($mailLists) > 0) { foreach ($mailLists as $assignedList) { $listInsertQuery = "INSERT INTO spud_mail_map VALUES ($userId, $assignedList)"; $listInsert = new dbInterface($DB_NAME, $DB_USER, $DB_PASS, $listInsertQuery); } } $mail_result = mail($emailAddr, "Welcome to $SITENAME", "Hey,\nThanks for registering at $SITENAME. Just a reminder, here is your account info:\n\nUser Name: $userName\nPassword: $password $MAIL_FOOTER", "From: $mail_list_from\nReply-To: $mail_list_from"); header("Location: /admin/login.phtml?userName=$userName&password=$password&url=/\n\n"); exit; } else { $errMsg = $objVal->draw_errors(); } $errorText = "$errMsg"; } // Get Dynamic Mailing Lists $mail_query = "SELECT id, description FROM spud_mail ORDER BY id"; $mailDB = new dbInterface($DB_NAME, $DB_USER, $DB_PASS, $mail_query); ?>