Try filling up pass.txt with the same password over and over and use a
regular login.txt. Then try it with a username from somewhere in the
middle of the files. I think your problem has something to do with array
indexes - if what I suggested works, you can then work your way through
it by changing passwords in pass.txt until it doesn't work anymore.
Anyway, your mechanism is very interesting - as far as I can understand,
the actual password ("secret") is the URL of the restricted page! :)
Bogdan
Rodrigo wrote:
>Hi guys, I'm trying the following code and the problem is that I always
>get the denied page...
>What I'm trying here is to make a login thru a text file. The logins are
>in one file named login.txt, and the passwords are in the file called
>pass.txt . I need Help, I can't seem to get thru here and I need it just
>like that, cause the other option would be to use my server database
>which uses a PHPMYADMIN that I don't know anything about. I can't seem
>to make it work, so let's stay with the text files, cause I don't need
>it to be safe ( security sound ). The code goes after this message.
>Thanks to all.
>Rodrigo.
>
>
>
><?php
>$logins = File('login.txt');
>$login_cont = count($logins);
>$login_digitado2 = $login_digitado;
>for ($cont=0;$cont<$login_cont;$cont++)
>{
> if($logins[$cont] == $login_digitado2)
> {
> $login_indice = $cont+1;
> }
>}
>
>$password = File('pass.txt');
>if ($password[$login_indice] == $password_digitada)
>{
> header('Location:http://www.domain.com/restricted/restricted.htm');
>}
>else
> header('Location:http://www.domain.com/denied.htm');
>?>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php