Advertisement
ashyibowong

registration

Apr 21st, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Register</title>
  5. <meta charset="utf-8"/>
  6. <title>Login</title>
  7. <link rel="stylesheet" href="css/reset.css"/>
  8. <link rel="stylesheet" href="css/960.css"/>
  9. <link rel="stylesheet" href="css/main.css"/>
  10. </head>
  11. <body>
  12. <div class="header">
  13. <div class="container_12">
  14. <div class="grid_12">
  15. <h1 class="knobcloud-header">KNOBCLOUD</h1>
  16. </div>
  17. </div>
  18. </div>
  19. <p><a href="register.php">Register</a> | <a href="login.php">Login</a></p>
  20. <h3>Registration Form</h3>
  21. <form action="" method="POST">
  22. username: <input type="text" name="user"><br />
  23. password: <input type="password" name="pass"><br />
  24. <input type="submit" value="register" name="submit" />
  25. </form>
  26. <div class="body">
  27. <div class="container_12">
  28. <div class="grid_12">
  29. <div id="body">
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. <?php
  35.  
  36. if(isset($_POST["submit"])){
  37.  
  38. if(!empty($_POST['user']) && !empty($_POST['pass'])) {
  39. $user=$_POST['user'];
  40. $pass=$_POST['pass'];
  41.  
  42. $con=mysql_connect('localhost','root','') or die(mysql_error());
  43. mysql_select_db('user_registration') or die("cannot select DB");
  44.  
  45. $query=mysql_query("SELECT * FROM login WHERE username='".$user."'");
  46. $numrows=mysql_num_rows($query);
  47. if($numrows==0)
  48. {
  49. $sql="INSERT INTO login(username,password) VALUES('$user','$pass')";
  50.  
  51. $result=mysql_query($sql);
  52.  
  53.  
  54. if($result){
  55. echo "Account Successfully Created";
  56. } else {
  57. echo "Failure!";
  58. }
  59.  
  60. } else {
  61. echo "That username already exists! Please try again with another.";
  62. }
  63.  
  64. } else {
  65. echo "All fields are required!";
  66. }
  67. }
  68. ?>
  69.  
  70.  
  71. </body>
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement