Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Racing Game Registration</title>
  4. </head>
  5. <body style="background-color:#36c;font-family:calibri;color:#F0F0F0;text-align:center;">
  6. <h1><i>Racing Game</i></h1><hr/>
  7. <h2><i>Registration</i></h2>
  8. <p >
  9. <form name="register" method="post">
  10. Username: <input type="varchar" name="name" /><br/><br/>
  11. Password: <input type="password" name="pass" /><br/><br/>
  12. <input type="submit" value="Register" style="height:40px;width:80px"/>
  13. </form>
  14. <?php
  15. if(isset($_POST['name']) && isset($_POST['pass']))
  16. {
  17. $name = $_POST['name'];
  18. $pass = $_POST['pass'];
  19. $con = mysql_connect("localhost","root","");
  20. if (!$con)
  21. {
  22. die('Could not connect: ' . mysql_error());
  23. }
  24. mysql_select_db("users");
  25. $exist = 0;
  26. $regiUsers = mysql_query("SELECT name FROM players") or die("Query failed with error: ".mysql_error());
  27. while($row = mysql_fetch_array($regiUsers) && $exist!=1)
  28. {
  29. echo $row['name'] ."<br />". $name;
  30. if($row['name'] == $name)
  31. {
  32. $exist = 1;
  33. echo "<script>alert('Username already exist please try another one');</script>";
  34. }
  35. if($row['name'] === $name)
  36. echo "<script>alert('haha');</script>";
  37. else
  38.  
  39. echo "<script>alert('muhahaha');</script>";
  40. }
  41. if(strlen($pass)>=6)
  42. {
  43. if($exist != 1)
  44. {
  45. mysql_query("INSERT INTO players (name,pass,hs) VALUES ($name,$pass,0)");
  46. mysql_close($con);
  47. echo "<script>alert('Registered successfuly!');</script>";
  48. }
  49. }
  50. else
  51. {
  52. echo "<script>alert('Your password must be at least 6 chars long! please try again');</script>";
  53. }
  54. }
  55. else
  56. echo "failed";
  57. ?>
  58. </p>
  59. <br/>
  60. <p2 style="font-size:12px;">© tal vintrob</p2>
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement