Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <? php
- $submit = ($_POST['submit']);
- //form data
- $firstname = strip_tags($_POST['firstname']);
- $surname = strip_tags($_POST['surname']);
- $username = ($_POST['username']);
- $password = strip_tags($_POST['password']);
- $confirmpassword = strip_tags($_POST['confirmpassword']);
- $daate = date("y-m-d");
- if ($submit)
- {
- //check for existance
- if ($firstname&&$surname&&$username&&$password&&$confirmpassword);
- {
- if ($password==$confirmpassword);
- {
- //check char length of username and fullname
- if (strlen($username)>25||strlen($firstname)>25)
- {
- echo "Length of Username or First name is too long";
- }
- else
- {
- //check password length
- if (strlen($password)>25||strlen($password)<6)
- {
- echo "Password must be between 6 and 25 characters";
- }
- else
- {
- //register the user
- //encrypt password
- $password = md5($password);
- $confirmpassword = md5($confirmpassword);
- //open database
- $connect = mysql_connect("mysql11.000webhost.com","a4264749_login","billyjoe16");
- mysql_select_db("a4264749_login"); //select database
- $queryreg = mysql_query("INSERT INTO users VALUES ('$name','$surname','$username','$password','$date')");
- die ("You have been registered! <a href='login.html'>Click here</a>to login ");
- }
- }
- }
- {
- else
- echo "Your passwords do not match!";
- }
- {
- }
- {
- else
- echo "Please fill in <b>all</b> fields!";
- }
- }
- }
- ?>
- <html>
- <head>
- <style type="text/css">
- a:link {color:blue;text-decoration:none;}
- a:visited {color:red;text-decoration:none;}
- a:hover {color:orange;text-decoration:underline;}
- </style>
- </head>
- <body>
- <p>
- <form action='register.php' nethod='POST'>
- <table>
- <td>
- <tr>
- First Name
- </tr>
- <tr>
- <input type='text' name='first name' value='<?php echo $firstname ?>'
- </td><br>
- <tr>
- Surname
- </tr>
- <tr>
- <input type='text' name='surname' value='<?php echo $surname ?>'
- </tr><br>
- <tr>
- Desired Username:
- </tr>
- <tr>
- <input type='text' name='username' value='<?php echo $username ?>'
- </tr><br>
- <tr>
- Choose a password:
- </tr>
- <tr>
- <input type='password' name='password'>
- </tr>
- <br>
- <tr>
- Confirm password:
- </tr>
- <tr>
- <input type='password' name='confirm password'>
- </tr>
- <br>
- <input type='submit' name='submit' value='Register'>
- </td>
- </table>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement