[ciapug] suggestions on reading a log file

Barry Buelow bjbuelow at yahoo.com
Sun Apr 2 21:31:49 CDT 2006


Hello,
 
 I've been lurking for a few months and trying not to embarass myself by asking too stupid a question, but neither my, nor your, luck can last forever.  
 
 1.   I'm working on a web page that will be on a commercial hosting site (tbd).  Past experience with these sites is that they have a common error log file.  I usually look at the "tail" of it.  
 
 It struck me that I could have a php page go get the "tail" and strip it down to items from my site.  Something like the last 10 matched substring.  Reading the entire huge file doesn't seem like a good idea.  Nor do I want to do anything that is a major load on the system.  The only idea I have is to open the log file in read mode, then replicate the "tail" function using file pointer manipulation.  
 
 Is there a way to copy the last 1000 lines or some other interesting trick?
 Any suggestions?
 
 
 2.  What is recommended practice for processing form data to prevent attacks?  
 addslashes?
 escape_shell_cmd?
 string length limiting?
 other?
 Is there a particular web page that lists best practices for security?
 
 tia,
 Barry
 
 
 
 ================
 I'm 56, live in the Cedar Rapids area, have a BSCS which is now yellow and curled.  
 Written: pascal, pl1, assembly, c(not ++), nearly all of it embedded,  haven't learned a new language in ages as career moves have taken me away from sw.  Read 3 books on php and digging in, but have to "real world" experience.  
 
 
 
 
 
 




More information about the ciapug mailing list