Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 02-17-2007, 06:47 PM My PHP Counter
McBone's Avatar
Super Talker

Posts: 149
Name: i have left
Location: i have left
Trades: 0
I have had to insert a counter in a page for a client but...

i have used this code before, but for some reason i get this error

Warning: fopen(counter.txt) [function.fopen]: failed to open stream: Permission denied in /counter.php on line 14
301
Warning: fputs(): supplied argument is not a valid stream resource in /counter.php on line 20

Warning: fclose(): supplied argument is not a valid stream resource in /counter.php on line 22

PHP Code:
<?php 

  
      $counter 
"counter.txt"
      
      function 
displayCounter($counter) { 

      
$fp fopen($counter,rw); 

      
$num fgets($fp,9999); 

      
fclose($fp); 

      
$fp fopen($counter,w); 

      
$num += 1

      print 
"$num"

      
fputs($fp$num); 

      
fclose($fp); 

      }        
      
displayCounter($counter); 
      

?>
Its got me stumped! Any ideas??

p.s the site has PHP enabled and the counter.txt just has a number in there so i didnt post it

Thanks guys and gals
McBone is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-18-2007, 10:05 AM Re: My PHP Counter
TyR
TyR's Avatar
Super Talker

Posts: 139
Location: Frei - Norway
Trades: 0
Have you changed the file permissions?
I'd try to chmod it to 777
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
TyR is offline
Reply With Quote
View Public Profile
 
Old 02-18-2007, 10:21 AM Re: My PHP Counter
McBone's Avatar
Super Talker

Posts: 149
Name: i have left
Location: i have left
Trades: 0
i cant alter the cmod, its browser upload

thanks
McBone is offline
Reply With Quote
View Public Profile
 
Old 02-18-2007, 11:18 AM Re: My PHP Counter
Super Talker

Posts: 136
Location: Michigan
Trades: 1
This is a permissions error the txt file must be writable Try useing this ftp client it allows you to chmod the files in ftp mode check it out and give it a try.

http://www.ipswitch.com/products/ws_ftp/index.asp
killerbud99 is offline
Reply With Quote
View Public Profile Visit killerbud99's homepage!
 
Old 02-18-2007, 11:34 AM Re: My PHP Counter
TyR
TyR's Avatar
Super Talker

Posts: 139
Location: Frei - Norway
Trades: 0
i see. Tried using the chmod function in php?
http://no.php.net/chmod
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
TyR is offline
Reply With Quote
View Public Profile
 
Old 02-20-2007, 07:53 PM Re: My PHP Counter
memberpro's Avatar
Super Talker

Posts: 143
Trades: 0
Even using the IE browser you can right-click on the file and then click all the boxes for read/write/execute. This will be the same as Chmod 777
__________________

Please login or register to view this content. Registration is FREE
- step-by-step learn how to design, create and install your own website in hours...not days.
Please login or register to view this content. Registration is FREE
was never so easy.
memberpro is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to My PHP Counter
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.48168 seconds with 12 queries