Advertisement
Guest User

Untitled

a guest
Jan 29th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?php
  2. $db = mysql_connect('localhost', 'username', 'password') or die ('Could not connect: ' . mysql_error());
  3. echo ('Database connection complete');
  4. mysql_select_db('databasename') or die ('Could not select database');
  5.  
  6. $email = mysql_real_escape_string($_GET['email'], $db);
  7. $username = mysql_real_escape_string($_GET['username'], $db);
  8. $password = mysql_real_escape_string($_GET['password'], $db);
  9. $hash = $_GET['hash'];
  10.  
  11. $secretKey = 'secretkey';
  12.  
  13. $real_hash = md5($email . $username . $password . $secretKey);
  14. if ($real_hash == $hash)
  15. {
  16. $query = "INSERT INTO users (username, password, creationdate, email) values ('$username', '$password', NOW(), '$email');";
  17. $result = mysql_query($query) or die('Query failed: ' . mysql_error());
  18. }
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement