Código PHP:
include($_SERVER['DOCUMENT_ROOT']."/TorneoLatinoamericano/DatosReportes.txt");
$passwrong = FALSE;
session_start();
if (isset($_POST['Pass']))
{
$flagCuenta = 0;
for ($i=0;$i<count($Cuenta);$i++)
{
if (strtolower($Cuenta[$i]) == strtolower($_POST['User']))
{
$flagCuenta = 1;
if (strtolower($Pass[$i]) == strtolower($_POST['Pass']))
{
$_SESSION['ReportesPass'] = 1;
$_SESSION['ReportesUser'] = $_POST['User'];
}else{
$passwrong = TRUE;
}
}
}
}
Código HTML:
<form name="FormLogin" method="post"> <table cellspacing="4" cellpadding="2" class="B"> <tr> <td colspan="2" class="F" style="font-size:12pt">Login</td> </tr> <tr> <td class="D">Cuenta del Torneo: </td> <td class="E"><input type="text" name="User" value="" style="text-align:left"></td> </tr> <tr> <td class="D">Password: </td> <td class="E"><input type="password" name="Pass" value="" style="text-align:left"></td> </tr> <tr> <td colspan="2" class="F"><input type="submit" value="Login" style="cursor:pointer"></td> </tr> <? if ($passwrong) { ?> <tr> <td colspan="2" class="F" style="background-color:red">Contraseña incorrecta!</td> </tr> <? }else{ if (isset($flagCuenta) && $flagCuenta == 0) { ?> <tr> <td colspan="2" class="F" style="background-color:red">Cuenta incorrecta!</td> </tr> <? } } ?> </table> </form>