Re: why does this simple counter fail?

2011-03-25 Thread Gary Kline
On Sat, Mar 26, 2011 at 02:30:09AM +0100, Polytropon wrote: > On Fri, 25 Mar 2011 21:12:08 -0400, Brad Mettee > wrote: > > Gary Kline wrote: > > > I'M trying to decide whether to tatoo this on my forehead or > > > just make a note in my ~/.notes file for the next time this > > > breaks. if

Re: why does this simple counter fail?

2011-03-25 Thread Polytropon
On Fri, 25 Mar 2011 21:12:08 -0400, Brad Mettee wrote: > Gary Kline wrote: > > I'M trying to decide whether to tatoo this on my forehead or > > just make a note in my ~/.notes file for the next time this > > breaks. if/when. Meanwhile, the best thingt to do would simply > > write

Re: why does this simple counter fail?

2011-03-25 Thread Brad Mettee
Gary Kline wrote: I'M trying to decide whether to tatoo this on my forehead or just make a note in my ~/.notes file for the next time this breaks. if/when. Meanwhile, the best thingt to do would simply write a script to turn If you do the Otherwise you'll like

Re: why does this simple counter fail?

2011-03-25 Thread Gary Kline
On Fri, Mar 25, 2011 at 05:53:11PM +0100, Fr?d?ric Perrin wrote: > Gary Kline writes: > > On Fri, Mar 25, 2011 at 06:36:34AM -0500, Ryan Coleman wrote: > >> Look for short tags. Turn that on. > >> > >> > > > I didn't know that I had the option of using short flags or not. Where > > do I set that

Re: why does this simple counter fail?

2011-03-25 Thread Frédéric Perrin
Gary Kline writes: > On Fri, Mar 25, 2011 at 06:36:34AM -0500, Ryan Coleman wrote: >> Look for short tags. Turn that on. >> >> > I didn't know that I had the option of using short flags or not. Where > do I set that? (I'm sure there are more places where i have " "?>" rather than ""; be nice to

Re: why does this simple counter fail?

2011-03-25 Thread Ryan Coleman
That would cause a lot of file hanging, with locking, if you get any decent amount of traffic... I'd just stick to the simple TXT counter for the time being. If you did a mass file, your best bet would be to use arrays and serialize the data... but that's a lesson for another day. On Mar 25,

Re: why does this simple counter fail?

2011-03-25 Thread Gary Kline
On Fri, Mar 25, 2011 at 06:36:34AM -0500, Ryan Coleman wrote: > You're using a completely stock php.ini file. > > Look for short tags. Turn that on. > > > I don't see why you need the file name in the file itself... just have a > number there. Much faster on the CPU. True enough. I

Re: why does this simple counter fail?

2011-03-25 Thread Ryan Coleman
You're using a completely stock php.ini file. Look for short tags. Turn that on. On Thu, Mar 24, 2011 at 06:25:39PM -0500, Ryan Coleman wrote: >> Gary, you missed the put... fput($fp, $file); means you're dropping the >> filename INTO the storage file. > > > okay. [maybe]. i think wha

Re: why does this simple counter fail?

2011-03-24 Thread Gary Kline
On Thu, Mar 24, 2011 at 06:25:39PM -0500, Ryan Coleman wrote: > Gary, you missed the put... fput($fp, $file); means you're dropping the > filename INTO the storage file. okay. [maybe]. i think what the script does is create ./countdir/$file ; in this case, ./countdir/index whe

Re: why does this simple counter fail?

2011-03-24 Thread Ryan Coleman
Gary, you missed the put... fput($fp, $file); means you're dropping the filename INTO the storage file. On Mar 24, 2011, at 6:00 PM, Gary Kline wrote: > On Wed, Mar 23, 2011 at 07:11:15PM +0100, Fr?d?ric Perrin wrote: >> Gary Kline writes: >>> Can any of you php hackers tell me why this s

Re: why does this simple counter fail?

2011-03-24 Thread Gary Kline
On Wed, Mar 23, 2011 at 07:11:15PM +0100, Fr?d?ric Perrin wrote: > Gary Kline writes: > > Can any of you php hackers tell me why this simple self-hacked > > counter bomb? > > As others said, what does 'this simple counter bomb' means? > > > $fp = fopen($directory.$file, "r+"); >

Re: why does this simple counter fail?

2011-03-24 Thread Ryan Coleman
Here's a quick and dirty option... FIRST make sure your permissions on the folder you want to write the countfile to is either at RWX to all or is owned by the Apache run user (PHP by default runs under the Apache Service user). I ran this in file test.php on my server. Give it a whirl. On Ma

Re: why does this simple counter fail?

2011-03-24 Thread Brad Mettee
Gary Kline wrote: On Wed, Mar 23, 2011 at 11:47:16AM -0500, Ryan Coleman wrote: Do you have an error for it? If not... add after the first save the bandwidth... Ok, i added the error_reporting line to both scripts. No change from the count.php, and the same output as prev f

Re: why does this simple counter fail?

2011-03-24 Thread Gary Kline
On Wed, Mar 23, 2011 at 11:47:16AM -0500, Ryan Coleman wrote: > Do you have an error for it? > > If not... add after the first error_reporting(9); > > And see what it reports. > > -- > Ryan > PHP dev. > save the bandwidth... Ok, i added the error_reporting line to both scripts. No

Re: why does this simple counter fail?

2011-03-24 Thread Ryan Coleman
Check your apache error_log, too. On Mar 24, 2011, at 12:56 PM, Gary Kline wrote: > On Wed, Mar 23, 2011 at 11:47:16AM -0500, Ryan Coleman wrote: >> Do you have an error for it? >> >> If not... add after the first > error_reporting(9); >> >> And see what it reports. > > > There were no

Re: why does this simple counter fail?

2011-03-24 Thread Gary Kline
On Wed, Mar 23, 2011 at 11:47:16AM -0500, Ryan Coleman wrote: > Do you have an error for it? > > If not... add after the first error_reporting(9); > > And see what it reports. There were no errors that should up when i launched this script on www.thought.org; it simply failed;

Re: why does this simple counter fail?

2011-03-23 Thread Frédéric Perrin
Gary Kline writes: > Can any of you php hackers tell me why this simple self-hacked > counter bomb? As others said, what does 'this simple counter bomb' means? > $fp = fopen($directory.$file, "r+"); > flock($fp, 1); You want an exclusive lock (LOCK_EX, which is 2 is

Re: why does this simple counter fail?

2011-03-23 Thread Ryan Coleman
On Mar 23, 2011, at 12:14 PM, Paul Macdonald wrote: > On 23/03/2011 16:45, Gary Kline wrote: >> Guys, >> >> Can any of you php hackers tell me why this simple self-hacked >> counter bomb? >> >> appended. >> >> tia. > $file doesn't look to be set anywhere > > if its a

Re: why does this simple counter fail?

2011-03-23 Thread Paul Macdonald
On 23/03/2011 16:45, Gary Kline wrote: Guys, Can any of you php hackers tell me why this simple self-hacked counter bomb? appended. tia. $file doesn't look to be set anywhere if its a web script ( as opposed to cmd line cli) tyhen its probably passed

Re: why does this simple counter fail?

2011-03-23 Thread Ryan Coleman
On a side note, I'd nix $count += 1; for $count++; -- ryan On Mar 23, 2011, at 11:45 AM, Gary Kline wrote: > > Guys, > > Can any of you php hackers tell me why this simple self-hacked > counter bomb? > > appended. > > tia. > > -- > Gary Kline kl...@thought.

Re: why does this simple counter fail?

2011-03-23 Thread Ryan Coleman
Do you have an error for it? If not... add after the first > Guys, > > Can any of you php hackers tell me why this simple self-hacked > counter bomb? > > appended. > > tia. > > -- > Gary Kline kl...@thought.org http://www.thought.org Public Service Unix >

why does this simple counter fail?

2011-03-23 Thread Gary Kline
Guys, Can any of you php hackers tell me why this simple self-hacked counter bomb? appended. tia. -- Gary Kline kl...@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org