Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <?php
  2. /*
  3. #########################################
  4. # 1337gamers #
  5. # #
  6. # #
  7. # #
  8. #########################################
  9. */
  10.  
  11. $dbhost = "localhost" //Default is localhost
  12. $dbpass = "password" //Password
  13. $dbuser = "root" //Default is root
  14. $dbname = "dbname" //Name of the database
  15.  
  16. mysql_connect("$dbhost", "$dbuser", "$dbpass") or die("Couldn't connect:".mysql_error());
  17. mysql_select_db("$dbname");
  18.  
  19. //Getting started with the script ;p
  20. $username = $_POST['username'];
  21. $password = md5($_POST['password']); //Passwords are now encrypted
  22. $whyyouwanttobehere = $_POST['whyyouwanttobehere'];
  23.  
  24. $checkuser = mysql_query("SELECT * FROM users WHERE username = '$username'");
  25. $user_exist = mysql_num_rows($checkuser);
  26.  
  27. if($user_exit > 0)
  28. {
  29. echo "That username is already registered";
  30. unset($username);
  31. exit();
  32. }
  33.  
  34. //exit(); will exit from the error checking and instert the results
  35. $query = "INSERT INTO users(username, password, email, whyyouwanttobehere)VALUES('$username', '$password', '$email', '$whyyouwanttobehere')";
  36. mysql_query($query) or die(mysql_error());
  37. mysql_close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement