Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_unset();
- session_destroy();
- if (!isset($_POST["email"]) or !isset($_POST["passwd"])) {
- header("location: index.php?status=empty");
- break;
- } elseif ($_POST["email"] == "" or $_POST["passwd"] == "") {
- header("location: index.php?status=empty");
- break;
- } elseif (strlen($_POST["email"]) > 40 or strlen($_POST["passwd"]) > 25) {
- header("location: index.php?status=empty");
- break;
- }
- $email = $_POST["email"];
- $passwdb = $_POST["passwd"];
- $passwd = md5($passwdb);
- require "mysql.php";
- /*VERIFICA SE L'UTENTE ESISTE*/
- $verificaa = $mysqli->query("SELECT * FROM users WHERE EMAIL = '$email'");
- if(!$verificaa->num_rows) {
- header("location: index.php?status=notregistered");
- break;
- }
- /*VERIFICA SE HA VERIFICATO IL PROFILO MC*/
- $verifica = $mysqli->query("SELECT * FROM users WHERE EMAIL = '$email' AND VERIFIED = 'false'");
- if($verifica->num_rows > 0) {
- header("location: index.php?status=mcverify");
- break;
- }
- /*VERIFICA SE HA VERIFICATO LA MAIL*/
- $keyfoder = "keyverificaemail/" . $email . "_key.txt";
- if (file_exists($keyfoder)) {
- header("location: index.php?status=emailverify");
- break;
- }
- /*ESECUZIONE RISCHIESTE A DATABASE*/
- $checkpass = $mysqli->query("SELECT * FROM users WHERE EMAIL = '$email' AND PASSWORD = '$passwd'");
- if($checkpass->num_rows != 1) {
- header("location: index.php?status=wrongpass");
- break;
- } else {
- /*GET USERNAME FROM DB ED ESECUZIONE*/
- $getuser = $mysqli->query("SELECT USERNAME FROM users WHERE EMAIL = '$email' AND PASSWORD = '$passwd'");
- $userrow = $getuser->fetch_assoc();
- $username = ($userrow["USERNAME"]);
- session_start();
- $_SESSION["email"] = $email;
- $_SESSION["username"] = $username;
- header("location: index.php");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement