From owner-freebsd-questions@FreeBSD.ORG Thu Mar 24 17:56:03 2011 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8F6D106566C for ; Thu, 24 Mar 2011 17:56:03 +0000 (UTC) (envelope-from kline@thought.org) Received: from thought.org (plato.thought.org [209.180.213.209]) by mx1.freebsd.org (Postfix) with ESMTP id 8612E8FC1A for ; Thu, 24 Mar 2011 17:56:03 +0000 (UTC) Received: by thought.org (Postfix, from userid 1001) id 94D9AE80473; Thu, 24 Mar 2011 10:56:02 -0700 (PDT) Date: Thu, 24 Mar 2011 10:56:02 -0700 From: Gary Kline To: Ryan Coleman Message-ID: <20110324175602.GC15209@thought.org> References: <20110323164504.GA25317@thought.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: With 24 years of service to the Unix community. User-Agent: Mutt/1.5.20 (2009-06-14) Cc: FreeBSD Mailing List Subject: Re: why does this simple counter fail? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2011 17:56:03 -0000 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; no output. ...Another php script that output a random string on the same page did have errors. I thought i would try this simpler script first. will add the err line and retry, tx, gary > > -- > Ryan > PHP dev. > > > 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 kline@thought.org http://www.thought.org Public Service Unix > > Journey Toward the Dawn, E-Book: http://www.thought.org > > The 7.98a release of Jottings: http://jottings.thought.org > > > > > > > > > > > $directory="./countdir/"; > > > > if (! (file_exists( ($directory.$file)) )) > > { > > if (! ($fp = fopen( ($directory.$file), "w")) ) > > { > > echo "Can't create file '$directory.$file'"; > > exit(1); > > } > > else > > { > > fseek($fp,0); > > fputs($fp, $count); > > fputs($fp, "\n"); > > fputs($fp, $file); > > fclose($fp); > > } > > } > > > > if (file_exists( ($directory.$file))) > > { > > $fp = fopen($directory.$file, "r+"); > > flock($fp, 1); > > $count = fgets($fp, 4096); > > $count += 1; > > fseek($fp,0); > > fputs($fp, $count); > > fputs($fp, "\n"); > > fputs($fp, $file); > > > > flock($fp, 3); > > fclose($fp); > > ?> > > > >
> > > > > > > > > print " there have been "; > > ?> > > > > > > > > > > > print $count; > > ?> > > > > > > > > > print "hits\n"; > > ?> > > > >
> > > > > > > } > > else > > { > > print "Can't find file, check '$directory.$file'\n"; > > } > > > > ?> > > > > _______________________________________________ > > freebsd-questions@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" > -- Gary Kline kline@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 7.98a release of Jottings: http://jottings.thought.org