or you could use:
http://phpclasses.upperdesign.com/browse.html/package/288
py


At 01:08 PM 12/10/01 -0500, Jeremy Reed wrote:
>The easiest way is to use cookies.
>=========CODE============
><?php
>require 'auth_functions.php';
>if (authenticateUser($form_username, $form_password)){
>    setcookie("cookie_passwd",$form_password);
>    setcookie("cookie_user",$form_username);
>    header("Location:http://$SERVER/index2.php";);
>    exit();
>} else {
>header("Location:http://$SERVER/error.html";);
>}
>?>
>
>This code takes in input from a form as simple as this:
><form name="form1" method="post" action="index.php">
>   Login: <input type="text" name="form_username"><br>
>   Password:
>   <input type="password" name="form_password"> <br>
>   <input type="submit" name="Submit" value="Login">
></form>
>Checks it against the database values using the function 'authenticateUser',
>returns TRUE or FALSE.
>If true, sends the user onto the correct page, if false, sends them to some
>error page.
>
>Now, in each other file, you'll need to check the cookies.  The values for
>the cookies are sent automatically by the user's browser.  In this
>particular examples, the cookie variables are named '$cookie_user' and
>'$cookie_passwd'.  You can see in the example how those are set.
>
>You will check the cookies using the exact same 'authenticateUser' function.
>Except in these files, you will use the cookie values as the parameters to
>the function instead of the form values.
>
>Hope this helps.
>
>Best regards,
>
>Jeremy Reed
>
>"Mark Ward" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I've got a mySQL database with usernames and passwords. What's the best
>way
> > to allow authorized users to enter my site? I'm having some problems using
> > the forms properly, they've always been my achilles heel when it comes to
> > web programming. Any help is appreciated.
> >
> > Mark Ward
> >
>
>
>
>--
>PHP General 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]

Reply via email to