Click here to Skip to main content
13,001,686 members (65,326 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


9 bookmarked
Posted 20 Dec 2010

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 -

You may also be interested in...

Comments and Discussions

Questionlogging in with user type Pin
minejass9-Jul-12 16:37
memberminejass9-Jul-12 16:37 
Question Pin
theoplay14-May-12 9:50
membertheoplay14-May-12 9:50 
GeneralReason for my vote of 5 Good hint! Pin
Ole Funch27-Dec-10 22:10
memberOle Funch27-Dec-10 22:10 
GeneralReason for my vote of 4 Am new to PHP but the code is easy t... Pin
Sicelile27-Dec-10 9:32
memberSicelile27-Dec-10 9:32 
GeneralI remember, for a script I was written, opera cached my redi... Pin
JH6427-Dec-10 6:48
memberJH6427-Dec-10 6:48 
General@nguyen.. did u include the page name? like header("Location... Pin
mridul samadder23-Dec-10 9:48
membermridul samadder23-Dec-10 9:48 
GeneralAny help ??? header("Location:"); not w... Pin
nguyenchauhuyen21-Dec-10 22:09
membernguyenchauhuyen21-Dec-10 22:09 

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

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

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