Connected successfully} 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.'; } $items = file($database, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach($items as $line) { list($username, $password, $email, $fullname) = explode('|', trim($line)); if ($newusername == $username) { $error_message = 'Username already used. Please select another username.'; break; } } if (empty($error_message)) { $file = fopen($database, 'a'); fwrite($file, $newusername); fwrite($file, '|'); fwrite($file, md5($newpassword)); fwrite($file, '|'); fwrite($file, $newemail); fwrite($file, '|'); fwrite($file, $newfullname); fwrite($file, '|1|'); fwrite($file, $code); fwrite($file, "\r\n"); fclose($file); $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@IMENGOZAR.COM"."\r\n"; $header .= "Reply-To: webmaster@IMENGOZAR.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); mail('ADMIN@IMENGOZAR.COM', $subject, $message, $header); header('Location: '.$success_page); exit; } } ?> form_signup_fa

فرم عضویت
نام کاربری
رمز عبور
تکرار رمز
ایمیل
نام اصلی