home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Internet / WWW / Perl_WWW_Utilities / total / counter / README < prev   
Encoding:
Text File  |  1996-01-11  |  16.1 KB  |  334 lines

  1. # Counter Script
  2. # Created by Matt Wright        mattw@misha.net
  3. # Created on: 10/27/95          Last Modified on: 1/11/96
  4. # Version 1.1.1
  5. # Matt's Script Archive:    http://www.worldwidemart.com/scripts/
  6. ##############################################################################
  7. # If you run into any problems while trying to configure this scripts, help  #
  8. # is available.  The steps you should take to get the fastest results, are:  #
  9. #       1) Read this file thoroughly                         #
  10. #       2) Consult the Matt's Script Archive Frequently Asked Questions:     #
  11. #               http://www.worldwidemart.com/scripts/faq/             #
  12. #       3) If you are still having difficulty installing this script, send   #
  13. #          e-mail to: scripts-help@tahoenet.com                     #
  14. #          Include any error messages you are receiving and as much detail   #
  15. #          as you can so we can spot your problem.  Also include the variable#
  16. #          configuration block that is located at the top of the script.     #
  17. #                                         #
  18. # Hopefully we will be able to help you solve your problems.  Thank you.     #
  19. ##############################################################################
  20.  
  21. This counter script is built for users to be able to create a counter 
  22. program in-lined into their home page without having to use Server Side 
  23. Includes.
  24.  
  25. To use this counter program, you will need to go get a program called 
  26. FLY, which allows an easy interface into the GD graphics library, which 
  27. is written in C.  I easily compiled fly without any problems on several 
  28. different machines:  SunOS, OSF 3.2, and more.  You can get FLY at:
  29.  
  30. http://www.unimelb.edu.au/fly/fly.html
  31.  
  32. But it is necessary to have this or else my counter program will not work. Version 1.1 of my counter program was written to correspond with version 1.1 of FLY and you will need to upgrade if you are still using version 1.0 of FLY.
  33.  
  34. My counter program comes with 7 files:
  35.  
  36.         1) counter.pl      - The Counter Program Itself.
  37.         2) count.txt       - The data file that holds the counter number.
  38.         3) access_log      - Log file of accesses to your counter.
  39.         4) error_log       - Log file of errors your counter has produced.
  40.         5) html_log.pl     - Produce nice HTML file of access_log.
  41.     6) bad_referer.gif - The Bad Referer Error Image
  42.     7) README       - Detailed Installation Instructions (This file)
  43.     8) There is also an explanation about digits.
  44.  
  45. Each file requires something to be done to it.  Below is a description of 
  46. how to install the counter program and make it work on your system.
  47. _________________________________________________________________________
  48.  
  49.                               COUNTER.PL
  50.                               ==========
  51.  
  52. This is by far the hardest part of the setup.  There are a lot of options 
  53. and variables you will need to define and set to proper locations on your 
  54. system.  Although it may seem as though there are a lot of different 
  55. variables and options, it adds a lot of flexibility to the counter.  You 
  56. will need to place this file in the cgi-bin on your server and make sure 
  57. you chmod it 755 so that it is readable and executable by your server's uid.
  58.  
  59. #######################################################################
  60. # Define Variables
  61.  
  62.     ### FILE AND DIRECTORY LOCATIONS, REFERERS ###
  63.  
  64. $count_file = "/home/user/counter/count.txt";
  65.     The count file is the file in which the number of accesses will 
  66. be displayed.  It is not a good idea to edit this file by hand as it can 
  67. cause pesky new line characters, or may mess up the number.  Use 
  68. new_count.pl to start with a different number, or simply start with the 
  69. default value which is 0.
  70.  
  71. $digit_dir = "/home/user/counter/digits/XXXX";
  72.     This is the directory that the digits for your counter are in.  
  73. In this directory, you must have files numbered 0.gif - 9.gif.  They must 
  74. all be of equal width and height for this counter to work.  I may make it 
  75. more flexible in the next version.
  76.  
  77. $access_log = "/home/user/counter/access_log";
  78.     This counter also comes with the option of having logs with it, 
  79. including a perl script which will nicely format results into a cool html 
  80. page.  You don't have to worry about the path to this file if you turn 
  81. the $uselog variable off, but if you set $uselog to 1, then make sure 
  82. you have the correct path to a file called access_log and that  this file 
  83. and the directory it is in is readable and writable by the web server 
  84. uid.  This means chmod them 777.
  85.  
  86. $error_log = "/home/user/counter/error_log";
  87.     This is the same as the access_log above, except for the fact 
  88. that this file will contain any errors that users may get when trying to 
  89. access your counter.  This is currently limited to a Time Out and a Bad 
  90. Referer.  Please note that these should be the paths to your local 
  91. access_log and error_log files that come with this script. Do not link 
  92. them to your main error and access_log files.
  93.  
  94. $flyprog = "/home/user/counter/fly/fly";
  95.     The fly program is required for this counter program to work.  It 
  96. is easy to install and once you do, make sure you chmod the 'fly' 
  97. program file 755 o anyone can execute it and then change the above 
  98. example path to the path of your real fly program.
  99.  
  100. $fly_temp = "/home/user/counter/fly_temp.gif";
  101.     For this script to work it will need to have a temporary file to which it can print commands for fly to execute.  This file will be generated by the script the first time it is run and each time it is run it will be deleted.  Should someone stop the loading process in the middle of execution and this file not get deleted it will just be overwritten the next time the script is called.
  102.  
  103. $bad_referer_img = "http://your.host.xxx/counter/images/bad_referer.gif";
  104.     This should be the url to the bad_referer.gif that comes with 
  105. this package.  It will be the image that is sent out to people if they 
  106. attempt to access your counter from a page that is not in the @referers 
  107. variable.
  108.  
  109. @referers = ("www.host.com","host.com","your.host.com","129.46.75.89");
  110.     This variable should be set the server names that are allowed to 
  111. access your counter.  For example, you would want your.host.xxx, 
  112. www.host.xxx, and possibly the IP numbers as well and any other names 
  113. under which servers your page can be accessed.
  114.  
  115.     ### IMAGE SETTINGS ###
  116.  
  117. $width = "15";
  118. $height = "20";
  119.     The above two variables should be the width and height for a 
  120. single image labeled 1 - 9.  They must each have the same width and 
  121. height.  A future version of this script may allow for you to use 
  122. different widths and heights, but for now, stick to sets of images that 
  123. all have the same width and height for each image.  The width and height 
  124. are given on all of the digits I have at my site, but you may have to 
  125. download others and manually get the image size if you use outside gifs.
  126.  
  127. $tp = "X";
  128.     This will set your transparency color.  If you leave this 
  129. variable at X, it will assume you don't want to make any color in your 
  130. images transparent. If you do want to make something transparent, put the 
  131. rgb color code in for this variable.  If you want to make black 
  132. transparent, you would set $tp = "0,0,0"; or if you wanted the white color 
  133. to be transparent you would set $tp = "255,255,255";
  134.  
  135. $il = "1";
  136.     You can also have your counter image interlaced.  Set this 
  137. variable to 1 if you want it interlaced and 0 if you do not.
  138.  
  139. $frame_width = "3";
  140.     This counter program also allows you to have a frame around your 
  141. counter image.  If you want a frame around your counter number, simply 
  142. set this value to a number greater than 0.  0 will make it so that you do 
  143. not have a frame.  The numbers represent the width of the frame in pixels.
  144.  
  145. $frame_color = "255,255,255";
  146.     If you set your counter to have a frame_width value greater than 0, 
  147. then you must set this variable to the color that you want your frame to 
  148. be in.  Colors should be in the rgb color scheme, so again setting this 
  149. variable to '0,0,0' would give you a black border and setting it to 
  150. '255,255,255' would give you a white border.
  151.  
  152. $dot = "X";
  153.     Setting this value to 1 will cause the script to return a single 
  154. transparent pixel, and yet your log files will still be updated.  This is 
  155. useful if you want to be able to use the logging sequence, but don't have 
  156. server side includes to implement a real logging program.  Users will 
  157. not even be able to tell that the dot is there.
  158.  
  159. $logo = "X";
  160.     This is the same function as $dot, in that it will do the logging 
  161. for you, without people really noticing a counter, except if you set this 
  162. value to a url of a real logo or image of some kind, that image will be 
  163. returned in place of this counter script and the log will be updated with 
  164. information.
  165.  
  166.     ### OPTIONS ###
  167.  
  168. $max_time = "7";
  169.     The max time variable is set to the maximum number of seconds you 
  170. want your user to wait before receiving the time_out error image.  The 
  171. error message will be sent out if the counter program is still in use by 
  172. another client and it has had to wait $max_time seconds for the other 
  173. client to finish.
  174.  
  175. $uselog = "1";    # 1 = YES; 0 = NO
  176.     If you want to use the logging features of this script, set this 
  177. variable to 1, otherwise turn it to 0.
  178.  
  179. # Done
  180. #######################################################################
  181.  
  182. Congratulations.  You made it through the most difficult file to configure!
  183. _________________________________________________________________________
  184.  
  185.                               COUNT.TXT
  186.                               =========
  187.  
  188. If you wish to start with a different number than 1, simply open up this 
  189. file and type in your new counter number.  Then the script will display 
  190. this number the next time.
  191.  
  192. _________________________________________________________________________
  193.  
  194.                               HTML_LOG.PL
  195.                               ===========
  196.  
  197. This file can be used to generate a nice HTML 3 Table formatted document 
  198. of your access_log.  It still looks nice in other browsers  that do not 
  199. support 3.0 though.  There is a little configuring you will have to do 
  200. with this file.  The major change in this file from version 1.0 is that you can choose whether you woudl like to be able to access this file through the web or run it at the prompt.  If you have huge stat files you will probably wan tot run it at a unix prompt and redirect the output to a file, so that you don't have to regenerate stats every time you want to view them.  ON the other hand, if you don't have telnet access or dial up access to a unix prompt you will want to set the $web option to 1 so that you can just call this script through the web and it will generate the stats on the fly.
  201.  
  202. ###################################################################
  203. # Define Variables
  204.  
  205. $web = 1;
  206.     This option allows you to configure the script to either run from the web or to be used as a program that you runb at the prompt and redirect output.  If you choose to set this to '1', then you can simply call the program as a web page, however if you choose to set this to 0, you should run this at the prompt like: 
  207.  
  208.     html_log.pl > stats.html
  209.  
  210. $log_file = "/home/user/counter/access_log";
  211.     This should be defined exactly the same as you defined 
  212. $access_log in your counter.pl file.  Simply the system path to the 
  213. access_log file that my counter program creates.
  214.  
  215. $min_remote = "10";
  216.     This is the minimum number of accesses a remote host must have 
  217. for them to make your html list.
  218.  
  219. $min_agent = "5";
  220.     This is the minimum number of times a browser must access your 
  221. page before it shows up in your list of browsers accessing your page.
  222.  
  223. # Done
  224. ###################################################################
  225.  
  226. ###################################################################
  227. # Select Options
  228.  
  229. $expand_agent = 0;      # 0 = NO; 1 = YES
  230.     If this is set to zero, then the user agents will be grouped by 
  231. the main portion of their USER_AGENT environment variable.  If you set 
  232. this to 1, then they will stay as is and you will see several entries of 
  233. the same browser, but for different platforms.  Setting it to 0 provides a 
  234. much nicer and more compact read out.
  235.  
  236. $show_percent = 1;      # 0 = NO; 1 = YES
  237.     This will allow you to show the percentage that a certain item 
  238. takes up.  For instance, if you have 5000 accesses to your page and 500 
  239. of them are from someone else's page, a 10% will be shown next to it, if 
  240. you set this variable to 1.  Setting it to zero makes it more compact, 
  241. but in my opinion, setting it to 1 is nice.
  242.  
  243. $title = "Access Statistics for My Home Page";
  244.     Title provides the title and heading for your access statistics page.
  245.  
  246. $title_url = "http://my.domain.xxx/mypage.html";
  247.     This is the url to the page in which you are showing accesses.  
  248. For instance, if I have the counter on:  
  249. http://my.domain.xxx/mypage.html.  You would set this variable to that page.
  250.  
  251. # Done
  252. ###################################################################
  253. _________________________________________________________________________
  254.  
  255.                          ACCESS_LOG & ERROR_LOG
  256.                          ======================
  257.  
  258.     These files simply need to be placed in the spot that is 
  259. indicated in the $access_log and $error_log variables in counter.pl.  
  260. They also need to be chmoded 777 so that they can be written to by the 
  261. web server uid.  The directory they are in should also be chmoded 777.
  262.  
  263. _________________________________________________________________________
  264.  
  265.                            BAD_REFERER.GIF
  266.                            ===============
  267.  
  268.     This image file needs to be placed in the spot indicated by the 
  269. $bad_referer.gif variables in the counter.pl file.  It needs to be chmoded 744 so that it is readable by everyone and so that the web server can link to them in case of a time out.
  270.  
  271. _________________________________________________________________________
  272.  
  273. COUNTER DIGITS
  274. ==============
  275.  
  276. My program does not currently come with a standard set of digits.  This 
  277. is because I just haven't had the time to make a bunch of counter 
  278. images.  There are plenty of places out on the internet that provide free 
  279. counter images, and all you have to do, is download a set of them, 
  280. configure the directory they are in, change all the names to 0.gif - 
  281. 9.gif and then get the width and height in pixels.  Many graphics 
  282. programs can easily do this.  Here are some sites below that have counter 
  283. digits:
  284.  
  285. YAHOO
  286. http://www.yahoo.com/Computers_and_Internet/World_Wide_Web/Programming/Access_Counts/
  287. They have a lot of links to counter places.
  288.  
  289. DIGIT MANIA
  290. http://cervantes.comptons.com/digits/digits.htm
  291. Great counter images, all in one place!
  292.  
  293. Let me know if you have any problems with the counter images!
  294.  
  295. CALLING THE SCRIPT
  296. ==================
  297.  
  298. I accidentally left out the part about how to call this program in my previous release.  You simply can call this program like you would call any other image or background picture.  Examples are shown below:
  299.  
  300.     <img src="http://www.your.host.xxx/path/to/counter.pl">
  301.  
  302. That will give you the standard counter image, andyou can put <center> tags around it or position it however you like on your web page.
  303.  
  304. You can also make your counter the bacground image for your page, although it will probably look pretty tacky, just use:
  305.  
  306.     <body background="http://www.your.host.xxx/path/to/counter.pl">
  307. _________________________________________________________________________
  308.  
  309. HISTORY
  310. =======
  311.  
  312. VERSION 1.0    - 11/25/95    - Released the first version of this script.
  313. VERSION 1.1    - 12/31/95    - Version fixed to run with new version of                   FLY.
  314.                 - Problems with time outs and images not                   getting erased partly solved.
  315.                 - Description of how to put the counter                   image into your web page added.
  316.                 - Other Minor Details Fixed.
  317. VERSION 1.1.1    - 1/11/96    - Small Bug in HTML_LOG.pl Fixed.
  318. _________________________________________________________________________
  319.  
  320. Need more help?
  321.  
  322.     People often have small problems setting up many of my scripts, 
  323. and that is what led me to create the Matt's Script Archive Frequently 
  324. Asked Questions.  You can reach this helpful place by pointing your web 
  325. browser to:
  326.  
  327.         http://worldwidemart.com/scripts/faq/
  328.  
  329.     If you encounter a problem that is not in the FAQ, feel free to 
  330. write to me, and I will do my best to help you solve whatever you are 
  331. having trouble with.
  332. _________________________________________________________________________
  333. Matt Wright - mattw@misha.net - http://www.worldwidemart.com/scripts/
  334.