Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Hit counter for a flash document

Posted on 2001-07-30
14
Medium Priority
?
266 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 600 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

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!

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

609 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