Cookie Contents: works local, but not Live.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Cookie Contents: works local, but not Live.

Post by simonmlewis »

Code: Select all

$cookietype = $_COOKIE['type'];
echo "$cookietype";
When I run this locallly, it works and displays "administrator".

When I run it on a live server, even tho the page I am click from displays "administrator" at the top (using the same code), this popup php page will not do it.

It's insane.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Re: Cookie Contents: works local, but not Live.

Post by ok »

Where do you set the cookie? Please post a more compete source code.

Try to clean all the cookies and cache in your browser, restart it and try again.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Cookie Contents: works local, but not Live.

Post by simonmlewis »

It sets the cookie in a login script.
I am looking at a page with various functions, and at the top it says "Logout administrator". 'administrator' comes from the cookie.

So I know the page I am coming FROM is happy that it's administrator.

I click on this:

Code: Select all

<a href='http://www.domain.co.uk/admincheck.php?status=closed&web=$web' onclick=\"window.open('http://www.domain.co.uk/admincheck.php?status=closed&web=$web','popup','width=400,height=700,scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false\">
$num_fin closed cons</a>
And the popup appears, and on the live web server, it just won't accept it as Administrator.
Yet locally, it works a treat. Locally I have to just the full LOCAL/ URL.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Re: Cookie Contents: works local, but not Live.

Post by ok »

Do the two pages come from the same domain? If not, for which domain the cookie is set.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Cookie Contents: works local, but not Live.

Post by simonmlewis »

Yes, same full domain. That's why it's so confusing.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Re: Cookie Contents: works local, but not Live.

Post by ok »

Can you please post the lines in which you setup the cookie?
Post Reply