Advertisement
Guest User

Untitled

a guest
May 11th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <?php
  2. session_unset();
  3. session_destroy();
  4.  
  5. if (!isset($_POST["email"]) or !isset($_POST["passwd"])) {
  6. header("location: index.php?status=empty");
  7. break;
  8. } elseif ($_POST["email"] == "" or $_POST["passwd"] == "") {
  9. header("location: index.php?status=empty");
  10. break;
  11. } elseif (strlen($_POST["email"]) > 40 or strlen($_POST["passwd"]) > 25) {
  12. header("location: index.php?status=empty");
  13. break;
  14. }
  15.  
  16.  
  17. $email = $_POST["email"];
  18. $passwdb = $_POST["passwd"];
  19.  
  20. $passwd = md5($passwdb);
  21.  
  22. require "mysql.php";
  23.  
  24. /*VERIFICA SE L'UTENTE ESISTE*/
  25. $verificaa = $mysqli->query("SELECT * FROM users WHERE EMAIL = '$email'");
  26. if(!$verificaa->num_rows) {
  27. header("location: index.php?status=notregistered");
  28. break;
  29. }
  30.  
  31. /*VERIFICA SE HA VERIFICATO IL PROFILO MC*/
  32. $verifica = $mysqli->query("SELECT * FROM users WHERE EMAIL = '$email' AND VERIFIED = 'false'");
  33. if($verifica->num_rows > 0) {
  34. header("location: index.php?status=mcverify");
  35. break;
  36. }
  37.  
  38. /*VERIFICA SE HA VERIFICATO LA MAIL*/
  39. $keyfoder = "keyverificaemail/" . $email . "_key.txt";
  40. if (file_exists($keyfoder)) {
  41. header("location: index.php?status=emailverify");
  42. break;
  43. }
  44.  
  45. /*ESECUZIONE RISCHIESTE A DATABASE*/
  46. $checkpass = $mysqli->query("SELECT * FROM users WHERE EMAIL = '$email' AND PASSWORD = '$passwd'");
  47.  
  48. if($checkpass->num_rows != 1) {
  49. header("location: index.php?status=wrongpass");
  50. break;
  51. } else {
  52. /*GET USERNAME FROM DB ED ESECUZIONE*/
  53. $getuser = $mysqli->query("SELECT USERNAME FROM users WHERE EMAIL = '$email' AND PASSWORD = '$passwd'");
  54. $userrow = $getuser->fetch_assoc();
  55. $username = ($userrow["USERNAME"]);
  56.  
  57. session_start();
  58. $_SESSION["email"] = $email;
  59. $_SESSION["username"] = $username;
  60. header("location: index.php");
  61. }
  62. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement