#!/usr/local/bin/perl ### daylogger.pl ################################################################# # Logs hits, sends e-mail daily to whatever address you give # # This program is not perfect, so you may have to change a # few lines. # # Lots of comments, as a good programmer, you should comment # too! Make it a habit! # # You need to set the priv (chmod) for each file manually. # # You can use or modifiy this free of charge so long as # this notice and the comments remain intact. By using this # code you agree to indemnify No Crash or it's owners from any # liability that might arise from it's use. # # Selling the code for this program without prior written # consent is expressly forbidden. # # For more examples and free sources, visit www.nocrash.com ################################################################# ### My Local Variables ### You may need to change the path to sendmail. $mail_program = "/usr/lib/sendmail -t"; $from = "yoursite.com "; $send_to = "you\@yoursite.com, me\@yoursite.com"; $pager_to = "yourtextpager\@yoursite.com, mytextpager\@yoursite.com"; $dateFile = "datefile.txt"; $logFile = "logfile.txt"; $doit = 0; $lock = 2; # 2 | 4 = 6, lock it exclusively & non-blocking $unlock = 8; # unlock the file # LOCK_SH { 1 } requests a shared lock # LOCK_EX { 2 } requests an exclusive lock # LOCK_NB { 4 } is added, will return immediately rather than blocking waiting for the lock # LOCK_UN { 8 } releases a previously requested lock ### ### Main body of script ### &gettime; &dolog; # always write to the logfile &inchits; # increment the hit file ### If you call this by ### and the browser or server needs us to print to it or else it errors, who knows why.. ### the following line doesn't really show anything. ### only use whatever printing message your server needs to call this properly! ###print ("Content-type: image/x-xbitmap\n\n"); ###printf ("#define count_width 1\n#define count_height 1\n"); ###print("0x00"); ### If you call this by