Ragazzi sto impazzendo!!!
Vi posto 2 pagine:
INDEX.PHP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Identificati</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form" method="post" action="convalida.php">
<div align="center">
<table width="300">
<tr>
<td colspan="2"><div align="center">Identificati:</div></td>
</tr>
<tr>
<td width="78">Username:</td>
<td width="206">
<input type="text" name="user"> </td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="psw"></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="login" value="Invia">
</div></td>
</tr>
</table></div>
</form><?php
if ($_SESSION['fallito'] == 1 and $_SESSION['autenticato'] == 0) {
echo ( 'Hai inserito un nome utente o una password non valida...reidentificati');
}
?>
</body>
</html>
CONVALIDA.PHP
<?php
require ("oroscopo.class.php");
$user = $_POST['user'];
$psw = $_POST['psw'];
unset ($_SESSION['autenticato']);
unset ($_SESSION['fallito']);
$conn = new connessione();
if ($conn->resultuser == $user and $conn->resultpsw == $psw) {
$_SESSION['autenticato'] = 1;
$_SESSION['fallito'] = 0;
header("Location: inserisci.php");
}
else {
$_SESSION['autenticato'] = 0;
$_SESSION['fallito'] = 1;
header("Location: index.php");
}
?>
__________________________________________________ _____________________________________
Ora da come avrete senz'altro capito: se la login e psw sono giuste la pagina convalida manda ad inserisci.php, se sono sbagliate rimanda a insex.php....
dovrebbe gestire un errore con le sessioni che però pare non servino a niente perchè se inserisco user e psw sbagliata vengo reindirizzato all'index.php ma non compare nessun messaggio....come mai????