Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <center>
- <form action="<?php $_SERVER['PHP_SELF'] ?>" method ="POST">
- <table>
- <tr>
- <td class=list align=right><p>User ID: </p></td>
- <td class=list><input type=text name=username maxlength="12"></td>
- </tr>
- <tr>
- <td class=list align=right><p>Password: </p></td>
- <td class=list><input type=password name=pass maxlength="12"></td>
- </tr>
- <tr>
- <td class=list align=right><p>Retype Password: </p></td>
- <td class=list><input type=password name=vpass maxlength="12"></td>
- </tr>
- <tr>
- <td class=list align=right><p>Email: </p></td>
- <td class=list><input type=text name=email maxlength="50"></td>
- </tr>
- <tr>
- <td class=list align=right><p>Birthdate: <br><font size="1"><i></i></font></p></td>
- <td class=list><input type=text name=dob maxlength="15"></td>
- </tr>
- <tr>
- <br><td><input align = "center" type="submit" name = "sub" value="Complete registration" />
- </tr>
- </form></center>
- <?php
- if(isset($_POST['sub'])){
- $username = addslashes($_POST['username']);
- $password = $_POST['pass'];
- $password2 = $_POST['vpass'];
- $email = addslashes($_POST['email']);
- $birthdate = addslashes($_POST['dob']);
- $dbhost = "localhost"; // put your host here
- $dbuser= "root"; // db user here
- $dbpass= ""; //dbpass here
- $dbname= "test";
- $table= "giac_test"; //table name here
- mysql_connect("localhost", "root", "") or die ("error");
- mysql_select_db("test") or die ("Error with db!");
- $error = array();
- if (empty($username))
- $error[] = "You must enter a username. <br/>";
- if (empty($password))
- $error[] = "You must enter a password. <br/>";
- if (empty($password2))
- $error[] = "Please enter your password a second time. <br/>";
- if (empty($email))
- $error[] = "You must enter an email address. <br/>";
- if (empty($birthdate))
- $error[] = "You must enter your BirthDate. <br/>";
- if ($password != $password2){
- $error[] = "Your passwords do not match!<br/>";
- }
- foreach ($error as $err){
- echo $err;
- if (!$err){
- mysql_query("INSERT INTO $table (`id`, `username`, `password`, `email`, `date`) VALUES (
- '',
- '".$username."',
- '".md5($password)."',
- '".$email."',
- '".time()."'
- )") or die(mysql_error());
- echo "Registration Successful!";
- }else
- echo "Fail";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement