Guest User

Untitled

a guest
Apr 13th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <?php
  2. //MySql database varibles
  3. $host = 'mysql7.000webhost.com';
  4. $database = 'a5580827_yuriah';
  5. $db_username = 'a5580827_kelvin';
  6. $db_password = 'monmon123';
  7.  
  8. //Connect to the MySQL database
  9. if (($db = new PDO("mysql:host=$host;dbname=$database", $db_username, $db_password)) == NULL) {
  10. echo $db->getMessage();
  11. }
  12.  
  13. //POST the username and password
  14. $username = $_POST['username'];
  15. $password = sha1(sha1($_POST['username']) . sha1($_POST['password']));
  16.  
  17. $errors = "";
  18. if (!isset($_POST['username']))
  19. $errors .= "Please provide a username. <br/>";
  20. if (!isset($_POST['password']))
  21. $errors .= "Please provide a password. <br/>";
  22. if (!isset($_POST['email']))
  23. $errors .= "Please provide an email address. <br/>";
  24. if ($errors == "") { mysql_query("INSERT INTO Members VALUES('','".addslashes($_POST['username'])."','".md5($_POST['password])."',.addslashes($_POST['email'])."'))
  25. or die(mysql_error());
  26. echo "Registration Successful!";
  27. } else {
  28. echo $errors."Please go back and try again.";
  29. }
  30. ?>
Add Comment
Please, Sign In to add comment