Jump to content

Config'ing cookies question


wingchunnt

Recommended Posts

So, I'm in the php file where I'm in the middle of configuring my 'cookie_domain' and my 'cookie_path'.

This is what I have I have:

define('COOKIE_DOMAIN','_____________');
define('COOKIE_PATH','______________');


I've left the slots blank for the purpose of this question. In the first one I placed 'http://localhost' which I'm not sure is correct. I have absolutely no idea what to place in the next one.


The reason I'm asking is because when I login with a user it is redirecting me to the homepage and it's also not allowing me to create new post. It seems to me that I'm loosing the funcationality due to the cookies not being configured properly.

Can anyone assist me?

Link to comment
Share on other sites

if the two values are being used in a setcookie() or a session_set_cookie_params() statement or in individual ini_set() statements for the session cookie parameters, the first one means the variations of the domain that the cookie will match and the second one is the path after the domain that the cookie will match. you can find specific information about these two settings in the php.net documentation for the setcookie() or session_set_cookie_params() statements.

 

http:// is not part of a domain. it's a protocol and would not be part of the cookie settings. the path would typically be a / to match all paths after the domain.

 

do you have php's error_reporting set to E_ALL and display_errors set to ON so that php will help you by reporting and displaying all the errors it detects? this is usually the first step that helps pin down what is causing a problem.

Edited by mac_gyver
Link to comment
Share on other sites

Before you randomly change the cookie settings, you should investigate the problem and figure out what's really going on. Who says it's a cookie problem? It could be pretty much anything.

 

What does

var_dump($_SESSION);

tell you? Is the session in the target script entirely empty?

 

Modern browsers also come with developer tools (usually accessible via F12). Clear all session cookies, then try to log in. Does the server send a session cookie? Does your browser send it back when visiting the target script?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.