Nqon
May 17 2005, 03:08 PM
| | Im wondering how you can load a file into a text area and edit it. Lets say i have a php file called test.php and id like this file to be loaded into a textarea and the user should be able to edit this file and store it.
Is this posible?
Im also wondering how you make it so the html dosnt get encoded by the browser, lets say i need to explain on my website how you use html.
CODE Just testing something, maybe i can get this from the source. <b></b> |
Comment/Reply (w/o sign-up)
miCRoSCoPiC^eaRthLinG
May 17 2005, 03:30 PM
Why don't you google for HTMLArea Text Editor - that does the exact same job - i.e. creates an online text editor. Combine the code of that with some file saving/uploading routines in PHP and you'll get your desired results
Comment/Reply (w/o sign-up)
Nqon
May 17 2005, 03:38 PM
Thanks, but how do I get the php into the textarea without it being executed?
Comment/Reply (w/o sign-up)
jipman
May 17 2005, 05:18 PM
easy I made a editor by myself, let me enlighten you. If you encode all HTML like characters like < > to < , >, the < and > will show up correctly in the textarea but won't be executed. And posting is just posting the contents of the textarea and have a php file write it to a file. You also might want to wacht out for CHMODDING issues [brag] Mine works so nicely that I use that instead of SSH'ing to the server. [/brag]
Comment/Reply (w/o sign-up)
Nqon
May 18 2005, 08:14 AM
Yes yes, I found out how you did that pritty quickly, but my problem is that the PHP file gets executed into the editing textarea, is there a way to avoid that? The point of editing the php file is that it needs to be executed at some point! I know about the chmodding issues. But is there a way to bring the php file into the textarea without it being executed, i know i can use special characters that will stop it from being executed, but that would stop it from being executet all the time. I want it to be executed when it is included in the site.
Comment/Reply (w/o sign-up)
jipman
May 18 2005, 02:45 PM
What do you see when you open a file with : <?php echo 'test'; ?> in it? exactly, you'll see <?php echo 'test'; ?> in the textarea, but what was in the source? < and all those other html characters. But when you POST it up to the server, it will just post <?php echo 'test'; ?>, because you will post up what up SEE in the textarea.
Comment/Reply (w/o sign-up)
manymanymuch
Jun 29 2005, 06:28 PM
I use PHP's htmlspecialchars() to show HTML coding. There's a function which can be used to decode what has been encoded. It's htmlspecialchars_decode(). Unfortunately, this decoder is available only in PHP5.
Comment/Reply (w/o sign-up)
CrazyPensil
Mar 18 2006, 09:06 AM
Simply. A file with textarea, value of which would be written to the file chosen. CODE <?php if($file&&$script) { $fp=fopen($file, "w"); fwrite($fp,$script); fclose($fp); } ?> <form action="index.php" method=post> Name of file: <input type=text name=file><br> Code of file:<br> <textarea colls=400 rows=200 name=script></textarea> <input type=submit> </form> I hope, you'll be able to complete it yourself  As for editing, CODE <?php if($file&&$script) { $fp=fopen($file, "w"); fwrite($fp,$script); fclose($fp); } ?> <form action="index.php" method=post> Name of file: <input type=text name=file><br> Code of file:<br> <?php if($file) { ?> <textarea colls=400 rows=200 name=script> <?php $fp=fopen($file,"r"); $t=""; while(!feof($fp)) { $t.=fread($fp,1024); } fclose($fp); print $t; } </textarea> <input type=hidden name=file value="<?=$file;?>"> <?php } ?> <input type=submit> </form>
Comment/Reply (w/o sign-up)
Opethian
Apr 30 2006, 01:37 AM
Try using one of those frameworks, script.acolo.us or MooScript I think, they have some examples that I'm unsure of, but just might be exactly what you were looking for.
Comment/Reply (w/o sign-up)
(G)
Sep 12 2009, 09:32 PM
Your code is just a little off. Here is what I got:
[CODE]
<?php
$file = $_POST['file'];
$script = $_POST['script'];
if($file&&$script) {
$fp=fopen($file, "w");
fwrite($fp,$script);
fclose($fp);
}
?>
<form action="test.Php" method="post">
Name of file: <input type="text" name="file"><br>
Code of file:<br>
<?php
if($file) {
?>
<textarea colls="400" rows="200" style="width: 100%;" name="script">
<?php
$fp=fopen($file,"r");
$t="";
while(!feof($fp)) {
$t.=fread($fp,1024);
}
fclose($fp);
print $t;
?>
</textarea>
<input type="hidden" name="file" value="<?=$file;?>">
<?php
}
?>
<br />
<input type="submit">
</form>
[/CODE]
Comment/Reply (w/o sign-up)
starscream
Oct 6 2009, 05:49 PM
There are plenty of online editors that can let you edit php/html/xml/css online. Phpanywhere is the one. Another one is PhpHTMLedit. There is also codepress check it here. There are few such tools but most of them are paid. Also do you know you can edit most of the web formats on your cpanels' text editor. It provides syntax highlight and line number formatting. Do check it on your own cpanel. In between, you can check Editphponline. It's still in beta but worth to check out. after opening the site you'll see it opens up a text editor on browser window with number on left hand sidebar. You can edit and save your files.
Comment/Reply (w/o sign-up)
Similar Topics
Keywords : online, html, php, editor, edit, file, browser
- How To Create/edit/delete Ftp Accounts With Php
Help me to create one php page to create FTP user accounts in Unix Ser (2)
Make A Script Run Even If No User Is Online
(6) Hey! Is there any way to make a script run, even if no user is online. Because at the moment, my
scripts run, only when a user is online. And another thing: How can i make the following: (this is
just an example) mysql_query"SELECT maxhp FROM users WHERE username = 'allusers'"; How can I
select all users maxhp, in the same query? Thanks //Feelay....
Extplorer
A PHP -and JavaScript- based File Manager (7) Browsing the ExtJS examples website i found this excellent web-based file manager called
eXtplorer . eXtplorer allows you to browse your webserver folders with an intuitive Layout which
makes working with files very easy, and thanks to the great ExtJS Javascript Library you can drag
& drop folders and files, filter directories and sort the file list using various criteria. You can
use eXtplorer to for example: browse directories & files on the server. edit, copy, move, delete
files. search, upload and download files. create and extract archives. create new fil....
Windows Explorer Impersonator - The Online Explorer
(13) I wanted to create a directory where I could keep my files while on the move. The main problem was
the poor interface associated with a simple Web Application. Fear not, AJAX is here and this is what
I have come up with:- Here goes the link to the script:
http://maxotek.net/scripts/php-ajax/winExplorerImpersonator/ *** List of explorer currently
supported features:- Directory Navigation via Double Click Directory Navigation via the Address Bar
Breadcrumb type Back/Next Navigation General Navigation: Go Up, Refresh, Home Scrollable +
Sortable File/Folder Listin....
Php File Upload
About uploading files through php (3) Right i have done a check for a tutorial on this as well as a question about it but php is not
allowed in the search box. So i thought i'd just ask what i want to know. I have a form which
uploads a file, it refreshes the page, uploads the file and then alerts the user to if the file has
uploaded. To be honest im not sure why i keep getting the error. But here is the code: This is the
form that is used for the user to select the file &fid= " method="POST"> Choose a file to
upload: This is the upload code if ($op == "up"....
Php - Browser Based Editor
(3) I'm trying to set up some tools for a number of developers to use in the creation of a
text-based MMORPG. I'd like to be able to show directory structure and allow them to easily see
which files are where - then to be able to edit the pages from their browser. It would also be a
neat feature that they could upload some files from their computer. Last time I needed this I built
it myself, but it was restricted to 2 directories only and I ended up storing the file structure in
text files. Anyways I'm debating rebuilding the entire thing but I can't help ....
Automated File Structure Creation Script
As Requested By Mark420 (3) While chatting with Mark420 today on the shoutbox, he mentioned that he was looking for a script to
create his entire folder structure with just a click of a button. For example, he wanted the
following folders created in his root folder by just clicking submit. /images /images/thumbs
/images/icons /css /javascripts /content /content/articles /content/tutorials Presumably this
would be used for some type of installation system or other quick server setup situation. Anyhow
here is what I threw together for him: /* ********************************************....
Online Multiplayer Chess Script
Online multiplayer chess script (2) Do you have any script for this?or where can i find this script. I wait your replies. ok.....
How To Force A Zip File To Be Downloaded
(11) Hi, i have a problem with a zip file that i want to be force downloaded by any client, i know that
with the header function it can be achieved but dont know why it doesnt works. I have two files, the
first one is a simple html file with an a tag and the second is a php file, here is my code: html
file: CODE Download File Php file: CODE header('Content-Type:
application/zip'); header('Content-Disposition: attachment; filename="file.zip"');
readfile('downloads/file.zip'); ?> May be i forgot something, does it is necessary to ....
How To Delete File Using PHP Shell Script
(3) i have this problem regarding file access seems that my admin host or the server system itself have
locked up the acces to create new file, delete a file.. change file permissions and such controls
to file.. someone told me to use php shell script.. can you help me out here? ******** i just
need to find out how to use php shell script and add it to my php scripts to delete a file.. thanks....
OpenWYSIWYG Instead Of RichTextEditor
wysiwyg editor (3) hi all, For my newsletter scipt i am using richtext editor as the html edtor, I want to use
openwysiwyg instead 'message_add_html.tpl' file is following. I dont know how to chage
the script any kind of help would be appreciated sherif CODE Add new
message: Subject:
Message Type:
Disable ....
File Self Secure?
is it avaible (6) I just learn php. We store the pass word of Mysql in a file right. So is there any way to may a pass
protect that file . i mean they could hack and find out the place of the file (ex like in forum) and
drop all sercure data /huh.gif" style="vertical-align:middle" emoid=":huh:" border="0"
alt="huh.gif" />....
How To Edit Php Files?
(16) Hi, You can use frontpage to preview HTML files, but how can I edit and preview PHP files offline.
I'm not well-known with PHP and I see more and more using this script to manage their site.....
Updating An Rss File Using A Php Form
(1) Hi, I'm currently making a site for my organization but I'm stuck on this one section where
I would have to make a PHP form in order for other members to post an item into my RSS file. So does
anyone know a PHP script I can use in order for me and other members to input a new RSS item into my
news RSS file?....
Xgrid With Php
Creating a script to post a blender file to Xgrid using PHP (0) I am doing pre planning for the blenderxgrid.com script. I was originally going to do this with
PERL, but elected against it. Eventually I'll be moving the site off astahost and replacing it
with a website hosted on the same machine as the xgrid controller. I am setting up a test version
on my latop using OSX's apache server, MySQL, and PHP on a localhost config. Here is my step
list for the script: ------------------------------------- Form: (within Xoops CMS, so user will
have to be logged in) Username Password (where they can upload the .blend file....
How To Embed Ram File Produced By Http Header
(2) Dear Friends I want to stream music from my website. The file format is .rm. People say that one
need a Helix Server or other media server to stream. I have found a solution to this problem as
well. I read an article about streaming music. It tells that if the size of the media file is small
and the byte rate of the media file is lower than that of the user internet connections byte rate,
the file get streamed automatically from HTTP server. In theory, any file is "streamed" by a web
server that is, sent back to the client in small pieces. What makes media files speci....
How To Create An Online Timed Test With PHP?
Can we do a online test with a counter(from 20 second) php for a php-n (18) Is there anyone got a online timed test script?Or anyone knows how to create this script? I wait
your answers and all php programmers.....
Generating A Table Into A File In CSV Format
and letting user download the file (6) I'm working on a project, part of which consists of working with large tables of different
kinds. Now, I'm using a page seeking technique which allows you to browse through the records
depending on which page you want to see and how many records you want to see on each page. Now, I
need a link (or a form button) on each page which, when clicked, will throw a file to the user for
download (the download window should popup immediatly) which will give the part of the table,
currently being viewed, in CSV format. One way I can think of to generate the file is manu....
PHP Script To Upload A File
with password-protection. (15) Problem: Upload a file to the AstaHost account (that I have been granted here) throught the
webpage I would like to know, how should I proceed on this particular problem. I know this has
been done through cPanel, but I want to write a PHP functionality. The cPanel is accessed through
the 2082 port, and most of the places I access internet from does not give me access through that
port. I can access http://www.kmaheshbhat.astahost.com/ but not
http://www.kmaheshbhat.astahost.com/cpanel or http://www.kmaheshbhat.astahost.com:2082/ . I need
to go to one particu....
Display Text If Line Not Empty In Config File
(8) I have been working on a new template and I would like it so that if in the global configuration
file, I have a variable for a global site announcement that would go on every page. The line in the
global configuration file is this: CODE $announcement = "ANNOUNCEMENT"; In my template file,
I could easily add CODE but that would leave a blank space and with the announcement style
(similar to the Invision Power Board error box). Is there some sort of script that could be put in
the template page so I could have the global config file look something like t....
PHP File Upload Works... But Stupid IE
(3) ok i have used the following code in my upload.php file Code: CODE $uploaddir =
'../photos/'; $uploadfile = $uploaddir . basename($_FILES ); echo ' '; if
(move_uploaded_file($_FILES , $uploadfile)) { echo "File is valid, and was successfully
uploaded.\n"; } else { echo "Possible file upload attack!\n"; } using ../photos/ as my
upload DIR works, as the file does upload, but when i echo $uploadfile on the same page: Code:
CODE " alt="uploadedfile" /> IE wont show it as it has two fullstops before the photo dir
in the domain....
Counter With Img In Flat File
(2) this is a counter with images and stor in flat file becouse i can not upload .zip .rar file iwell
program it on this post at frist you need to 2 files count.php count.txt and you need else make
folder has name gifs and make 10 pictuer 10 file 0.gif to 9.gif now all ok open the count.php and
add this code CODE ### IMAGE FORMAT $format = ".gif"; $file = file("count.txt"); $num =
($file + 1); exec("echo $num > count.txt"); switch($type) { case "text": echo $num; break;
case "gfx": $i = 0; $cntn = strlen($num); while($i $tmpnum = subst....
Php Reading And Writing To File
the code is very esay (4) this code to Read from file you can use this code in to make a small data base and it is very to
use CODE $fp = fopen ("file.txt", "r"); $bytes = 4; $buffer = fread($fp, $bytes); fclose
($fp); print $buffer; ------------------- to write to same file CODE $fp = fopen
("file.txt", "w+"); fwrite ($fp, "Test"); fclose ($fp); ---------------- thanks and iwait the
commant....
How Can I Use Php Online On My Pc?
Do I have to download a program? (4) I would like to know how can I set up and use php offline using my computer. Everytime I code to PHP
I should go online.....
Php Script To Download File From Another Site
(11) hi i need a php or java script code for downloading files from other sites to my site for example:
http://download.com/file.zip to http://mysite.com/file.zip thanks....
Best php editor?
tell me? (26) Can somebody tell me which is the best PHP Editor? I have tried the DzSoft Editor and the Svoi.net
PHP editor. Among them the first one is better. Is there any better editor available in terms of
built in features?....
Looking for online, html, php, editor, edit, file, browser
|
See Also,
*SIMILAR VIDEOS*
Searching Video's for online, html, php, editor, edit, file, browser
|
advertisement
|
|