Re: login determines content on page

From: Date: Sat, 23 Feb 2002 04:37:33 +0000
Subject: Re: login determines content on page
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-85924@lists.php.net to get a copy of this message
On Fri, 22 Feb 2002 21:38:16 -0500, you wrote: >I'd to know how difficult it is to achieve the following: > >Create login page, when the submit button is clicked, the user info is checked against a >database as >to whether is login info is valid. if it is valid, a page is displayed that lists all of the >classes >that the user has registered for, meaning each user will see a different list of classes. At first, I thought this was a homework question, but that seems unlikely. Ok, one way to do this is to have a form submit to itself. Briefly : <? if (isset($submit_happening)) { if ($username == "david" && $password="xyzzy") { echo("Successfully logged in"); } else { echo("Not logged in"); } } else { ?> <form method="post" action="<?=$PHP_SELF?>"> <input type="hidden" name="submit_happening" value="1"> <input type="text" name="username"> <input type="password name="password"> </form> <? } ?> Untested. If you want to store a user's logon status permanently, look at sessions. http://www.php.net/manual/en/ref.session.php djo

« previous php.general (#85924) next »