----- Original Message ----- From: <[EMAIL PROTECTED]> Sent: Wednesday, October 01, 2008 1:58 AM Subject: Re: [php-list] Log files
> ----- Original Message ----- > From: "Bob" > > <snip> > $logdata = file_get_contents($logfile); > $nline = strpos($logdata, "\n", 500); > $newdata = substr($logdata, $nline); > <snip> > ------------------------------------ > Hi Bob, > You are still reading the whole file into memory. > > Can you tell me again what version of php you are running? I will set up > your version of php in a WAMP here for testing. > > File locking is only required if more then one script (or thread) can access > the log files. > > I assume you are on linux, windows is different for file locking. > > Rob. Hi Rob, Yes, linux and php 4.4 but please don't install another version of php just for me, but thanks anyway. My site is a hobby site, but it seems to attract so much abuse. I've had quite a few DOS attacks, but the shared server is DOS protected (limited max per minute). My previous log managed to record 3 attempts per second with no trouble. This stops my visitors seeing the site though, but the max they can afford to keep this up is usually about 2 hours, or their other spam doesn't get delivered. It's just a simple log file I'm trying to create, and it's just to record the failed attempts to spam me. It's not a full blow error log like the server logs provides. I get one genuine message per month (and did get over a100 spam attempts per day). Since I send the "Double Hit" and "Preset Post" messages etc. to a non-existant page, it's all more or less stopped now. This seems to really bugger up their spam list program. I'm not sure whether eveyone knows what a Double Hit is, but it defeats cookie or session protection. No idea how they do it though? In the past 2 days, I've had only 3 Double Hits, 2 Preset Posts, and 3 Profanity errors. Sending them to a non-existant site is causing them to get really annoyed and *try* to swear at me. I originally created a rolling road log (using a array <yes, bad idea>) to display to the spammer his errors, with an arrow pointing to his latest attempt. This drove them crazy and they tried to bring my site down. If I put my nice CATCHA image back on, it would all stop, but I like the challenge, he-he! Re: You are still reading the whole file into memory. If that's what $logdata = file_get_contents($logfile); does, then yes. If I don't, how can I find half of it, then find the next line break to write to the updated file? Re: File locking is only required if more then one script (or thread) can access the log files. I didn't know that, so it isn't needed in my case. Thanks, Bob E. ------------------------------------ Please remember to write your response BELOW the previous text. Community email addresses: Post message: php-list@yahoogroups.com Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-listYahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/php-list/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/