'; $mysql_database = 'hinesvi1_members'; $mysql_table = 'user'; $success_page = ''; $error_message = ""; if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['form_name'] == 'signupform') { $newusername = $_POST['username']; $newemail = $_POST['email']; $newpassword = $_POST['password']; $confirmpassword = $_POST['confirmpassword']; $newfullname = $_POST['fullname']; $code = 'NA'; if ($newpassword != $confirmpassword) { $error_message = 'Password and Confirm Password are not the same!'; } else if (!preg_match("/^[A-Za-z0-9_!@$]{1,50}$/", $newusername)) { $error_message = 'Username is not valid, please check and try again!'; } else if (!preg_match("/^[A-Za-z0-9_!@$]{1,50}$/", $newpassword)) { $error_message = 'Password is not valid, please check and try again!'; } else if (!preg_match("/^[A-Za-z0-9_!@$.' &]{1,50}$/", $newfullname)) { $error_message = 'Fullname is not valid, please check and try again!'; } else if (!preg_match("/^.+@.+\..+$/", $newemail)) { $error_message = 'Email is not a valid email address. Please check and try again.'; } if (empty($error_message)) { $db = mysql_connect($mysql_server, $mysql_username, $mysql_password); if (!$db) { die('Failed to connect to database server!
'.mysql_error()); } mysql_select_db($mysql_database, $db) or die('Failed to select database
'.mysql_error()); $sql = "SELECT username FROM ".$mysql_table." WHERE username = '".$newusername."'"; $result = mysql_query($sql, $db); if ($data = mysql_fetch_array($result)) { $error_message = 'Username already used. Please select another username.'; } } if (empty($error_message)) { $crypt_pass = md5($newpassword); $newusername = mysql_real_escape_string($newusername); $newemail = mysql_real_escape_string($newemail); $newfullname = mysql_real_escape_string($newfullname); $sql = "INSERT `".$mysql_table."` (`username`, `password`, `fullname`, `email`, `active`, `code`) VALUES ('$newusername', '$crypt_pass', '$newfullname', '$newemail', 1, '$code')"; $result = mysql_query($sql, $db); mysql_close($db); $subject = 'Your new account'; $message = 'A new account has been setup.'; $message .= "\r\nUsername: "; $message .= $newusername; $message .= "\r\nPassword: "; $message .= $newpassword; $message .= "\r\n"; $header = "From: webmaster@yourwebsite.com"."\r\n"; $header .= "Reply-To: webmaster@yourwebsite.com"."\r\n"; $header .= "MIME-Version: 1.0"."\r\n"; $header .= "Content-Type: text/plain; charset=utf-8"."\r\n"; $header .= "Content-Transfer-Encoding: 8bit"."\r\n"; $header .= "X-Mailer: PHP v".phpversion(); mail($newemail, $subject, $message, $header); header('Location: '.$success_page); exit; } } ?> Untitled Page

Sign up for a new account
Full Name:
User Name:
Password:
Confirm Password:
E-mail: