PDA

View Full Version : Please Help me with a PHP counter


nickp
3-25-02, 02:17 PM
whenever i try to use the following script i get the 500 server error, any help would be aprreciated

#!/usr/local/bin/php
<html>
<?php
$counter_file = "./count1.dat";
if(!($fp = fopen($counter_file, "r"))) die ("Cannot Open $counter_file.");
$counter = (int) fread($fp, 20);
fclose($fp);

$counter++;

echo "You're visitor No. $counter.";

$fp = fopen($counter_file, "w");
fwrite($fp, $counter);
fclose($fp);
?>
</html>

(Note: Count1.dat is the file that keeps track of how many people visited)

MannInc
3-25-02, 03:04 PM
The counter code is valid. Have you uploaded the php file in ASCII mode and CHMODed it to 755?

nickp
3-25-02, 05:36 PM
well i know its uploaded in ASCII, but i dont know how to upload it in CHMODE.

HalfaBee
3-25-02, 06:40 PM
You need to use an ftp program that will allow you to change the permissions. I use Coffeecup free ftp.
http://www.coffeecup.com

Then you just right click on the file and select Change permissions.

Have fun.
Halfabee

MannInc
3-25-02, 08:10 PM
You don't upload in CHMOD. CHMOD refers to changing the setting for a file. You could also try LeechFTP (http://stud.fh-heilbronn.de/~jdebis/leechftp/downloads.html). You'll need to right click the file (the copy you uploaded) and choose Set Attributes... and changing the numeric to 755.

Hope this helps!

nickp
3-26-02, 03:13 PM
alrite, thanks, ive used both of those FTP programs in the past, i really liked leech but the trial thing ran out, rite now i use bulletftp, its pretty good, il check for the attributes, thanks.

MannInc
3-27-02, 12:23 AM
LeechFTP is a free ftp program. The programmer that created it has not updated it in a while, but it's completely free.