I wortk on my site at home but often look at it when I am on diff computers, school computers, library computers, etc. So I was wondering if it would be pretty easy to make a place on the site where you select a page/script that is on your site that you want to edit and the contents of the file are put into a textarea. You then update the code in the textarea box and hit a button that will save the new updated file to the old one. Then you have a way to debug/update your site without being at your webserver computer.
How much exp with php do you think you would have to have before this became a realistic idea?
thanks for all help and advice provided.
Making a script that will allow you to edit your site code
Moderator: General Moderators
- daven
- Forum Contributor
- Posts: 332
- Joined: Tue Dec 17, 2002 1:29 pm
- Location: Gaithersburg, MD
- Contact:
It should not be terribly difficult. All you have to do is set up an FTP connection, retrieve the document, use fopen/fread/fwrite to modify it, and then FTP it back up.
Personally, I would just use an FTP client (ex: WS_FTP) to login to your webserver and get the document directly. That way you can get the code from anywhere and use text editors on it
Personally, I would just use an FTP client (ex: WS_FTP) to login to your webserver and get the document directly. That way you can get the code from anywhere and use text editors on it
That was what I thought of first. The reason I would do it through a web-interface is because the network I would be doing it from does not allow you to connect to a computer outside the network. Or it wont work if I try to telnet, ftp, ssh to my home comp ( I set it to allow those just to see if it would work ) but I can look at my site from the network.
With ftp you can download & edit your php scripts but it sounds like you want to edit content via a browser.
Yes, SELECT the content from the database, textarea field in form, submit form to a processor script to UPDATE the record (addslash it first). You'll need to get a row ID from the original SELECT to use in the UPDATE - could add that to the form as a hidden field.
Post again if your stuck on the code.
Yes, SELECT the content from the database, textarea field in form, submit form to a processor script to UPDATE the record (addslash it first). You'll need to get a row ID from the original SELECT to use in the UPDATE - could add that to the form as a hidden field.
Post again if your stuck on the code.
Editing scripts via browser does sound pretty convenient. But what about the possible security risks? If someone managed to gain access to your editing page, then there's the potential to do some serious damage to your site / hostserver. I'm assuming that in order to edit your code via the web, the form would have to allow most of all the characters that we normally filter for to be allowed--that there just sounds very evil.. But then again, I'm no professional coder so perhaps there's a safe way around this..
If you do find a full-proof method (or is it 'fool' proof?), please let me know.. As I also work at different computers at different times for my code.. And having this option to edit via browser would be nice.. Although I think a safer way would be to stick to FTP. (If possible, that is.)
If you do find a full-proof method (or is it 'fool' proof?), please let me know.. As I also work at different computers at different times for my code.. And having this option to edit via browser would be nice.. Although I think a safer way would be to stick to FTP. (If possible, that is.)
You could create a php login script with password for the "admin" area, or you could simply put the admin.php file in an .htaccess protected folder.
It's pretty much standard practice on many sites to work this way: it allows for a team of content editors to share out the work. As long as only genuine admin users can run the admin scripts, you'll be ok.
You can even just edit the database directly if you have something like phpMyadmin installed on your server.
It's pretty much standard practice on many sites to work this way: it allows for a team of content editors to share out the work. As long as only genuine admin users can run the admin scripts, you'll be ok.
You can even just edit the database directly if you have something like phpMyadmin installed on your server.