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>

79 Like 25 Dislike
Previous php-forum Next php-forum
Other php-forum

Simple Scraper... Weird Output
Okay, maybe I just need a Blue Monster and some sleep, but....

I'm scraping a ringtone site

Interpret Order
Hello all,

I'm wondering if I have this:

Code: $switch = array(
'one' =>

Code error with Index.php
Error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/runevid/public_

Stumped by Third Day of Month problem
I am trying to build an algorithm that will essentially do this:
Code: [Select]$this_month = Oct

double and single quotes in text fields acting up... help please
Single quotes, when entered into a text field, create an sql error upon Submit. It seems to create t

Getting the full city list from maxminds geoip database
I am suprised I can't find any references to this.

I have maxminds geoip lite installed and i

subtract 1 from value entered in text field
Hi

How do I subtract 1 from the vaue entered into a text field?

Thanks

Help with writing "$" with fopen
I just can't get my syntax correct. Could someone help me please? I am trying to write a connect fil

How could I combine these arrays??
Hello.. I'm trying to figure out a way to combine these first two arrays to get the last array..

Do While statement
hi guys,

This may sound trivial but im new to php and as part of an assignmenti have to const

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