grazie!!
posto il tutto
step.php
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="author" content="Skyline">
<title>Login</title>
<form action="login2.php" method="post" enctype="application/x-www-form-urlencoded" name="login">
<input type="text" value="username" size="20" maxlength="20" name="username">
<input type="password" value="password" size="20" maxlength="20" name="password">
<input type="submit" value="Login" name="Submit">
</form>
</body>
</html>
login2.php
<?php
session_start();
//includo il file di Configurazione con session_start()) dentro
include "config.php";
//Eseguo una query nella tabella messaggi verificando se esiste l'username con quella password
$username="";
$psw="";
$username=$_POST['username'];
$psw=md5($_POST['password']);
$query = mysql_query("SELECT username FROM messaggi WHERE username='$username' AND password='$psw'") or die (mysql_error());
$veruser = mysql_num_rows ($query);
//se esegue la query entra nell'IF
if($veruser !== 0)
{
//metto l'username nella variabile di sessione "username"
$_SESSION['username'] = $_POST['username'];
//Faccio il redirect nella pagine enter.php
echo "<script>
window.location = \"enter.php\"
</script>";
}
else
{
//Faccio il redirect nella pagine enter.php
echo "<script>
window.location = \"enter.php\"
</script>";
}
@mysql_close($connection);
?>
enter.php
<?php
session_start();
//includo il file di Configurazione
include "config.php";
//se esiste la variabile $_SESSION['username'] è loggato
if($_SESSION['username'] = $_POST['username'] !== "")
{
$sql="UPDATE
messaggi SET user='".$_SESSION['id_user']."',
gender SET user='".$_SESSION['gender']."',
year SET user='".$_SESSION['year']."',
month SET user='".$_SESSION['month']."',
day SET user='".$_SESSION['day']."',
country SET user='".$_SESSION['country']."',
test_arousal_photo1 SET user='".$_SESSION['test_arousal_photo1']."',
test_valence_photo1 SET user='".$_SESSION['test_valence_photo1']."',
test_arousal_photo2 SET user='".$_SESSION['test_arousal_photo2']."',
test_valence_photo2 SET user='".$_SESSION['test_valence_photo2']."',
test_arousal_photo3 SET user='".$_SESSION['test_arousal_photo3']."' ,
test_valence_photo3 SET user='".$_SESSION['test_valence_photo3']."',
test_arousal_photo4 SET user='".$_SESSION['test_arousal_photo4']."',
test_valence_photo4 SET user='".$_SESSION['test_valence_photo4']."',
test_arousal_photo5 SET user='".$_SESSION['test_arousal_photo5']."',
test_valence_photo5 SET user='".$_SESSION['test_valence_photo5']."',
test_arousal_photo6 SET user='".$_SESSION['test_arousal_photo6']."',
test_valence_photo6 SET user='".$_SESSION['test_valence_photo6']."',
test_arousal_photo7 SET user='".$_SESSION['test_arousal_photo7']."' ,
test_valence_photo7 SET user='".$_SESSION['test_valence_photo7']."',
test_arousal_photo8 SET user='".$_SESSION['test_arousal_photo8']."',
test_valence_photo8 SET user='".$_SESSION['test_valence_photo8']."',
test_arousal_photo9 SET user='".$_SESSION['test_arousal_photo9']."',
test_valence_photo9 SET user='".$_SESSION['test_valence_photo9']."',
test_arousal_photo10 SET user='".$_SESSION['test_arousal_photo10']."',
test_valence_photo10 SET user='".$_SESSION['test_valence_photo10']."',
WHERE username='".$_SESSION['username']."'";
$query=@mysql_query($sql) or die (mysql_error());
echo "Benvenuto ".$_SESSION['username']." hai effettuato il login con successo
Puoi effettuare il <a href=\"logout.php\">logout</a>.";
}
//Altrimenti non è loggato
else
{
echo "Non hai fatto il login correttamente, mi spiace <a href=\"index0.php\">riprova</a>";
}
?>
index0.php
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="author" content="Skyline">
<title>Login</title>
</head>
<body>
<form action="login2.php" method="post" enctype="application/x-www-form-urlencoded" name="login">
<input type="text" value="username" size="20" maxlength="20" name="username">
<input type="password" value="password" size="20" maxlength="20" name="password">
<input type="submit" value="Login" name="Submit">
</form>
</body>
</html>
questo è tutto..
grazie davvero per la disponibilità

Rispondi quotando