A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Passing "Invisible" variables

  1. #1
    Senior Member
    Join Date
    Apr 2000
    Posts
    106
    Hey, can someone please tell me how to pass variables from one page to another? Basically, I'd like to create a link that when clicked passes "invisible" variables to a new page and logs the person into the website (the person never sees the login screen). If however, they try to bypass the first page and go directly to page #2, they will get the login prompt.

    Essentially, this will allow me to detect if the individual is using page #1 to get to page #2, which is what I want.

    Thanks!

  2. #2
    Senior Member
    Join Date
    May 2001
    Posts
    335
    on the page #1
    -----
    loadVariablesNum('http://path_to_your_script?where=page1',0);

    Your script got the variable 'where'...

  3. #3
    Senior Member
    Join Date
    Feb 2001
    Posts
    475
    Hi
    What are u using? Flash, HTML Form? What serverside language? what kind of Login?

    example for HTML:
    add this to your form:
    <input type="Hidden" name="washere" value="1">

    then in your favourite serverside scripting language:
    if (washere != "1")
    login();
    else
    ...

    Well Cookies and Javascript can do this too - but only when it's activated...

    Yours
    HTD

  4. #4
    Senior Member
    Join Date
    Apr 2000
    Posts
    106
    Everything is done 100% in Flash. I want to try and avoid using any HTML if possible.

  5. #5
    Senior Member
    Join Date
    Feb 2001
    Posts
    475
    so the second page is also a flash movie of yours?

  6. #6
    Senior Member
    Join Date
    Apr 2000
    Posts
    106
    That's correct HTD. Page #1 and Page #2 are both 100% Flash. Basically, if the user visits page #1, they will be automatically forwarded to page #2. Page 1 also passes "invisible" variables to Page 2 which logs the user into the website. If, however, the user tries to go to page 2 directly, they will encounter a login screen (or an error). Essentially, this will require (force) the visitor to first visit page #1 as they will never be given the password for the login.

    I hope this makes sense.

  7. #7
    Senior Member
    Join Date
    May 2001
    Posts
    335
    I don't sure that i uinderstand you correctly..

    Why do you want to make 2 different flash movies for this?

    I should be in one movie...
    Typically the process is:

    1. User loads your flash
    2. At the first frame of flash you have an login screen
    3. User enters his data.
    4. Variables sent to the server-side script to check user info...
    loadVariablesNum('http://path_to_your_script',0,"POST") - this will send all variables to the server-side script using the POST method)
    5. Your server-side script check this info and return results into flash (in my example - into main timeline - level0)
    6. If info is correct user logged in.. if not, display login screen


  8. #8
    Senior Member
    Join Date
    Feb 2001
    Posts
    475
    Hi

    well al77_t has a good solution for that - keep it in one movie...

    if you can't merge your movies you'll need some serverside scripting. you can pass a variable to the second page (being a script) and that script passes the variable to the flash file. PHP example:

    Page one (actually flash 1):
    postedvar = 1;
    getURL ("page2.php", _self, POST);

    page2.php:
    <!-- header bla bla -->
    <embed src="movie.swf?beenthere=<?=$postedvar ?>" <!-- flash embed bla bla continues--></embed>

    then in flash 2:
    if (beenthere == "1")
    trace ("was here");
    else
    login();

    Not that the same variable passing code has got to be done for the MSIE flash implememntation. That's it - BTW getURL() has ability to get or post only in flash 4 and above
    Yours
    HTD

  9. #9
    Senior Member
    Join Date
    Apr 2000
    Posts
    106
    Unfortunately, for my purposes, I can not put it in one movie. I absolutely need it in two. It's a security thing. Basically, I want to give a web address out to someone and for a limited time allow that person access to my site. Then if I feel that person is taking advantage of my services, I want to change the password on PAGE 2 so that they are not able to access the site anymore. I also don't want the login screen to pop-up normally. I only want it to be visible once I've changed the password.

  10. #10
    Senior Member
    Join Date
    May 2001
    Posts
    335
    Don't see any reasons why it can't be implemented in one movie...

    How do you plan to authorize user if you don't want to display login screen?



  11. #11
    Senior Member
    Join Date
    Feb 2001
    Posts
    475
    hm... you can do this by using cookies... when the user logs in the cookie gets set - then the cookie is checked for validity and there's no need to display a login screen. when the cookie has expired or the user has no more rights he must log in again (or pay again) and a new cookie gets set. You'll need some kind of database to manage the cookies/access rights though... because cookies are textfiles and therefore easy to change by the client.

    I also can't see why this can't be in one movie as you say... anyway i think your idea needs a lot more background work than you thought, am i right?

    Yours
    HTD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center