###################################################################
#                                                                 #
#           README                                                #
#       shcounter_multi V1		                                  #
#                                                                 #
#  Author: Seungho Choo                                           #
#  EMail: choo_sh@yahoo.com                                       #
#  URL: http://tangible.new21.org                                 #
#                                                                 #
###################################################################

#License
You may modify and distribute it for non-commercial use only.
Please, leave the name and e-mail address of the original author when you distribute it.
-----------------------------------------------------------------------------------------------------
#Feature
- this flash movie and cgi allow you to serve multiple users without changing the flash movie or creating
 another flash movies.
- each user can set the title of counter, select language for labels and adjust the interval between motions 
- display the today's, yesterday's, each visitor's  and total hit numbers.
- display date, time
-----------------------------------------------------------------------------------------------------
#Attention
Your server must be capable of executing perl scripts.
Flash5 plug-in is required to view on client side.
-----------------------------------------------------------------------------------------------------
#Installation
1. unzip 
- shcounter_multi.fla			: flash 5 (editable) file.
- shcounter_multi.swf			: shockwave file complied with flash 5
- shcounter_multi.cgi			: perl script 
- language/korean			: text file
- README_multi(english).txt	: you are reading

2.Upload
shcounter_multi.swf
shcounter_multi.cgi - You must know where you should upload cgi scripts. 
		Some servers only allow cgi file in specific directories like "cgi-bin".
3.create folder
 log			: where you store data
 language		: where you put or create language specific label data

* general hierarchy of shcounter_multi
  shcounter_multi -|--- shcounter_multi.html
			   |--- shcounter_multi.swf
			   |--- shcounter_multi.cgi //or somewhere else cgi is allowed
			   |--- log ---- user1.log  //actual data 
			   |		|-  user2.log	
			   |--- language---
						|-- korean
						|-- german
						|-- ......
			
4.Permission
log			:chmod 766
shcounter.cgi	:chmod 755
-----------------------------------------------------------------------------------------------------
#Apply
	
1.variables

// define variables

Six variables must be set by adding a long query string as follows at the end of the url of this movie 
 in the HTML document.

//for instance,
shcounter_multi.swf?cgilocation=http://cgipath&id=userid&title=titlehere&language=korean&laguageBase=http://yoursite/labeldatadirectory&pauseTime=5

//apply to html tag
	<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
		codebase="h ttp://download.macromedia.com/ pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
		WIDTH=120 HEIGHT=40>
		<PARAM NAME=movie VALUE="shcounter_multi.swf?cgilocation=http://cgipath&id=userid&title=titlehere&language=korean&languageBase=http://yoursite/labeldatadirectory&pauseTime=5">  
		<PARAM NAME=quality VALUE=high> 
		<PARAM NAME=bgcolor VALUE=#FFFFFF>
		<EMBED src="shcounter_multi.swf?cgilocation=http://cgipath&id=userid&title=titlehere&language=korean&languageBase=http://yoursite/labeldatadirectory&pauseTime=5"
			quality=high 
			bgcolor=#FFFFFF 
			WIDTH=120 HEIGHT=40 
			TYPE="application/x-shockwave-flash" 
			PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
	</EMBED>
	</OBJECT>

//apply to flash movie
if you want to view this counter inside another flash movie, use "load movie" inside from the flash movie
targetMovie.loadMovie("cgilocation=http://cgipath&id=userid&title=titlehere&language=korean&laguageBase=http://yoursite/labeldatadirectory&pauseTime=5");
targetMovie is the instance name of the movie clip where you want to load the counter movie to place.


-. language
 if you set "language=somelanguage", a file named  "somelanguage"  must exist on the server
  then this flash movie will load variables from the file.
  see the brief instruction on how to make label data file on the bottom of this page
-. languageBase 
  if you define languageBase neither inside this  flash movie nor in the html page, the flash movie will assume that the language  file is located 
   on the sub folder "language" based on the location of  the flash movie
   if you provide the service, you'd better set this variable inside the flash movie.
-. cgilocatioin 
  the relative or absolute url of the cgi file "shcounter_multi.cgi";
-. id 
  this is a key variable that  bring the revision of shcounter  forth.
  this will simply work for multi users.
  each id number must be unique from other users'.
-. title 
  the first label to be shown - make it be the title of your site ..^^;
  the length of the string must be within 15 characters
-.pauseTime
  the interval between the roll action.
  the unit is approximately second.

**you can also set all the above variables inside flash movie. Then, the movie will not serve as a generic multi user counter.

2. cgi file
	-1st line //very very important 
	#!/usr/bin/perl 
	- This is the path of perl interpreter on your server. if you don't know the path, ask your server admin 
	  or type "whereis perl" on the console window through telnet.

	-set log file directory
	$log_dir = "./log"; #without slash at the end - set the mode of the folder to 766 or 777
	you can use a relative or absolute path on your server.
	*The absolute paths is different from URLs. See what your FTP program shows on the directory display window. That's the path.
	It's never start from http://.

-----------------------------------------------------------------------------------------------------
#Test run

*Never skip any steps. It'll save your time eventually.

	5-1. call cgi file with "?id=test" directly from web browser 
	If you get error messages, the file permission of the cgi may be wrong.
	5-2. reload
	Reload several time. If the hit numbers insist on 0 or the same, the path or permission of the counter log file on your cgi script may be incorrect.
	5-3. load html pages on your web browser
	If the shcounter.swf looks stopped at 1st frame, the cgilocation may be set incorrectly.
	Check the tag in the html page
-----------------------------------------------------------------------------------------------------
# how to write label data to support different language other than english. 
 you can provide users to choose their own languages so that labels in the flash movie will be shown with their native languages.
 
1. just replace the right-hand side of each line with the language term
//////////////////////////////////////
&labeltoday=&
&labelyesterday=&
&labeltotal=ü&
&labelyou=&
&labelday=¥&
&labeltime=ð&
&loadingSign=Ÿ ε &
&eof=true&
/////////////////////////////////////
2. don't use "&" in the label and don't' remove "&"s in the front and the end of each line or you will confuse the flash movie.
3. save the file with the name of the language
4.upload the the new file to the directory "language"  on your server

-----------------------------------------------------------------------------------------------------
# To do
the ability to check if "id" is already taken and to deal with the case.
-----------------------------------------------------------------------------------------------------
#Bug report
Please,e-mail me at choo_sh@yahoo.com
-----------------------------------------------------------------------------------------------------
#Enjoy!