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

Help with PHP and checkboxes
I am posting this for a friend of mine, i wrote a small script for her to process her form data to a

Parse Error Help
Hello, I got the parse error "Parse error: syntax error, unexpected ',' in register.php on line

Problems with array
This code is the last lines in an upload script that uploads 4 images at the same time and writes th

Record count of entire database
Does anyone know if there is a way to obtain the number of records in each table of the database usi

Variable uses and placement
I'm new to PL/SQL and am trying to learn about variable valid uses/placement (any pointers to any do

Simple AND question
Hello,

I've got following code:

Code: if(strpos($row[13],"http://")

user validation always displaying invalid ? please help
Hello,

I have 2 accounts and there is a field in mysql called validated it can be either &quo

cURL Upload Help
OK, I am creating a bridge from a local program to my website and I am trying to find the best way t

UL and LI Add Form
The idea I want here is when the user click on a character name from the drop down select bar at the

array_diff weirdness
I'm using the following bit of code

$diff = array_diff($pids, $pidlist);
$diff = array_va

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