causa stanchezza da pc probabilmente sto sbagliando qualcosa ma non riesco a capire dov'è l'errore
ho un area protetta
la prima pagina è quella di login cosi strutturata:
poi ho admin-login.phpCodice PHP:<form method="post" action="admin-login.php">
<span class="dati">Username</span>
<input type="text" name="username" size="34">
<span class="dati">Password</span>
<input type="password" name="password" size="34">
</div>
<input type="submit" name="accedi" value="Accedi">
</form>
<?php echo htmlentities($_GET['error']);?>
e in fine la pagina dove dovrei accedereCodice PHP:<?php
if($_POST['admin']=='root' && $_POST['password']=='pass')
{session_start(); $_POST['admin']==$_SESSION['admin'];header('location:admin.php');}
else{ $error= 'cosi non va bene';$error_admin=urlencode($error); header('location:index.php?error='.$error_admin.'');}?>
il problema è che le sessioni sembrano non captare i datiCodice PHP:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento senza titolo</title>
</head>
<body>
<?php session_start(); ?>
<?php if($_SESSION['admin']=='root'){echo'ciao benvenuto';} else{header('location:index.php');} ?>
</body>
</html>
o meglio vengo sempre reindirizzato alla index.php anche se i dati sono "root" e "pass"
com'è possibile??![]()

Rispondi quotando
