djr33
05-01-2006, 07:47 AM
I've mentioned this before in other threads, so I won't go into too much detail... let me know if you need more info.
Simple version:
I'm coding some pages that require users to be logged in. I'd love to use the existing cookies from my form.
the catch is that they are two different servers, thebrb.com and thebrbforums.com.
So... here's what i'm thinking:
I can use an include or ajax to get the page on the other server, then it should tell if they're logged in or not.
Let's assume for example (and any demo scripts you show me) that http://thebrbforms.com/loginverify.php is the page that checks their cookies.
Question: does a php include work only serverside? I'm assuming yes. this would mean the server obviously doesn't have cookies, and the user's cookies wouldn't be accessible or even related.
Meaning... I need another way to load a page on the other server, right?
So... ajax.
Does it operate server side or client side? Seems kinda half and half. If a php script is run on a server when ajax asks for it, would cookies be available?
If it will work for getting data from cookies,
Here's what I'd like:
A SIMPLE ajax script that will get the contents of http://thebrbforms.com/loginverify.php (which will either be a username or "null") and based on that determine (if (var == "null")) to display them as logged in or not.
If you could just code a page that says "Logged in as [username]" or "Not logged in." then I will be quite happy.
thanks in advance. Feel free to suggest other ideas.
I've thought about hidden frames and such.... but... seems like a pain and not too compatible. Plus, I'd still need a way to get the data from those frames into the rest of the page...
Hmm... alternatively, i could have the page on the other server, http://thebrbforms.com/loginverify.php, output two values, those which are stored in the cookie. one would be password (encrypted with md5) and the other the username. Then I could use php on the other server to interpret it, but it would need to somehow get into the php script... which might be a pain. I guess a refresh could work. Maybe.
Simple version:
I'm coding some pages that require users to be logged in. I'd love to use the existing cookies from my form.
the catch is that they are two different servers, thebrb.com and thebrbforums.com.
So... here's what i'm thinking:
I can use an include or ajax to get the page on the other server, then it should tell if they're logged in or not.
Let's assume for example (and any demo scripts you show me) that http://thebrbforms.com/loginverify.php is the page that checks their cookies.
Question: does a php include work only serverside? I'm assuming yes. this would mean the server obviously doesn't have cookies, and the user's cookies wouldn't be accessible or even related.
Meaning... I need another way to load a page on the other server, right?
So... ajax.
Does it operate server side or client side? Seems kinda half and half. If a php script is run on a server when ajax asks for it, would cookies be available?
If it will work for getting data from cookies,
Here's what I'd like:
A SIMPLE ajax script that will get the contents of http://thebrbforms.com/loginverify.php (which will either be a username or "null") and based on that determine (if (var == "null")) to display them as logged in or not.
If you could just code a page that says "Logged in as [username]" or "Not logged in." then I will be quite happy.
thanks in advance. Feel free to suggest other ideas.
I've thought about hidden frames and such.... but... seems like a pain and not too compatible. Plus, I'd still need a way to get the data from those frames into the rest of the page...
Hmm... alternatively, i could have the page on the other server, http://thebrbforms.com/loginverify.php, output two values, those which are stored in the cookie. one would be password (encrypted with md5) and the other the username. Then I could use php on the other server to interpret it, but it would need to somehow get into the php script... which might be a pain. I guess a refresh could work. Maybe.