} else { $errorstring .= "You must provide an email address!<br />\n"; } if ($errorstring == "") { // No errors encountered so far, attempt to register if (THprofile_regpolicy == 1) { $initial_status = 0; // pending admin approval } else { $initial_status = 1; // automatically approved } $actionstring = "Register\tname:" . $username; writelog($actionstring, "profiles"); // I believe this returns non-null on a successful query, so... $fail = $db->registeruser($username, $password, THprofile_userlevel, $email, $initial_status); if ($fail == null) { $errorstring .= "Database error.<br />\n"; } else { $success = 1; } } } $sm = sminit("register.tpl", null, "profiles", false, false); $sm->assign("success", $success); $sm->assign("errorstring", $errorstring); $sm->assign("regpolicy", THprofile_regpolicy); $sm->assign("emailwelcome", THprofile_emailwelcome); // Set the username for the Smarty template if we succeeded if ($success == 1) { $sm->assign("username", $username);
if (isset($_POST['email']) && strlen($email)) { /* Check if valid email address */ if (!validateemail($email)) { $errorstring .= "You must provide a valid email address!<br />\n"; } // Check if it exists already if ($profile_dbi->emailexists($email) == true) { $errorstring .= "That email has already been used to register an account!<br />\n"; } } else { $errorstring .= "You must provide an email address!<br />\n"; } // No errors encountered so far, attempt to register if ($errorstring == "") { // Insert them, with approval from the beginning (hence the 1 at the end) $profile_dbi->registeruser($username, $password, THprofile_userlevel, $email, 1); $actionstring = "Add user\tname:" . $username; writelog($actionstring, "admin"); //header("Location: ".THurl."admin.php?a=p"); //Forward them to the newly created profile - this will hopefully get rid of confusion on whether or not the profile was created. header("Location: " . THurl . "profiles.php?action=viewprofile&user="******"Username field must not be blank."); } elseif ($_GET['t'] == "spa") { // verify parameters if (!isset($_POST['name']) || !isset($_POST['title'])) { THdie("Name and/or title parameter not specified!"); }