Re: [PHP-LANG] Newbie Password check problem

[email protected] (Romeo Manzur)
Newsgroups php.lang
Message-ID <[email protected]>
hi ronald, you can do something easy as this:
<?
if($send == '')
{
?>
your html form
<?
}elseif($send == 1)
{
?>
you html result..
<?
}
?>

this is very easy, just put a hidden field that calls send with the value 1, the
script verify the content of the send variable, if the value is 0 then print the
form that ask the user and passowrd, else if the value is 1 it will print the
page that you want to access...just remember to send the form to the same
file...
bye...


Ronald Hemmink wrote:

> Hello there fellow programmer,
>
> I just started learning PHP (I got version 4 installed with Apache on a
> Win98 machine). At the moment I'm trying to write a little program that
> verifies a user login.
> I know the program is not professional but for me it will do. Only I got
> stuck with the following problem. I have written a class (I'm not very sure
> if this is the right way to do this) in which I specified a function that
> does the password check.
> Now I like the program to check the password and return me a true or a false
> which I can read from somewhere else in my program.
> I wrote it like this:
>
> <html>
> <head>
>        <title>Password Check</title>
>
> <?PHP class password
> {
>  function checkpwd()
>  { ?>
>
>  <FORM ACTION="<?php print("$PHP_SELF"); ?>" METHOD="POST">
>  User name is:<BR>
>  <INPUT TYPE="text" NAME="UserName"> <P>
>
>  <?php echo "Give Password:<BR>" ?>
>
>  <INPUT TYPE="PASSWORD" NAME="passwd">
>  <INPUT TYPE="HIDDEN" NAME="GeefInfo" VALUE=1> <p>
>  <INPUT TYPE="submit">
>
>  <?PHP if (IsSet($this->GeefInfo)&&IsSet($this->UserName))
>        {
>         $this->UserName=strtoupper($this->UserName);
>          $this->passwd=strtoupper($this->passwd);
>
>            if (IsSet($this->passwd))
>              {
>                 if ($this->passwd=="MYPASS" && $this->UserName=="RONALD")
>                 {
>                  $this-> testvar=1;
>                  exit(1);
>                 }
>                 else
>                 {
>                  $this-> testvar=0;
>                  exit(0);
>                 }
>
>              }
>
>         }
>   }
> }?>
>
> </head>
> <body>
>
> <?php $exec_pwd=new password;
> $vexec_pwd->checkpwd();
> print $exec_pwd;                     // Where is my output   ?????
> ?>
>
> </body>
> </html>
>
> If you can and like to help me I will be very pleased.
> Thanks in advance !!!
>
> Ronald
>
> --
> PHP Language Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> To contact the list administrators, e-mail: [email protected]

--
Romeo Manzur
Web Application Developer
Isilicom
Av. 27 de Febrero 904 Altos
Despacho 1, Centro
Villahermosa, Tabasco, Mexico
Tel: 52+(9)3-12-4790
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.