ibeblunt
Sun 19th May '02, 12:52am
I've been working on this for 2 nights and I'm past frustrated. Basically, I'm trying to set a cookie and it's not being set. I even coded it the long way just to ensure that I wasn't forgetting any variables.
This is the code that I have at the top of the page BEFORE any headers are displayed:
if (!$cookie_750x400) {
$cookie_name = 'cookie_750x400';
$cookie_value = 'set';
$cookie_expire = time()+3600; // EXPIRES EVERY 60 MINUTES
$cookie_domain = '.sohh.com';
setcookie($cookie_name,$cookie_value,$cookie_expir e,'/',$cookie_domain,0);
$show_750x400_ad = 'yes';
}
I know in PHP if you set a cookie, it won't show up on the current page, which is why I have set the $show_750x400_ad to 'yes' for later usage.
Then I have this code:
if ($show_750x400_ad == 'yes') {
?>
<script language="JavaScript" type="text/javascript">
<!--
launch('http://www.sohh.com/mv-pop-up_750x400.html','750x400',750,400);
//-->
</script>
<?php
}
I made a page on my site, which shows me all the cookies stored on my computer from my domain and each time the cookie is not set.
What could I be doing wrong?
I am using PHP 4.1.2 and Internet Explorer 6.0.2600. I'm not too sure of what I have set in the php.ini file since it was installed for me.
Just so you can see the problem, I made this page:
http://www.sohh.com/test_setcookie.php
This page contains the code:
<?php
$cookie_name = "cookie_750x400";
$cookie_value = "set";
$cookie_expire = time()+3600;
$cookie_domain = ".sohh.com";
setcookie($cookie_name,$cookie_value,$cookie_expir e,"/",$cookie_domain,0);
?>
Then I made another page:
http://www.sohh.com/apps/cookies/
This will echo all the cookies that my domain is using on your computer.
What could I be doing wrong?
This is the code that I have at the top of the page BEFORE any headers are displayed:
if (!$cookie_750x400) {
$cookie_name = 'cookie_750x400';
$cookie_value = 'set';
$cookie_expire = time()+3600; // EXPIRES EVERY 60 MINUTES
$cookie_domain = '.sohh.com';
setcookie($cookie_name,$cookie_value,$cookie_expir e,'/',$cookie_domain,0);
$show_750x400_ad = 'yes';
}
I know in PHP if you set a cookie, it won't show up on the current page, which is why I have set the $show_750x400_ad to 'yes' for later usage.
Then I have this code:
if ($show_750x400_ad == 'yes') {
?>
<script language="JavaScript" type="text/javascript">
<!--
launch('http://www.sohh.com/mv-pop-up_750x400.html','750x400',750,400);
//-->
</script>
<?php
}
I made a page on my site, which shows me all the cookies stored on my computer from my domain and each time the cookie is not set.
What could I be doing wrong?
I am using PHP 4.1.2 and Internet Explorer 6.0.2600. I'm not too sure of what I have set in the php.ini file since it was installed for me.
Just so you can see the problem, I made this page:
http://www.sohh.com/test_setcookie.php
This page contains the code:
<?php
$cookie_name = "cookie_750x400";
$cookie_value = "set";
$cookie_expire = time()+3600;
$cookie_domain = ".sohh.com";
setcookie($cookie_name,$cookie_value,$cookie_expir e,"/",$cookie_domain,0);
?>
Then I made another page:
http://www.sohh.com/apps/cookies/
This will echo all the cookies that my domain is using on your computer.
What could I be doing wrong?