I have written this code for page hits cout
its working perfectly ok on my pc
but when i uploaded it on my site it show error any body help me in this issue

<?php
$cnt = "hits.txt";
$h = @fopen($cnt, 'r') or die("can't open file");
$x=@fread($h,10);
$h1 = @fopen($cnt, 'w') or die("can't open file");
$x+=1;
echo "Page Hits:".$x;
fwrite($h1,$x);
fclose($h1);

?>

link to page is http://wasimmalik.freewebhostx.com/pagehit.php
error is
Warning: fopen(hits.txt) [function.fopen]: failed to open stream: Permission denied in /www/freewebhostx.com/w/a/s/wasimmalik/htdocs/pagehit.php on line 5
can't open file|
need ur help
thanks in advance

Check the file read/write/execute permissions after you uploaded the file.

/Michael

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.