Advertisement
Guest User

Untitled

a guest
Nov 5th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5. <title>Processing Request</title>
  6. <link rel="Stylesheet" href="style.css" type="text/css" />
  7. </head>
  8.  
  9. <body>
  10. <h1>Account Creation</h1>
  11. <h3>
  12.  
  13. <?php
  14. $dbhost = "localhost";
  15. $username = "root";
  16. $password = "";
  17. $connect = mysqli_connect("$dbhost", "$username", "$password");
  18. $db = "accounts";
  19.  
  20. if (!$connect){
  21. die("ERROR: Database connection failed: " . mysqli_connect_error());
  22. }
  23.  
  24. mysqli_select_db($connect, $db);
  25.  
  26. $makeUser = $_POST["makeUser"];
  27. $makePass = $_POST["makePass"];
  28. $sql = "INSERT INTO accounts (username, password) VALUES ('$makeUser', '$makePass')";
  29.  
  30.  
  31. if("SELECT username FROM accounts WHERE username = '$makeUser'"){
  32.  
  33. header("Location: createaccount.php?status=userTaken");
  34. }
  35. else{
  36. mysqli_query($connect, $sql);
  37. echo "Account creation was succesful!";
  38. }
  39.  
  40. mysqli_close($connect);
  41. ?>
  42.  
  43. Click <a href="index.php">here</a> to login.
  44.  
  45. </h3>
  46. </body>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement