Jump to content
xisto Community
Sign in to follow this  
nol

Question About Cookies

Recommended Posts

Theres a script I am using, that deals with users sessions and cookies. I'm having a problem with this portion of the code because I don't have any clue on what to put.

# The name of the cookie that contains the user's information# Note: Due to a bug in PHP, COOKIE_DOMAIN must contain at least two decimals  $USER_COOKIE   = "u_info";$COOKIE_DOMAIN = ".localhost.openpolitiks.com";  # $SERVER_NAME;$COOKIE_PATH   = "/";

I left the $USER_COOKIE part alone, but I changed the $COOKIE_DOMAIN (don't remember what they had but it didn't work), so what should it be? as it doesn't seem to hold user stuff?

here is the full script:

http://www.majordojo.com/php-users/
Edited by nol (see edit history)

Share this post


Link to post
Share on other sites

I think you have to put in your domain. Or the domain of your site/page where you want to log cookie sessions.

Share this post


Link to post
Share on other sites

I think they want something like this:

.openpolitiks.com
But i don't understand why they require such complicated cookie information, even if they say it's because of cookie specifications, especially if they're using setcookie() to create cookies.

Share this post


Link to post
Share on other sites

well it might be something with my coding of my index page, wher ei coded it to show the login box if your set to anonymous (as in not logged in), and to say hi if you are logged in, but it won't show hi and always shows the login box so im guessing it is to do with the cookies? or am i guessing wrong?

Share this post


Link to post
Share on other sites

well it might be something with my coding of my index page, wher ei coded it to show the login box if your set to anonymous (as in not logged in), and to say hi if you are logged in, but it won't show hi and always shows the login box so im guessing it is to do with the cookies? or am i guessing wrong?

To figure out which cookies you're looking for, type the following in a test page on your domain's server and look for the array key that matches the one you need:
<?phpecho "<pre>";print_r($_COOKIE);echo "</pre>";?>
Since the domain is provided by the script you link to in this topic, testing this out on a local server will most likely not work, since it would be a different domain (i.e. most likely localhost).

Share this post


Link to post
Share on other sites

To figure out which cookies you're looking for, type the following in a test page on your domain's server and look for the array key that matches the one you need:

<?phpecho "<pre>";print_r($_COOKIE);echo "</pre>";?>
Since the domain is provided by the script you link to in this topic, testing this out on a local server will most likely not work, since it would be a different domain (i.e. most likely localhost).
I don't use any cookies on my site but out of curiosity... Does this script ping back the name of the cookie file the server is searching for?

For example if it is looking for a cookie named "CookieMonster" would that be what it reflects back? (Meaning it also tells what name the cookie should have if set properly)

Share this post


Link to post
Share on other sites
Array(	[PHPSESSID] => c9871b5bf1d74a136490d1a06c898c74	[openpoli_wiki_openpoli__session] => ed8da09f52b5e426b0d9f8652ea09760)

?

oh and then I tried logging in,

Array(	[SMFCookie683] => a:4:{i:0;s:1:\"1\";i:1;s:40:\"3bcb588b7556304359a762ce248c69c3c8d1ed83\";i:2;i:1434077628;i:3;i:0;}	[PHPSESSID] => 9837d5f6f0d3c2566b50d11496f619da)

idk exactly what we are looking for?
Edited by nol (see edit history)

Share this post


Link to post
Share on other sites

I don't use any cookies on my site but out of curiosity... Does this script ping back the name of the cookie file the server is searching for?
For example if it is looking for a cookie named "CookieMonster" would that be what it reflects back? (Meaning it also tells what name the cookie should have if set properly)

If i understand the PHP manual correctly, then PHP only obtains the cookie that matches the server's domain—whatever cookie that may be. I am uncertain, though, of any cookie restrictions a browser may have.

Array(	[PHPSESSID] => c9871b5bf1d74a136490d1a06c898c74	[openpoli_wiki_openpoli__session] => ed8da09f52b5e426b0d9f8652ea09760)
?

oh and then I tried logging in,

Array(	[SMFCookie683] => a:4:{i:0;s:1:\"1\";i:1;s:40:\"3bcb588b7556304359a762ce248c69c3c8d1ed83\";i:2;i:1434077628;i:3;i:0;}	[PHPSESSID] => 9837d5f6f0d3c2566b50d11496f619da)

idk exactly what we are looking for?
I'm not sure what exactly you're trying to accomplish, especially concerning that PHP users script, but i wouldn't expect you to find a cookie from the PHP users script from a script that already has a user system. Since you said you "logged in" and the cookie information you have showed doesn't really show anything i would have expected, due to ambiguity, i have no idea what to tell you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.