• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

Hit counter for a flash document

HI:

I have a flash file in wich i want to put a hit counter, i'm an asp developer and i don't know php language, and the hot in wich i have my site hosted is a unix, and i need make a hit counter in php and then pass the value to my swf file.

some of you can help me with the code and the way to do it?
thank's....i'm hearing
0
kinezul
Asked:
kinezul
1 Solution
 
BungeeCommented:
do you need session to track a user or do you just want to know how many users have visited your site ?

Bungee
0
 
kinezulAuthor Commented:
i need to know the number of visitors only.
0
 
cyniczCommented:
write a short wrapper around the flash file:

bumpTheCount();
# increment the number. don't know how you
# want to store the count...

header('Content-type: application/x-shockwave-flash');
$fd = fopen('foo.swf','r');
while($chunk = fread($fd, 4096)){
    echo $chunk;
}
fclose($fd);

and then instead of pointing the visitor directly to the flash file, point them to the wrapper script.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
rumblefizCommented:
you could also use load variables from within flash and then point it to your php script. this is the same way you would do it with asp except your php script might look something like:

<?
   ## get_the_count func could read a cookie or from a db or whatever
      $iCount = get_the_count();
      $sReturn = urlencode("The count is: $iCount");
      echo $sReturn;
?>

note ** on some flash to get it to work i had to use rawurlencode() instead of urlencode().

hope this helps. this way you could animate it and stuff. let me know if you need an example and i will see if i can send you one real quick.

rumblefiz
0
 
rumblefizCommented:
kinezul -

are you ok now? did any of these help?

- rumblefiz
0
 
kinezulAuthor Commented:
rumblefiz :

Could you send me an example?, and i can give to you 200 points

Thanks
0
 
rumblefizCommented:
sure. i will put one together real quick. where should i e-mail it?

- rumblefiz
0
 
kinezulAuthor Commented:
put here !: afranco@ga.com.mx
0
 
rumblefizCommented:
i will put the php code here, i have to e-mail you the flash file. i will also send you a link of it working on my server. give me a couple minutes to finish with this conf call and i will send it right over.

- rumblefiz
0
 
kinezulAuthor Commented:
thanks, if you can tell me de rigth way to configure it, will be good
0
 
rumblefizCommented:
actually, rather than me typing up a bunch of instructions and a sample file, take a look at the following url. there is a simple counter that pretty much does the same exact thing as i am talking about. it uses a text file to store the number of hits. remember to give write permissions on the txt file so the count will increment.

http://flashplanet.com/body_advanced.html

no point in retyping something that somone else already did! hope this helps.

- rumblefiz
0
 
rumblefizCommented:
if you cant get it to work i will be glad to see if i can help. i did a quick search and found this link. i figured this way you could get started (didn't know how urgent this is). i can't seem to get off this darn conf call ;)

let me know if you need some help.

- rumblefiz
0
 
rumblefizCommented:
one thing that i forgot to correct from my above post is that you need to specify the var in the return so that flash knows what to set. above i typed:

$sReturn = urlencode("The count is: $iCount");

it should be:

$sReturn = "myVarInFlash=".urlencode("The count is: $iCount");

- rumblefiz

0
 
kinezulAuthor Commented:
Thank's for all
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now