uhm... mi da questo errore:
Warning: check(utenti.php) [function.check]: failed to open stream: No such file or directory in /web/htdocs/www.miosito.it/home/a/login.php on line 9
Warning: check() [function.include]: Failed opening 'utenti.php' for inclusion (include_path='.:/php/lib/php/') in /web/htdocs/www.miosito.it/home/a/login.php on line 9
Warning: Invalid argument supplied for foreach() in /web/htdocs/www.miosito.it/home/a/login.php on line 11
login.php
Codice PHP:
<? session_start(); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?
function check($user,$password){
include("utenti.php");
foreach($utenti as $user_ => $password_){
if (($user==$user_) AND ($password==$password_)) {
return true;
}
}
return false;
}
function form_login(){
?>
<form id="login" method="post">
<input type="text" name="utente" size="20" /></td>
<input type="password" name="password" size="20" /></td>
<input name="submit" type="submit" class="Stile2" value=" OK " /> </td>
</form>
<? }
if(isset($_POST["utente"]))
{
if (check($_POST["utente"],$_POST["password"]))
{
$_SESSION["utente"] = $_POST["utente"];
$_SESSION["password"] = $_POST["password"];
echo'<meta HTTP-EQUIV="refresh" content=1;url="index.php">';
exit;
}
else
{
form_login();
}
}
else
{
form_login();
}
?>
</body>
</html>
Grazie!!!