Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('class.php');
- if (isset($_POST['submit'])){
- if (empty($_POST['email']) || empty($_POST['username']) || empty($_POST['password1']) || empty($_POST['password'])){
- echo "<p style='color:red'>Fill all required fields</p>";
- }
- elseif ($_POST['password1'] != $_POST['password']) {
- echo "<p style='color:red'>Passwords do not match</p>";
- }
- else{
- if (strpos($_POST['email'],'.') < 1 or strpos($_POST['email'],'@') < 1){
- echo "<p style='color:red'>Enter a valid email address</p>";
- }
- else{
- $user = new User();
- $email = $user->escapeInput($_POST['email']);
- $username = $user->escapeInput($_POST['username']);
- $password = sha1($user->escapeInput($_POST['password']));
- if ($user->register($email,$username,$password)){
- header("Location:login_html.php");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment