:S che scemo che sono, è vero che il login viene fatto su pagina esterna!
Codice PHP:
$action= $_GET['action'];
if($action == "login_do")
{
$user= $_POST['user'];
$pass= $_POST['pass'];
// Controllo inserimento dati
if (trim($user) == "" OR trim($pass) == "")
Errore("javascript:history.go(-1)", "Errore", "I campi devono essere riempiti" ,".");
else
{
$user = addslashes(stripslashes($user));
$pass = addslashes(stripslashes($pass));
$user = str_replace("<", "<", $user);
$pass = str_replace(">", ">", $pass);
// Connessione al database
Db_connect();
// Recupero dati dal database
if (!get_magic_quotes_gpc())
{
$user= addslashes($_POST['user']);
$pass= addslashes($_POST['pass']);
}
else
{
$user= $_POST['user'];
$pass= $_POST['pass'];
}
$crypt_pass = md5($pass);
$query = "SELECT * from ".$tbl_prefix."user WHERE username = '$user' AND password = '$crypt_pass'";
$risultato = mysql_query($query);
$num_righe = mysql_num_rows($risultato);
if($num_righe)
{
// L'utente è stato riconosciuto
$row = mysql_fetch_array($risultato);
if ($row['actived'] != "1")
Errore("javascript:history.go(-1)", "Errore", "L'account non risulta ancora attivato tramite la conferma email!" ,".");
session_cache_limiter("private_no_expire");
$_SESSION['login'] = "yes";
$_SESSION['auth'] = $row[auth];
$_SESSION['username'] = $row[username];
$_SESSION['nome'] = $row[nome];
$_SESSION['cognome'] = $row[cognome];
$_SESSION['mail'] = $row[mail];
?>
<script type="text/javascript">
location.href = "index.php";
</script>
<?
}
// Nome utente o password errati
else
Errore("javascript:history.go(-1)", "Errore", "Username o password errati!" ,".");
}