rondog Posted November 13, 2008 Share Posted November 13, 2008 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"]; Quote Link to comment https://forums.phpfreaks.com/topic/132597-cant-get-cookie/ Share on other sites More sharing options...
rondog Posted November 13, 2008 Author Share Posted November 13, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/132597-cant-get-cookie/#findComment-689502 Share on other sites More sharing options...
premiso Posted November 13, 2008 Share Posted November 13, 2008 Are you working on a server or localhost? If localhost check out this article... http://www.aeonity.com/frost/php-setcookie-localhost-apache Quote Link to comment https://forums.phpfreaks.com/topic/132597-cant-get-cookie/#findComment-689515 Share on other sites More sharing options...
rondog Posted November 13, 2008 Author Share Posted November 13, 2008 Nah its on a server. I figured it out. I was setting my cookie through flash every time..it was an error with my flash. I got it working though. Quote Link to comment https://forums.phpfreaks.com/topic/132597-cant-get-cookie/#findComment-689537 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.