Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "<h1>Register</h1>";
- $submit = strip_tags($_POST['submit']);
- $name = strip_tags($_POST['name']);
- $email = strip_tags($_POST['email']);
- $username = strip_tags($_POST['username']);
- $password = strip_tags($_POST['password']);
- $password2 = strip_tags($_POST['password2']);
- $date = date("Y-m-d");
- if ($submit) {
- // check if user is already in database
- // check for existance
- if ($username&&$password&&$password2&&$name&&$email) {
- // encrypt password
- // check if passwords match
- if ($password==$password2) {
- //check if password is too small
- if (strlen($password)<6) {
- echo "Password must be longer then 6 chars";
- } else {
- $password = md5($password);
- $password2 = md5($password2);
- // Open Database
- $connect = mysql_connect("mysql.freezoka.net","u436088065_helge ","toribash123") or die(mysql_error());
- mysql_select_db("u436088065_phplogin") or die(mysql_error());
- $query = mysql_query("INSERT INTO users VALUES('','$username','$password','$name','$date','$email')");
- die("User $username has been registered!<br /> <a href='index.php'>Click here</a> to log in!");
- }
- } else {
- echo "Your passwords does not match!";
- }
- } else {
- echo "Please fill in all the fields!";
- }
- }
- ?>
- <html>
- <head>
- <title>Register</title>
- </head>
- <body>
- </p>
- <form action="register.php" method="POST">
- <table border="0">
- <tr>
- <td>Name:</td>
- <td><input type="text" maxlength="40" name="name" value="<?php echo $name; ?>" /></td>
- </tr>
- <tr>
- <td>Email:</td>
- <td><input type="text" maxlength="60" name="email" value="<?php echo $email; ?>" /></td>
- </tr>
- <tr>
- <td>Username:</td>
- <td><input type="text" maxlength="20" name="username" value="<?php echo $username; ?>" /></td>
- </tr>
- <tr>
- <td>Password:</td>
- <td><input type="password" name="password" /></td>
- </tr>
- <tr>
- <td>Password Again:</td>
- <td><input type="password" name="password2" /></td>
- </tr>
- <tr>
- <td colspan="2"> <input type="submit" value="Register!" name="submit" />
- </tr>
- </table>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement