Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "<h1>Register</h1>";
- $submit = ($_POST['submit']);
- $fullname = strip_tags($_POST['fullname']);
- $username = strip_tags($_POST['username']);
- $password = strip_tags($_POST['password']);
- $repeatpassword = strip_tags($_POST['repeatpassword']);
- $date = ('Y-m-d');
- if ($submit) {
- // Check to see if they are in database already
- if($fullname&&$username&&$password&&$repeatpassword) {
- if ($password==$repeatpassword) {
- // check char lenght of username and fullname
- if (strlen($username)>25||strlen($fullname)>25)
- {
- echo "Full name or Username is too long!";
- }
- else
- {
- // check lenght of password
- if (strlen($password)>25||strlen($password)<6)
- {
- echo "Password <strong>Must</strong> be between 6 and 25 characters";
- }
- else {
- // Register Users
- echo "Success";
- $password = md5($password);
- $repeatpassword = md5($repeatpassword);
- // Open Database
- $connect = mysql_connect("localhost","root","");
- mysql_select_db("hub");
- // Generator random number, for activation.
- $random = rand(23456789,98765432);
- $queryreg = mysql_query("
- INSERT INTO users VALUES ('','$fullname','$username','$password','$date','$random','0')
- ");
- die("Well done, Your account have been created, return to <a href='index.php'>login</a>");
- }
- }
- }
- else
- echo "Your password don't match!";
- }
- else
- echo "Please fill in <strong>all</strong> fields.";
- }
- ?>
- <!DOCTYPE html>
- <html lang="">
- <head>
- <meta charset="utf-8">
- <title></title>
- <meta name="description" content="" />
- <meta name="keywords" content="" />
- <meta name="robots" content="" />
- </head>
- <body>
- <form action='register.php' method='post'>
- <label>Full Name</label><input type='text' name='fullname' value='<?php echo $fullname; ?>'>
- <label>Choose Username</label><input type='text' name='username' value='<?php echo $username; ?>'>
- <label>Choose Password</label><input type='password' name='password'>
- <label>Repeat Password</label><input type='password' name='repeatpassword'>
- <input type='submit' name='submit' value='Register'>
- </form>
- </body>
- </html>
Add Comment
Please, Sign In to add comment