The header option works well for me, but Mike is right about not starting a
session.  This means the action of your authentication code must effectively
redirect to the correct page.  For mine, I use one of 4 different usertypes,
the designation of which is created upon registration.  So, once the user
logs in, the login.php file will first query the database to a.) make sure
there is in fact a user there, and b.) find out what usertype they are.
>From there, sending them to the right page is pretty straight forward:

// Code begins here //

$num_rows = mysql_num_rows ($result);  //$result being the aforementioned
query
if ($num_rows == "") {
        header ("location: invalid.html"); }
        else {
                while ($row = mysql_fetch_assoc($result)) {
                $a = $row["account_type"];
                $b = $row["username"];
                        }
                }        
        if ($a ==  "user type 1") {
                        header ("location: page1.php?username=$b"); 
                        } else if ($a == "user type 2") {
                                header ("location: page2.php?username=$b"); 
                        } else if ($a == "user type 3") {
                                header ("location: page3.php?username=$b");
                        } else if ($a == "user type 4") {
                                header ("location: page4.php?username=$b");
                        } else {header ("location: invalid.html");
                        }

// Code Ends here //

----------------------------------------------------------------

Ryan Vesely     
Sales Engineer  
Pinnacor        
685 Market Street, Suite 500    
San Francisco, CA 94105 
tel              415.369.4762                                   
fax              415.512.2085                                   

www.pinnacor.com <http://www.pinnacor.com/>  

The preceding e-mail message contains privileged, confidential information.
Intended conveyance is only to designated and named recipient(s). If you
feel that you may have received this message in error or if you are not the
named recipient, please notify Pinnacor at once at the sender's email
address, or call 212.691.7900. Unauthorized use, dissemination, distribution
or reproduction of this message is strictly prohibited and may be unlawful.




-----Original Message-----
From: Mike Brum [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 21, 2003 7:44 PM
To: 'ascll'; [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] Automatic load .php page


That depends on you actual code.

There's the header(location: http://url.to.page/); command that you could
use, but if you're already starting a session, I believe that you can't use
the header() command since the session already sends the header.

Though you could always include(); the member_area.php page at the point
that you print "Please click here..." or simply hard-code the
member_area.php code there as well.

There's a ton of different options, but without knowing your code, we have
no way of knowing the best one for the situation.

-M

-----Original Message-----
From: ascll [mailto:[EMAIL PROTECTED] 
Sent: Sunday, September 21, 2003 10:38 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Automatic load .php page


Greetings,

Instead of using:

<p>Please click here to go to <a href = "member_area.php">member
area</a>.</p>

in my login.php page to go to "member_area.php" once the user was
authenticated, could I just make this AUTO?

Thanks in advance.

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

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

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

Reply via email to