Jump to content

Recommended Posts

I am able to set the cookie just fine as I can see it in my cookie list in firefox with the correct values, however I cant seem to get the cookie. Here is my code:

<?php
$user = $_COOKIE["fd_mem_user"]; 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="js/swfobject.js" type="text/javascript"></script>
</head>
<body bgcolor="#333333">
<div align="center" id="loginsys">
  <script type="text/javascript">
        // <![CDATA[
        var so = new SWFObject("membership.swf", "membership", "590", "300", "9", "#333333");
	//so.addParam("allowScriptAccess", "always");
	so.addVariable("usercookie","<?php echo $user; ?>");
        so.write("loginsys");
        // ]]>
      </script>
</div>
</body>
</html>

 

I also tried : $user = $HTTP_COOKIE_VARS["fd_mem_user"];

 

Link to comment
https://forums.phpfreaks.com/topic/132597-cant-get-cookie/
Share on other sites

ok I managed to get it working..seems like I had to set a path to "/"

 

I am now having a problem removing the cookie:

if(isset($cookie))
{
setcookie("fd_mem_user",$username, time() + 31536000,'/');
}
else
{
setcookie("fd_mem_user","", time()-3600,'/');
}

 

basically if the check box isnt checked $cookie isnt set so it should set the cookie to "" but its not. Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/132597-cant-get-cookie/#findComment-689502
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.