Date: Thu, 24 Mar 2011 13:18:36 -0500 From: Ryan Coleman <editor@d3photography.com> To: Gary Kline <kline@thought.org> Cc: FreeBSD Mailing List <freebsd-questions@FreeBSD.ORG> Subject: Re: why does this simple counter fail? Message-ID: <3842AB1E-D93A-43C6-BFA5-8333BF10E4FD@d3photography.com> In-Reply-To: <20110324175602.GC15209@thought.org> References: <20110323164504.GA25317@thought.org> <B322245C-7251-45B7-A29A-D9DAC9F54AAC@d3photography.com> <20110324175602.GC15209@thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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? >>=20 >> If not... add after the first <? >> error_reporting(9); >>=20 >> And see what it reports. >=20 >=20 > 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, >=20 > gary >=20 >=20 >>=20 >> -- >> Ryan >> PHP dev. >>=20 >>=20 >> On Mar 23, 2011, at 11:45 AM, Gary Kline wrote: >>=20 >>>=20 >>> Guys, >>>=20 >>> Can any of you php hackers tell me why this simple self-hacked >>> counter bomb? >>>=20 >>> appended. >>>=20 >>> tia. >>>=20 >>> --=20 >>> 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 >>>=20 >>> <!-- >>> // >>> // $Id: count.php,v 1.2 2004/01/22 21:58:48 kline Exp kline $ >>> // >>> --!> >>>=20 >>> <?php >>>=20 >>> $directory=3D"./countdir/"; >>>=20 >>> if (! (file_exists( ($directory.$file)) )) >>> { >>> if (! ($fp =3D 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); >>> } >>> } >>>=20 >>> if (file_exists( ($directory.$file))) >>> { >>> $fp =3D fopen($directory.$file, "r+"); >>> flock($fp, 1); >>> $count =3D fgets($fp, 4096); >>> $count +=3D 1; >>> fseek($fp,0); >>> fputs($fp, $count); >>> fputs($fp, "\n"); >>> fputs($fp, $file); >>>=20 >>> flock($fp, 3); >>> fclose($fp); >>> ?> >>>=20 >>> <CENTER> >>> <FONT COLOR=3D"#333366"> <!--- rich dark bluegrey ---> >>> <FONT SIZE=3D"2"> >>>=20 >>> <? >>> print " there have been "; >>> ?> >>>=20 >>> <FONT SIZE=3D"+1"> >>> <FONT COLOR=3D"#FF0000"> >>>=20 >>> <? >>> print $count; >>> ?> >>>=20 >>> </FONT> >>> </FONT> >>> <? >>> print "hits\n"; >>> ?> >>>=20 >>> </CENTER> >>>=20 >>> <? >>>=20 >>> }=20 >>> else >>> { >>> print "Can't find file, check '$directory.$file'\n"; >>> } >>>=20 >>> ?> >>>=20 >>> _______________________________________________ >>> 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" >>=20 >=20 > --=20 > 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 >=20 > _______________________________________________ > 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"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3842AB1E-D93A-43C6-BFA5-8333BF10E4FD>