Re: login determines content on page

From: Date: Sat, 23 Feb 2002 06:56:06 +0000
Subject: Re: login determines content on page
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-85929@lists.php.net to get a copy of this message
What's the difference between if (isset($submit_happening)) and if $submit_happening) John djo@jawbone.freeserve.co.uk wrote: > 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 -- John Taylor-Johnston ----------------------------------------------------------------------------- ' ' ' Collège de Sherbrooke: ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - Université de Sherbrooke: http://compcanlit.ca/ 819-569-2064

« previous php.general (#85929) next »