Advertisement
Guest User

Untitled

a guest
Dec 12th, 2017
632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <?php
  2. $servername = "ei";
  3. $username = "root";
  4. $password = "fatti i cazzi tuoi";
  5.  
  6. try {
  7. $conn = new PDO("mysql:host=$servername;dbname=recoins", $username, $password);
  8. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  9. }
  10. catch(PDOException $e)
  11. {
  12. echo "Fallito e merda bamboons: " . $e->getMessage();
  13. }
  14.  
  15. if(isset($_POST['btn-signup'])) {
  16. $errMsg = '';
  17. $fullname = $_POST['name'];
  18. $email = $_POST['email'];
  19. $password = $_POST['pass'];
  20. $coins = 50;
  21. $rank = 1;
  22.  
  23. if($fullname == '')
  24. $errMsg = 'Nome mancante';
  25. if($email == '')
  26. $errMsg = 'email mancante';
  27. if($password == '')
  28. $errMsg = 'Password mancante';
  29. if($errMsg == ''){
  30. try {
  31. $stmt = $connect->prepare('INSERT INTO pdo (userName, userPass, userCoins, userEmail, userRank) VALUES (:fullname, :password, :coins, :email, :rank)');
  32. $stmt->execute(array(
  33. ':fullname' => $fullname,
  34. ':email' => $email,
  35. ':password' => $password,
  36. ':coins' => $coins,
  37. ':rank' => $rank
  38. ));
  39. header('Location: register.php?action=joined');
  40. exit;
  41. }
  42. catch(PDOException $e) {
  43. echo $e->getMessage();
  44. }
  45. }
  46. }
  47. if(isset($_GET['action']) && $_GET['action'] == 'joined') {
  48. $errMsg = 'Hai finito! Registrazione avvenuta';
  49. }
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement