Page 1 of 1

Cookie problem? or IIS

Posted: Fri Aug 24, 2007 10:28 am
by lawksalih
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi all-

I have an intro page in flash that I'd like to display for all visitors of the site.  For returning users, I have a script that redirects them to the main root index.php page so the intro won't show again.  I have gone through IIS to change the document directory to my flash/intro directory which is http://www.example.com/intro/index.php.  However, anytime a user goes to the domain, it keeps redirecting on and on and on again.  Any idea why?  

Here is the code:

[syntax="html"]
<html>
  <head>
    <title>Page Title</title>

<script>
<!--
/* Cookie reader and exit page     */
   
// page to go to if cookie exists
go_to = "http://www.example.org/index.php";

// number of days cookie lives for
num_days = 5;
function ged(noDays){
    var today = new Date();
    var expr = new Date(today.getTime() + noDays*24*60*60*1000);
    return  expr.toGMTString();
}

function readCookie(cookieName){
    var start = document.cookie.indexOf(cookieName);
    if (start == -1){ 
        document.cookie = "seenit=yes; expires=" + ged(num_days);
    } else {
        window.location = go_to;
    }
}

readCookie("seenit");
// -->
</script>

  </head>
  <body bgcolor="#669933">
    <center>
      <object
        classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
        codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0"
        id="ebf_intro"
        width="400" height="300"
      >
        <param name="movie" value="intro.swf">
        <param name="bgcolor" value="#669933">
        <param name="quality" value="high">
        <param name="allowscriptaccess" value="samedomain">
        <embed
          type="application/x-shockwave-flash"
          pluginspage="http://www.macromedia.com/go/getflashplayer"
          name="ebf_intro"
          width="400" height="300"
          src="intro.swf"
          bgcolor="#669933"
          quality="high"
          swliveconnect="true"
          allowscriptaccess="samedomain"
        >
          <noembed>
          </noembed>
        </embed>
      </object>
    </center>
  </body>
</html>
Note that it's a JavaScript the sets the cookie and redirects the user.


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]