Solved

Hit counter for a flash document

Posted on 2001-07-30
14
252 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
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
 
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now