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
https://forums.phpfreaks.com/topic/8872-cookie-problem/
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
https://forums.phpfreaks.com/topic/8872-cookie-problem/#findComment-32660
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.