tmen

runnerRegister.php

Jan 7th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9. <?php
  10. function sanitize($data)
  11. {
  12. if(get_magic_quotes_gpc())
  13. {
  14. $data = stripslashes($data);
  15. }
  16. return $data;
  17. }
  18. $servername = "localhost";
  19. $username = "playground18";
  20. $password = "Cdz5SOVrY2p8fnWS";
  21. $dbname = "playground18";
  22. $user = sanitize($_GET['user']);
  23. $pass = sanitize($_GET['pass']);
  24. $encryptedPass = sha1($pass);
  25. $ip=$_SERVER['REMOTE_ADDR'];
  26.  
  27. try {
  28. $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
  29. // set the PDO error mode to exception
  30. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  31. $sql = "INSERT INTO tanay_xcatt_runners (name, password, ip)
  32. VALUES ('$user', '$encryptedPass', '$ip')";
  33. // use exec() because no results are returned
  34. $conn->exec($sql);
  35. echo "New account created successfully";
  36. }
  37. catch(PDOException $e)
  38. {
  39. echo $sql . "<br>" . $e->getMessage();
  40. }
  41.  
  42. $conn = null;
  43. header("Location: runnerLoginForm.html");
  44. ?>
  45. </body>
  46. </html>
Add Comment
Please, Sign In to add comment