View previous topic :: View next topic |
Author |
Message |
stuntedheight -
Joined: 08 Nov 2003 Posts: 42
|
Posted: Fri Apr 16, 2004 4:52 am Post subject: Disable php formatting |
|
|
I wrote this script so I could edit my main pages main.php page remotely.
Here is the code that you write in...
Quote: |
<?php
$handle = fopen("main.txt", "r");
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
}
fclose($handle);
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Edit Main</title>
</head>
<body>
<p align="center"><b><font size="4">Edit Main</font></b></p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="436" bgcolor="#C0C0C0">
<tr>
<td width="100%" height="436"> <form method="POST" action="writetomain.php">
<p align="center">
<textarea rows="23" name="body" cols="76"><?php echo("$buffer"); ?></textarea></p>
<p align="center"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
</td>
</tr>
</table>
</body>
</html>
|
That posts the text to "writetomain.php". Here is the contense of "writetomain.php"...
Quote: |
<?php
$data = $_POST['body'];
$fp = fopen("main.txt", "w+") or die("Couldn't open file");
fwrite($fp, $data);
fclose($fp);
?>
<br><br><br>
Ok, File written....Hopefully<br><br><br>Here is what was written to the file...<br><br><?php echo("$data"); ?>
|
My main problem is that php is phptising the text being written to the file. For instance if you want to have an image show up you would normally type <img scr="http://www.google.com/images/logo_sm.gif"> to make an image appear. Well for some reason php is putting the \ before any ", makeing it illegal HTML and therefor not displaying my image. How do I get rid of those \ before any " so that my HTML codes will work?
~andy |
|
Back to top |
|
|
Moxxnixx -
Joined: 21 Jun 2003 Posts: 1226 Location: Florida
|
|
Back to top |
|
|
stuntedheight -
Joined: 08 Nov 2003 Posts: 42
|
Posted: Fri Apr 16, 2004 11:53 pm Post subject: |
|
|
Ok, worked. Thanks. |
|
Back to top |
|
|
|