Help with setcookie()


Posted on 16th Feb 2014 07:03 pm by admin

Merry Xmas to those on this foruum
Older guy here with some experience but not allot so please be gentle.
I am having problems with setting cookies on my web site. At one time they worked and for the life of me I cannot find the problem... 3 days now ... no joy.
To make it as simple as I can, I wrote a very simple program that should demonstrate the problem... I am not that good on server settings, but i have a hunch it is on the server. My program (testcookie.php) has phpinfo() combined with the small program that demonstrates so you can see the exact problem.
Can anyone see what I am doing wrong?
BTW, I have no .htaccess file.
You can see the problem here .. almcom<dot>net/testcookie.php
Here is the same code you will see on the above location.
Code: <?php
setcookie("IM_A_COOKIE", "IM_COOKIE_CONTENT", time() + 3600, "/"); //cookie expires in 60min

echo "<br />Running testcookie.php ------- SEE BELOW phpinfo() -------";

echo "<br />-----------------------------------begin display of testcookie.php code------------------<br />";
highlight_file("testcookie.php");
echo "<br />----------------------------------------end of testcookie.php code------------------------<br /><br />";

if (isset($_COOKIE["IM_A_COOKIE"]))
echo "It was set... " . $_COOKIE["IM_A_COOKIE"] . "!<br />";
else
echo "<h4>Cookie was <font color=red>NOT</font> set</h4>";

echo "-----------------------------------------------------------------------------------";
echo "<br />Here is the phpinfo():...";
phpinfo();
?>
<HTML>
<HEAD><TITLE><br /><br />Cookie Tester</TITLE></HEAD>
<BODY>END of testing with testcookie.php</BODY>
</HTML>

No comments posted yet

Your Answer:

Login to answer
79 Like 25 Dislike
Previous forums Next forums
Other forums

PHP error. Need help urgently
Hi,

I am programming a php site and have a problem that i just cant find out how to fix. When

cURL proxy
Okay here is the thing... i know how to add proxys

Code: curl_setopt($ch, CURLOPT_PROXYTYPE,

phpMailer will not connect using SMTP
I am trying to use phpMailer with smtp:

Code: [Select]$mailer = new PHPMailer();
$mailer-&

couldn't connect to your database
Hello I am new to php mysql

Actually i have read A tutorial on nettuts
"http://net.tu

MYSQL INSERT ID NOT WORKING
Code: $id = mysql_insert_id();
header("Location: ./?view=$id");
Why $id pulling blan

MySql timezone
Code: $sql = "SELECT *, date_format(date, '%m/%d/%Y at %I:%i %p' )as date FROM comments WHERE t

Dynamic memory problem
Hey,

At the beginning of my code, I have this line:

Shape* gShape = 0;

a multi dimensional array with for each
hi, I have been asked to write an array, I have Zone 2,3,4,5,6,7,8 each zone has 3 sections of weigh

Login page problems
I developed a website a few months ago and I am now having an issue with logging into it. The place

Multiple forms on the same page (safari)
Hello everyone,

I have 3 forms on the same page, that opens in a new window and submits to a

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash