[PHP] Form Based Authentication

2002-03-12 Thread Anson Smith

  I am new to PHP and I am attempting to use some type of 
  authentication in my site.
  My first page is a simple HTML form page with 2 fields username and 
  passwrd. that form is POST'ed to a 2nd page.
  In the second page I start a session, and if $_POST["username"] is 
  set I Register a "authenticated_user" session variable. (This will be 
  replaced by an actual authenticate function).
  Could Someone Explain why I have to submit my first form twice in 
  order to be considered authenticated.
  Also any pointers to tutorials or samples of form based 
  authentication would be appreciated.
  My Code is attached:


_IncrediMail - Email has finally 
evolved - Click 

Description: unknown/unknown

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Form Based Authentication

2002-03-12 Thread Matt Schroebel

First, change the names of your include files to something.inc.php so that no-one can 
download the files and get thte source, should their names become known.
Second, you either must use session_register or $_SESSION['variablename'] and not mix 
their use.
So instead of:
$authenticated_user = 71722334;
 $_SESSION['authenticated_user'] = 71722334;
Note that session_register will always start sessions, while using the associated 
array $_SESSION won't, so make sure you continue to use session_start() at the top of 
every page just as you did here.
Look for tutorials here:
http://www.newbienetwork.net/ http://www.newbienetwork.net/  
http://www.thickbook.com/ http://www.thickbook.com/  
http://www.phpdeveloper.org/ http://www.phpdeveloper.org/  
http://www.devshed.com/ http://www.devshed.com/  
http://www.webmonkey.com/ http://www.webmonkey.com/  
http://www.irc-html.com/ http://www.irc-html.com/  
http://www.phpbuilder.com/ http://www.phpbuilder.com/  
http://www.zend.com/ http://www.zend.com/  
 -Original Message-
From: Anson Smith [mailto:[EMAIL PROTECTED]] 
   Could Someone Explain why I have to submit my first form twice in order to be 
 considered authenticated.