You are here: Re: Problems with login form « PHP Language « IT news, forums, messages
Re: Problems with login form

Posted by Nakkie on 01/02/07 10:19

"Gleep" <Gleep@Gleep.com> wrote in message
news:ckmjp25259jnmvksbc92qufljc61f4k9tm@4ax.com...
> On Mon, 1 Jan 2007 14:24:34 +0200, "Nakkie" <nakkie@telkomsa.net> wrote:
>
>>Hi
>>
>>Has anyone experienced this problem before?
>>I created a simple login page using an HTML form.
>>PHP check the username and password against a .txt file.
>>The authentication part is doing what it's supposed to do with both valid
>>and invalid details.
>>The problem comes in when I leave both fields blank and click the login
>>button - it authenticates...... and take me to the restircetd area....
>>I have created a password for a blank username as well as a space, but it
>>stil does the same.
>>Any idea how to fix this?
>>
>
>
> you need to validate that the fields are filled out first, if not - don't
> do any processing
>
> $username = $_POST['username'];
> $password = $_POST['password'];
>
> if($_POST['Submit']) {
> if(empty($username) OR empty($password)) {
> $errorNote = "Username and Password are required";
> exit;
> } else {
> test the username and password
> }
> } // end of submit
>
>
> // somewhere on the page
> echo $errorNote;
>
> this will give you the general idea, adapt to your needs.
>
>

Thanx a mil - I'll try it out

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация