Solved

Hit counter for a flash document

Posted on 2001-07-30
14
258 Views
Last Modified: 2006-11-17
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
Comment
Question by:kinezul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 

Expert Comment

by:Bungee
ID: 6338959
do you need session to track a user or do you just want to know how many users have visited your site ?

Bungee
0
 

Author Comment

by:kinezul
ID: 6345154
i need to know the number of visitors only.
0
 

Expert Comment

by:cynicz
ID: 6352068
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
Independent Software Vendors: 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!

 
LVL 1

Expert Comment

by:rumblefiz
ID: 6353941
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
 
LVL 1

Expert Comment

by:rumblefiz
ID: 6366156
kinezul -

are you ok now? did any of these help?

- rumblefiz
0
 

Author Comment

by:kinezul
ID: 6369003
rumblefiz :

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

Thanks
0
 
LVL 1

Expert Comment

by:rumblefiz
ID: 6369038
sure. i will put one together real quick. where should i e-mail it?

- rumblefiz
0
 

Author Comment

by:kinezul
ID: 6369068
put here !: afranco@ga.com.mx
0
 
LVL 1

Expert Comment

by:rumblefiz
ID: 6369076
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
 

Author Comment

by:kinezul
ID: 6369099
thanks, if you can tell me de rigth way to configure it, will be good
0
 
LVL 1

Expert Comment

by:rumblefiz
ID: 6369191
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
 
LVL 1

Expert Comment

by:rumblefiz
ID: 6369214
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
 
LVL 1

Accepted Solution

by:
rumblefiz earned 150 total points
ID: 6369225
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
 

Author Comment

by:kinezul
ID: 6375508
Thank's for all
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question