Log in

View Full Version : ($_post Issues) openwysiwyg Php Full Page Intergration



incineratemediadotnet
03-15-2008, 07:42 AM
Hey, if anyone could help it would be awesome
I am currently trying to intergrate openWYSIWYG into a custom CMS for a client.
I have called the desired file using fopen() into the editor.
"<form name="example" method="post" action="action.php">
<textarea id="textarea1" name="page" style="height: 600px; width: 800px;">
<?php
$myFile = "exampletest.php";
$fh = fopen($myFile, 'r+');
$theData = fread($fh,filesize("$myFile"));
fclose($fh);
echo $theData;

;?>
</textarea>
<script language="javascript1.2">
generate_wysiwyg('textarea1');
</script>"
Now i'm trying to post the file to an action page that will write the data.
<?php

$myFile = "exampletest.php";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh,$_POST["page"]);
echo $_POST["page"];
?>

All is well except when the page is echoed the image links change to
"http://www.incineratemedia.net/%22http://www.incineratemedia.net/graphics/header.jpg/%22" and so on as a result of $_POST.

Can can i avoid it writting script like this in a simple method?

djr33
03-15-2008, 07:48 AM
You should become familiar with various functions like urldecode (http://www.php.net/manual/en/function.urldecode.php)(), urlencode(), htmlentities(), htmlspecialchars(), etc. They will fix this, and increase security.

incineratemediadotnet
03-15-2008, 07:54 AM
Thanks heaps. Advice will be well used/exercised.

incineratemediadotnet
03-16-2008, 04:57 AM
hmmm this is still a problem. I could be making a mistake.

<?php

$myFile = "exampletest.php";
$sentinfo = $_POST["page"];
$fh = fopen($myFile, 'w') or die("can't open file");
$decode = urldecode("$sentinfo");
fwrite($fh,$decode);
echo "$decode";
?> .. this is the action page after the form.. still no luck as to decoding the images and there paths. Am i missing something?