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.
Did you know?Explore Trending and Topic pages for more stories like this.
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

The repetition structure: the while statement not working
New programming student, have assignment as follows:
A restaurant has 4 lunch combos for custom

Code Review - SQL and Insertion Attacks (Warning: Not for Newbs)
Hey guys,

Its been a while, I know. Use to love coming here to answer peoples questions, but

How to return to a previous page after running a PHP script
I'm having a bit of a melt down here because I think this should be really easy but can't work it ou

remove innitial

and

tags
i am using tiny_mce as a text editor for my CMS.
buy now the problem is it add <p>

ereg_replace in Wordpress
Heya - so I'm working on this site: http://world-of-smiles.theportlandco.com/new-patients

The

browse folder only
hi,
is there a way i can browse or get the directory or folder only and not the file?
i just w

Count on multidimensional array
Hi, i got an array as below:

Array
(
=> Array
(

highlighting search terms
well, I started this in the regular PHP section, but it no longer fits there. Suffice it to say, I'm

login form can you find my error?
registrationform.php seems fine send data to registration.php
registration.php seems fine checks

max() problem
I have a while loop to get image names.
Code: $imagequery = mysql_query("SELECT * FROM ad_i

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