Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

Redirecting to a page after login in PHP

, 21 Dec 2010
Rate this:
Please Sign up or sign in to vote.
Redirecting to a page after login in PHP
It's sometime required to redirect to a page if some
conditions are met. You may include an auth.php page in any
page. This auth.php handles login and if login username
and password are matched, then the user will be redirected
to the member home page using 'header'. The code is shown below:
if($password == $passwordtext)
$_SESSION["userid1"] = $id1;
/members/index.php"); // redirects
$_SESSION["msg"] = "<li>Login Info - Username
/Password:  Incorrect Combination try again</li>";


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

mridul samadder
Software Developer self
Bangladesh Bangladesh
joomla,dnn, wordpress extensions and website developer -

Comments and Discussions

Questionlogging in with user type Pinmemberminejass9-Jul-12 16:37 
Question Pinmembertheoplay14-May-12 9:50 
GeneralReason for my vote of 5 Good hint! PinmemberOle Funch27-Dec-10 22:10 
GeneralReason for my vote of 4 Am new to PHP but the code is easy t... PinmemberSicelile27-Dec-10 9:32 
GeneralI remember, for a script I was written, opera cached my redi... PinmemberJH6427-Dec-10 6:48 
General@nguyen.. did u include the page name? like header("Location... Pinmembermridul samadder23-Dec-10 9:48 
GeneralAny help ??? header("Location:"); not w... Pinmembernguyenchauhuyen21-Dec-10 22:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140926.1 | Last Updated 21 Dec 2010
Article Copyright 2010 by mridul samadder
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid