Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Mar 2011 10:56:02 -0700
From:      Gary Kline <kline@thought.org>
To:        Ryan Coleman <editor@d3photography.com>
Cc:        FreeBSD Mailing List <freebsd-questions@FreeBSD.ORG>
Subject:   Re: why does this simple counter fail?
Message-ID:  <20110324175602.GC15209@thought.org>
In-Reply-To: <B322245C-7251-45B7-A29A-D9DAC9F54AAC@d3photography.com>
References:  <20110323164504.GA25317@thought.org> <B322245C-7251-45B7-A29A-D9DAC9F54AAC@d3photography.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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
> > 
> > <!--
> > //
> > //	$Id: count.php,v 1.2 2004/01/22 21:58:48 kline Exp kline $
> > //
> > --!>
> > 
> > <?php
> > 
> > $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);
> > ?>
> > 
> > 	<CENTER>
> > 	<FONT COLOR="#333366">  <!---  rich dark bluegrey --->
> > 	<FONT SIZE="2">
> > 
> > <?
> >        print " there have been ";
> > ?>
> > 
> > 	<FONT SIZE="+1">
> > 	<FONT COLOR="#FF0000">
> > 
> > <?
> > print $count;
> > ?>
> > 
> > 	</FONT>
> > 	</FONT>
> > <?
> > print "hits\n";
> > ?>
> > 
> > 	</CENTER>
> > 
> > <?
> > 
> > } 
> > 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110324175602.GC15209>