Forum Moderators: coopster

Message Too Old, No Replies

Multiple scripts into a single login?

         

aftershock2020

6:14 am on Oct 30, 2008 (gmt 0)

10+ Year Member



Hey guys,

I'm trying to create a backoffice script and have multiple logins for scripts that I'm trying to use in the service without rewriting/ combining them into one script. I have built the membership login script and need to know how to code for passing that single login id and password into the other scripts so that when the user clicks the link for the subscript, it goes straight to the main page instead of making them signin again for each sub login.

The reason for the multiple logins is that I built the scripts originally for offering them as sub services, depending on my clients requirements.

Can anyone help me out here?

andrewsmd

1:57 pm on Oct 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can you explain a little more? From what I can tell you could just set some session variable once they log in the first time that is universal like $_SESSION['loggedIn'] = "a4seisndes"; or some crazy string like that, then at the beginning of each of your subscripts just put a simple if in at the very beginning that says
if($_SESSION['loggedIn'] == "a4seisndes"){
header("LOCATION: $_SESSION['userURL']");
}
you could store the url they were heading to with $_SERVER['REQUEST_URI']; as $_SESSION['userURL'];
If they have not logged in then that session variable should not be set and they will continue on to the login page. Of course this is pseudo code probably has more bugs then a house in the trailer park.

aftershock2020

8:32 pm on Oct 30, 2008 (gmt 0)

10+ Year Member



True, I'm looking at using a join or union statement in the query to push a universal login like you are talking about with avoiding the need for rewriting the individual scripts other than dropping the login page access for that area of the membership service, which would work through a single registration form instead of signing up for every script, it would input the data into the database for automatic login from that point.