Hi all,
I have implemented the editor in my admin/edit page and when editing it works fine I can insert pics & change text to bold or whatever, but when I submit it & go to the page I edited all it gives me is code.
Im very new to php & desperatley need some help.
here is what I get if I type hello & colour it red 16pt & make it bold
eg.
<p>
<span style="color: #f00"><span style="font-size: 16px"><strong><br />
Hello</strong></span></span></p>
I have implemented the editor in my admin/edit page and when editing it works fine I can insert pics & change text to bold or whatever, but when I submit it & go to the page I edited all it gives me is code.
Im very new to php & desperatley need some help.
here is what I get if I type hello & colour it red 16pt & make it bold
eg.
<p>
<span style="color: #f00"><span style="font-size: 16px"><strong><br />
Hello</strong></span></span></p>

Re: ckeditor is rendering code to the page
Re: ckeditor is rendering code to the page
Re: ckeditor is rendering code to the page
e.g. in edit page: Change $editor1 = $row["editor1"]; to $editor1 = html_entity_decode($row["editor1"]);
Could you also paste the source code of page_edit_parse.php? I think you have applied htmlentities() function (Not htmlencode() I metioned above. I was wrong) to the submitted data before updating the database. If you have, just remove the htmlentities() function and then no more modification need to be made.
Re: ckeditor is rendering code to the page
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$pid = $_POST['pid'];
$pagetitle = $_POST['pagetitle'];
$linklabel = $_POST['linklabel'];
$editor1 = $_POST['editor1'];
// Filter Function -------------------------------------------------------------------
function filterFunction ($var) {
$var = nl2br(htmlspecialchars($var));
$var = eregi_replace("'", "'", $var);
$var = eregi_replace("`", "'", $var);
return $var;
}
$pagetitle = filterFunction($pagetitle);
$linklabel = filterFunction($linklabel);
$editor1 = filterFunction($editor1);
// End Filter Function --------------------------------------------------------------
include_once "../scripts/connect_to_mysql.php";
// Add the updated info into the database table
$query = mysqli_query($myConnection, "UPDATE pages SET pagetitle='$pagetitle', linklabel='$linklabel', editor1='$editor1', lastmodified='now()' WHERE id='$pid'") or die (mysqli_error($myConnection));
echo 'Operation Completed Successfully! <br /><br /><a href="index.php">Click Here</a>';
exit();
?>
Re: ckeditor is rendering code to the page
Because filterFunction() applies htmlspecialchars() (similar to htmlentities()) to the data, which will convert <, >, ' to html entities. Remove it and problem will be solved. In additon, you should apply mysqli_real_escape_string() to the data so as to prevent SQL injection.
Re: ckeditor is rendering code to the page
Now when I update I just get a blank page?
this is what I changed it to
<?php
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$pid = $_POST['pid'];
$pagetitle = $_POST['pagetitle'];
$linklabel = $_POST['linklabel'];
$editor1 = $_POST['editor1'];
// Filter Function -------------------------------------------------------------------
function filterFunction ($var) {
$var = nl2br(htmlspecialchars($var));
$var = eregi_replace("'", "'", $var);
$var = eregi_replace("`", "'", $var);
return $var;
}
$pagetitle = filterFunction($pagetitle);
$linklabel = filterFunction($linklabel);
$editor1 = mysqli_real_escape_string($editor1);
// End Filter Function --------------------------------------------------------------
include_once "../scripts/connect_to_mysql.php";
// Add the updated info into the database table
$query = mysqli_query($myConnection, "UPDATE pages SET pagetitle='$pagetitle', linklabel='$linklabel', editor1='$editor1', lastmodified='now()' WHERE id='$pid'") or die (mysqli_error($myConnection));
echo 'Operation Completed Successfully! <br /><br /><a href="index.php">Click Here</a>';
exit();
?>
Re: ckeditor is rendering code to the page
$editor1 = mysqli_real_escape_string($myConnection, $editor1);
Sorry, I'm not very familiar with mysqli.
Re: ckeditor is rendering code to the page
I could email the files to you if you wanted....Im so stuck