Jump to content

Cookie problem


jparker

Recommended Posts

Hello

I have 2 very simple scripts that sets and then gets a cookie to test to see all is working

The set script below seems to run without problems : -

<?php
setcookie ("user", "jparker", time()+604800);
?>

the get script below however doesn't work and creates an error in the apache log

<?php
$user = $HTTP_COOKIE_VARS["user"];
echo "Hello ".$user;

?>

The error is : -

[client 127.0.0.1] PHP Notice: Undefined variable: HTTP_COOKIE_VARS get.php on line 2

Could you possible point me in the right direction on how to solve this. I'm guessing its a PHP/Apache configuration issue

Thanks

James

Link to comment
Share on other sites

Yes the old $HTTP_*_VARS variables will not exist as of PHP6 and they are also disabled by defualt as of PHP4.1.0. You can still use them by turning [b]register_long_arrays[/b] on in the php.ini. But they are becoming depreciated, hense why they are going to be removed as of PHP6 I believe.
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.