Questo è tutto il codice completo fatto fino ad adesso
Codice PHP:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include_once("config.php");
$username = trim($_POST['uname']);
$password = trim($_POST['passw']);
if($username == "" or $password == ""){
header("Refresh: 5;URL=index.php");
$msg= 'Hai inserito dati non corretti ... attendi il reindirizzamento';
} else {
$sql = "SELECT id, temp FROM Registrazione WHERE password= '".$password."' ";
$result = mysql_query($sql) or DIE(mysql_error()) ;
$row = mysql_fetch_array($result);
if ($result) {
if ($row['temp'] == 0) {
$sql2 = "INSERT INTO sessioni (username, password, id) VALUES ('".$username."', '".$password."', '".$row['id']."')";
$result2 = mysql_query ($sql2) or DIE (mysql_error());
if ($result2) {
setcookie ( sessioni ,"$row['id']", "$_CONFIG['expire']");
header("Refresh: 5;URL=index.php");
$msg= 'Login avvenuto con successo';
}
} else {echo 'non hai confermato l email';}
}
}
?>