Jump to content

some help please!


sooty2006

Recommended Posts

hi,help me please! :) i have made an admin panel on my site for other admins,heres the script!:

$link = "/var/www/vhosts/example.com/httpdocs/register.php/";$file = fopen($link, "r");$filesize = filesize($file);$contents = fread($file, $filesize);fclose($file);print <textarea name='edit' class='box' cols='60' rows='60' style='width: 80%;'> ;print $contents ;print </textarea> ;

so they can edit the scripts with out accessing the server.but i have the file tree working only when you click on the file it should open up in the same pagfe with the text using fopen(); i presume. but what ever i try just shows "Resource id #11" why? how can i open a file to read and write showing all the text? thanks :) scott

Link to comment
Share on other sites

You have a slash after the filename, which makes it a directory instead of a file. You also don't have quotes around the textarea, so I'm not sure if this is the code you're actually using, but it's the code you posted so that's what I'm going to comment on. The fread function doesn't return a resource though, it returns a string. If you're printing a resource then you're not printing the return value from fread, it's something else. You can also use file_get_contents instead of fopen, fread, and fclose.

Link to comment
Share on other sites

You have a slash after the filename, which makes it a directory instead of a file. You also don't have quotes around the textarea, so I'm not sure if this is the code you're actually using, but it's the code you posted so that's what I'm going to comment on. The fread function doesn't return a resource though, it returns a string. If you're printing a resource then you're not printing the return value from fread, it's something else. You can also use file_get_contents instead of fopen, fread, and fclose.
file_get_contents(); didnt work for me but i have manages to do it with readfile($filename);thanks anyway! :)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...