Salve,
sto creando un'area riservata, per capire meglio ho creato solo 2 pagine una si chiama index.php e laltra index2.php!
Lo script lo sto creando quindi non é completo.
Come faccio a far stampare il nome dell'utente che si é loggato nella pagina index2.php?
Se sbaglio datemi una dritta anche per la pagina index.php!!
Nella pagina index.php ho fatto:
<?php
session_start();
$_SESSION['UserName'] = $Username;
$_SESSION['Password'] = $Password;
$_SESSION['LoginSucces'] = "Admin";
$Usr = "Admin";
$Pwd = "1234";
$Username = $_POST['usr'];
$Password = $_POST['pwd'];
$LoginOk = "index2.php";
if (isset($_POST['Submit'])) {
if($Username==$Usr || $Password==$Pwd) {
header("Location: $LoginOk");
exit();
} else {
$msg = "Errore, controllare il nome utente e la password \n"
}
}
?>
<head>
</head>
<body>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><form name="form1" method="post" action="">
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><div align="center">Area Login: </div></td>
</tr>
<tr>
<td colspan="2"><div align="center"><?php echo $msg;?> </div> </td>
</tr>
<tr>
<td width="225">Username :</td>
<td width="225"><input name="usr" type="text" id="usr"></td>
</tr>
<tr>
<td>Password : </td>
<td><input name="pwd" type="password" id="pwd"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
Nella pagina index2.php ho messo:
<?php
session_start();
?>
<head>
</head>
<body>
Benvenuto:<?php echo $_SESSION['UserName'] ;?>
</body>
</html>
Grazie
Michel![]()