|
|
Online HTML/PHP Editor: Edit File In Browser! | ||
Discussion by Nqon with 16 Replies.
Last Update: January 28, 2011, 6:41 pm ( View Rated (5) ) | |||
![]() |
|
|
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>
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]
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.
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.
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.
A file with textarea, value of which would be written to the file chosen.
CODE
<?phpif($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
<?phpif($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>
Your code is just a little off. Here is what I got:
CODE
<?php$file = $_POST;$script = $_POST; 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>
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.
<?php opentable($locale); if ($settings == "1") { echo "<div style='text-align:center'><br/>and".$locale."<br /><br/>and".$locale."<br /><br />and</div>and"; } else { echo "<div style='text-align:center'><br/>and".$locale."<br /><br/>and".$locale."<br /><br />and</div>and"; } closetable();?>
Warning: mail() url="function.Mail"]function.Mail[/url: SMTP server response: 550 5.7.1 Unable to relay for dennis.Chen@visual-earth.Com.My in D:DomainsLocalUservisual-earth.Com.Mywwwrootfree_consultation.Php on line 118
this msg coming..Wat I do..Pls..Rep
code is:
<?if($_SERVER=="POST")
{
$name = $_POST;
$email = $_POST;
$phone = $_POST;
$message = $_POST;
$sub = $_POST;
//$body="<table width="100%" border="0" cellspacing="2" cellpadding="2"><tr><td width="36%">Dated</td><td width="5%"></td><td width="59%">".$date.$Month.$Year."</td></tr><tr><td>Practice Name:</td><td></td><td>".$practicename."</td></tr><tr><td>Practice Administrator or Office Manager :</td><td></td><td>".$padmin."</td></tr><tr><td>Name<br></td><td></td> <td>".$na."</td></tr><tr><td colspan="3"> </td> </tr><tr><td colspan="3">".$nb."</td></tr><tr><td colspan="3"> </td></tr><tr><td>".$nc."</td><td></td><td></td></tr><tr><td colspan="3">".$nd."</td></tr><tr><td colspan="3">Job Title/Function</td> </tr><tr><td colspan="3">".$ja."</td></tr></td><td>".$jb."</td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3">".$nc."</td></tr><tr><td></td><td></td><td>".$nd."</td></tr><tr></table>";
$body="<table width="600" height="50" border="0" cellspacing="5" cellpadding="5"><tr><td><b>Name :</b> ".$name."</td> </tr><tr><td><b>Email :</b> ".$email."</td></tr><tr><td><b>Company:</b> ".$company."</td></tr><tr><td><b>Contact:</b> ".$contact."</td></tr><tr><td><b>Message:</b> ".$message."</td></tr></table>";
$to="[email=dennis.Chen@visual-earth.Com.My";$headers]dennis.Chen@visual-earth.Com.My";[/email]
[email=dennis.Chen@visual-earth.Com.My";$headers]$headers[/email] = "MIME-Version: 1.0rand";
$headers .= "Content-type: text/html; charset=iso-8859-1rand";
$subject="Visual earth - Free Consultantion";
$headers .= "From: $email"."rand";
mail($to, $subject, $body, $headers);
}
?>
<?php$host = "mysql1082.Servage.Net";$user = "johaneslucky5";$password = "Margoutomo10";$database = "johaneslucky5"; $connect = mysql_connect("$host","$user","$password");@mysql_select_db("$database",$connect) or die ("Error! No Database Connected");session_start();Function special($p) { $p = strip_tags($p); $p = htmlentities($p, ENT_COMPAT,'UTF-8'); $p = str_replace('--','-−',$p); $p = trim($p); return $p; } $nama = special($_POST); $email = special($_POST); $message = special($_POST); $gcf_captcha = $_POST; $date = gmdate("Y-m-d H:I:s", time()+60*60*7); if( $_SESSION == mysql_real_escape_string(trim($gcf_captcha)) && !empty($_SESSION ) ) { Mysql_query("INSERT INTO `johaneslucky5`.`wp_prospek` (`id`, `nama`, `email`, `message`, `ip`, `date`) VALUES ('','$nama','$email','$message','" . $_SERVER . "','$date')",$connect); //kirim email ke lucky$to = "johanes.Lucky@gmail.Com";$subject = "Prospek MargoUtomo.Net";$message = "Nama: $nama, Email: $email, Pesan:$message, Tanggal:$date";$from = "admin@margoutomo.Net";$headers = "Dari: $from";@mail($to,$subject,$message,$headers); Ob_start();Echo "Pesan anda telah terkirim";Header("Location: http://www.Margoutomo.Net");ob_flush(); } else { echo 'Kode yang dimasukkan salah.'; } ?>
http://online-php.com
Similar Topics:
Text-Based HTML Editors
Get Input From Html/txt File?
What Is A Good Photoeditor?
How Do I Create And Write To Files? creating, writing, deleting files (4)
|
(3) Fileopen split the comma
|
HOME 






