Advertisement
Guest User

Untitled

a guest
May 13th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.22 KB | None | 0 0
  1. newusr.html:
  2.  
  3. <html>
  4. <head>
  5.     <title>Quiz Site New Users Registration</title>
  6. </head>
  7. <body>
  8. <form action="newusr.php" method="post">
  9. Full name: <input type="text" name="name"><br>
  10. Country of residence: <SELECT NAME="country"" SIZE="1">
  11.     <OPTION VALUE="1">United Kingdom
  12.     <OPTION VALUE="2">United States
  13.     <OPTION VALUE="3">Somewhere else in the world
  14. </select><br>
  15. E-mail address: <input type="text" name="email"><br>
  16. Username: <input type="text" name="usrname"><br>
  17. Password: <input type="password" name="userpass"><br>
  18. <input type="Submit">
  19. </form>
  20.  
  21. newusr.php:
  22.  
  23. <?php
  24. $dbuser='xxx';
  25. $dbpass='xxx';
  26. $dbname='xxx';
  27. $dblocation='localhost';
  28.  
  29. $userid = uniqid();
  30.  
  31. $name=$_POST['name'];
  32. $country=$_POST['country'];
  33. $email=$_POST['email'];
  34. $usrname=$_POST['usrname'];
  35. $userpass=$_POST['userpass'];
  36.  
  37. mysql_connect($dblocation, $dbuser, $dbpass)
  38.     OR DIE ("Connection failed");
  39.  
  40. mysql_select_db($dbname)
  41.     OR DIE ("Database not found");
  42.  
  43. $query = "INSERT INTO player (player_id, player_name, player_country, player_email, player_username, player_password) VALUES ($userid,'$name','$country','$email','$usrname','$userpass')"
  44.     //OR DIE (mysql_error());
  45.    
  46. mysql_query($query);
  47.  
  48. echo "Done";
  49.  
  50. mysql_close();
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement