if ($_GET[lingua]=="") {
$lingua="it";
}
include ('./sistema/conn_open.php');
if ($_GET[esci]==1) {
unset($_SESSION[idutente]);
header('Location: /');
}
if ($login_idutente) header('Location: index.html');
if ($_POST['accedi']) {
$md5=md5(trim($_POST[password]));
$username=trim(mysql_real_escape_string($_POST[username]));
$sql="SELECT * FROM posta_utenti WHERE username='$username' AND password='$md5'";
echo $sql;
$Dbr=mysql_query($sql);
$nuovo_us_id="";
while ($row = mysql_fetch_array($Dbr)) {
$idutente=$row[idutente];
$chiave=$row[chiaveutente];
$permessi=$row[permessi];
$sql_aggiorna="UPDATE posta_utenti SET dataaccesso='$web_datetime' WHERE idutente='$idutente'";
$Dbr_aggiorna=mysql_query($sql_aggiorna);
$nuovo_us_id=$chiave;
}
if ($nuovo_us_id) {
$_SESSION['idutente'] = $idutente;
header("Location: amministrazione.html");
$errore="Ok!
Username o password errati!";
} else {
$errore="Attenzione!
Username o password errati!";
// $errore.="
".$sql;
}
}
if ($login_idutente) {
if ($_POST[redirect]) {
header("Location: $_POST[redirect]");
} else {
header("Location: amministrazione.html");
}
}
if ($_GET[cancellato]==1) {
$errore="Il tuo account è stato cancellato dal nostro portale!
Se vorrai ricominciare ad utilizzare i nostri servizi
potrai registrarti in qualsiasi momento.";
}
?>
print_r($_POST); ?>include ('./sistema/footer_script.php'); ?>