Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 18:21
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  PHP, Perl, ASP, JSP, CFM (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Jorge Solis, nothingGrinder)
| | |-+  $HTTP_COOKIE_VARS : HELP ME UNDERSTAND
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: $HTTP_COOKIE_VARS : HELP ME UNDERSTAND  (Read 2680 times)
John Lyons
Server what's that
*
Posts: 5



View Profile WWW Email
« on: 02/28/02, 16:33 »

Ive got a Flash movie. It has 9 movie clips. Each movie clip contains a Photo of a Girl with 3 possible choices to rate (Hot, OK, Yuck!). When the user votes on a girl, I want to set a cookie  (one cookie  for each of the  9 movie clips)via the same php script I am calling when the user clicks a choice button:

on (release) {
     loadVariables("vote.php", this, "POST");
-----------------------------------------------------------

at the moment, I have it set up so that only one cookie gets set no matter which poll is voted on. and if the user only votes on one poll then leaves; when they return then all polls show the results and the user can't vote anymore. This is not cool or optimal...and I really need some help to sort this out.

Heres the snip of PHP that I am using to set my cookie:

  // Set cookie so user can't vote again

   setcookie('hasVoted', 'yes', time() + (365 * 86400), "/");
}

-----------------------------------------------------------------
Now, when the movie loads...an onClipEvent handler is being used to call fetchPoll.php

This is the bit of code that brings in the cookies....

// If cookie says user has voted before...
if('yes' == $HTTP_COOKIE_VARS['hasVoted']) {
   // Tell Flash movie
   print "&result=AlreadyVoted";
} else {
   // Otherwise return okay
   print "&result=Okay";
}

--------------------------------------------------------------------

NOw for my confusion. Or....here is where you can hopefully help me learn....

1. How do I make this work with setting one cookie per poll as opposed to one cookie for the whole movie?

2. How do I bring these multiple cookies back into Flash, check to see if a cookie has been set for each poll, and then do the appropriate action? (if cookie set=show results; but if cookie is not set=let user vote)

For a visual of whats going on, check here:
http://tst.iserve.ch/babes/babevote2.html

3. Can I set a variable in PHP like $myCookies = $HTTP_COOKIE_VARS
and then echo it back to Flash with: &myCookieArray = $myCookies; or am I on the wrong track??

4. Once I get the variables back into Flash....how do I check to see if a cookie has been set for each poll? Should I use something like:
if (
myCookie Array[1] = hasVoted, poll_1.showResults;

??

Please help if you can...Im stumped and really want to learn this! By the way if this works out i will open the source files to whoever may be interested too.

Thanks for any efforts

John Lyons


Logged
Flash-db
Administrator
Systems Administrator
*****
Posts: 1867



View Profile WWW
« Reply #1 on: 03/08/02, 18:32 »

Hey John,

I apologize for the delay in this response - but the message board was down for a couple days.  

Anyways I just checked the example and it looks like it's working well, and that you figured it out.

If you have any other problems let me know.
Logged

-Jeff.
John Lyons
Server what's that
*
Posts: 5



View Profile WWW Email
« Reply #2 on: 03/08/02, 19:00 »

hey Jeff,
Thanks for the response...
unfortunately, my dumb ass still cant figure this out  Tongue.

The example that you see posted is woking with only one cookie for all nine polls.

My problem lies in reading in cookies for each of the 9 polls in the movie. I figured out how to set a cookie for each movie seperately by creating a variable for my cookie, but no luck getting that back in to Flash etc....

John
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!