questo codice dovrebbe farti accedere a un'area protetta del sito con username e password. Funziona il link alla pagina desiderata se la pass e user sono corretti. Solamente che se nn compilo i form o nn dgt dati corretti nn linka alla pagina di errore da me creata.
IL codice è Questo:
Il problema secondo me sta nelle parti evidenziate in rosso ma nn capisco
come risolvere:
//Pagine Protette
$file1 = "blank.php"; //form nn compilati
$file2 = "pass.php"; //password o Username errati
$file3 = "index.htm"; //pagina prottetta
//UserName a Passwords
################################################## ############################
$username[1] = "pass"; // Generale
$password[1] = "pass";
$username[2] = ""; // utente1
$password[2] = "";
$username[3] = ""; // utente2
$password[3] = "";
$username[4] = ""; // utente3
$password[4] = "";
$username[5] = ""; // utente4
$password[5] = "";
$username[6] = ""; // utente5
$password[6] = "";
$username[7] = ""; // utente6
$password[7] = "";
$username[8] = ""; // utente7
$password[8] = "";
$username[9] = ""; // utente8
$password[9] = "";
$username[10] = ""; // utente9
$password[10] = "";
################################################## ############################
if (!$submit) {
?>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body bgcolor="#000000">
<form action="<? $PHP_SELF ?>" method="GET">
<p>&nbsp;</p>
<p align="center"><img src="a.jpg" width="425" height="128"></p>
<p align="center">&nbsp;</p>
<table width="300" align="Center" cellpadding="0" cellspacing="0" bgcolor="#000000" border="1" bordercolor="#000000">
<tr><td bordercolor="#000000">
<table border="0" align="Center" cellpadding="2" cellspacing="0" bordercolor="#000000">
<tr>
<td colspan="2" bgcolor="#000000"><div align="center"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"><strong>Area riservata ai mebri dello staff </strong></font></div></td>
</tr>
<tr>
<td colspan="2" bgcolor="#000000">&nbsp;</td>
</tr>
<tr>
<td width="268" bgcolor="#000000"><div align="center"><font color="#FFFFFF" size="-1" face="Verdana"><strong> Username:</strong></font></div></td>
<td width="250" bgcolor="#000000"><input name="user" type="Text" size="10"></td>
</tr>
<tr><td bgcolor="#000000"><div align="center"><strong><font color="#FFFFFF" size="-1" face="Verdana">Password:</font></strong></div></td>
<td bgcolor="#000000"><input name="pass" type="Password" size="10"></td>
</tr>
<tr bgcolor="#000000">
<td colspan="2" align="center">&nbsp;</td>
</tr>
<tr bgcolor="#000000"><td colspan="2" align="center"><input name="submit" type="submit" name="submit" value="Accedi">
<div align="center"></div>
<div align="center"></div></td>
</tr>
</table></td></tr></table>
</form></body></html>
<?
} else {
//controlla che i form nn siano vuoti
if ($user == null || $pass == null) {
include ("$file1");
}
//controlla correttezza pass
else {
if (
$user == $username[1] && $pass == $password[1] ||
$user == $username[2] && $pass == $password[2] ||
$user == $username[3] && $pass == $password[3] ||
$user == $username[4] && $pass == $password[4] ||
$user == $username[5] && $pass == $password[5] ||
$user == $username[6] && $pass == $password[6] ||
$user == $username[7] && $pass == $password[7] ||
$user == $username[8] && $pass == $password[8] ||
$user == $username[9] && $pass == $password[9] ||
$user == $username[10] && $pass == $password[10]
) {
include ("$file3");
}
//password o username sbagliati
else {
include ("$file2");
}
}
}
?>
gRAZIE anticipatamente