openConnection(); if ($_GET["a"] == "LOGIN") { $Login = $_POST["Login"]; $Password = $_POST["Password"]; $query = "SELECT u.*, tu.Nome TipoNome, tu.CreaConcerto, tu.CreaEvento, tu.IsModerato FROM utente u INNER JOIN tipo_utente tu ON u.IDTipo = tu.ID WHERE u.Attivo = 1 AND tu.Attivo = 1 AND UPPER(u.Login) = '" . strtoupper(formatSQL($Login)) . "' AND u.Password = '" . md5($Password) . "'"; $res = $handle->getRecordset($query); $num_row = mysql_num_rows($res); if ($num_row > 0) { $row = mysql_fetch_assoc($res); if ($row['Attivo'] == 1) { $query = "SELECT ur.*, r.Nome FROM utente_realta ur INNER JOIN realta r ON ur.IDRealta = r.Nome WHERE ur.IDUtente = " . $row['ID'] . " AND ur.Attivo = 1"; $res2 = $handle->getRecordset($query); $num_row2 = mysql_num_rows($res2); $_SESSION["UtenteRealta"] = array(); $_SESSION["UtenteNomeRealta"] = array(); if ($num_row2 > 0) { while($row2 = mysql_fetch_assoc($res2)) { array_push($_SESSION["UtenteRealta"], $row2['IDRealta']); array_push($_SESSION["UtenteNomeRealta"], $row2['Nome']); } } $_SESSION["UtenteID"] = $row['ID']; $_SESSION["UtenteLogin"] = $row['Login']; $_SESSION["UtentePassword"] = $row['Password']; $_SESSION["UtenteFoto"] = $row['Foto']; $_SESSION["UtenteNome"] = $row['Nome']; $_SESSION["UtenteCognome"] = $row['Cognome']; $_SESSION["UtenteSesso"] = $row['Sesso']; $_SESSION["UtenteDataNascita"] = $row['DataNascita']; $_SESSION["UtenteLuogoNascita"] = $row['LuogoNascita']; $_SESSION["UtenteCodiceFiscale"] = $row['CodiceFiscale']; $_SESSION["UtenteIDTipo"] = $row['IDTipo']; $_SESSION["UtenteDescrizione"] = $row['Descrizione']; $_SESSION["UtenteEmail"] = $row['Email']; $_SESSION["UtenteTelefono"] = $row['Telefono']; $_SESSION["UtenteRegistrato"] = $row['Registrato']; $_SESSION["UtenteAttivo"] = $row['Attivo']; $_SESSION["TipoUtenteNome"] = $row['TipoNome']; $_SESSION["TipoUtenteCreaConcerto"] = $row['CreaConcerto']; $_SESSION["TipoUtenteCreaEvento"] = $row['CreaEvento']; $_SESSION["TipoUtenteIsModerato"] = $row['IsModerato']; $_SESSION["MostraEmail"] = $row['MostraEmail']; $_SESSION["ZonaAttiva"] = $row['ZonaAttiva']; $isLogged = true; //$handle->close(); //header("location: utente.php"); } else { $alertJS = "Questo account è stato bloccato!"; } } else { $alertJS = "Dati non corretti!"; } } if ($_GET["a"] == "RESET") { if ($_POST["Login"] != "" || $_POST["CodiceFiscale"] != "") { $newPassword = passwordCasuale(8); if ($_POST["Login"] != "") { $email = $handle->getSingleValue("SELECT Email FROM utente WHERE UPPER(Login) = '" . strtoupper(formatSQL($_POST["Login"])) . "'"); $query = "UPDATE utente SET Password = '" . md5($newPassword) . "' WHERE UPPER(Login) = '" . strtoupper(formatSQL($_POST["Login"])) . "'"; } else { $email = $handle->getSingleValue("SELECT Email FROM utente WHERE UPPER(CodiceFiscale) = '" . strtoupper($_POST["CodiceFiscale"]) . "'"); $query = "UPDATE utente SET Password = '" . md5($newPassword) . "' WHERE UPPER(CodiceFiscale) = '" . strtoupper($_POST["CodiceFiscale"]) . "'"; } if ($email != "") { $handle->exec($query); $testoMail = "La tua password su LiveUs.it è stata resettata
La tua nuova password è: " . $newPassword; sendMail("", $email, "LiveUs.it -> Reset password", $testoMail); $alertJS = "La tua password è stata resettata. Controlla il tuo indirizzo email!"; } else { $alertJS = "Account inesistente!"; } } else { $alertJS = "Devi scrivere la Login o il Codice Fiscale!"; } } if ($_GET["a"] == "LOGOUT") { session_destroy(); } $handle->close(); } include("header.php"); ?>
Login
Nome . " " . $utente->Cognome . ".

"; echo "Vai alla tua pagina personale.
"; } else { ?>
Login:
Password:


Registrazione
Non ti sei ancora registrato? Che cosa aspetti? Registrati!


Reset Password
Hai dimenticato la tua password? Clicca qui!