CKEditor and ckfinder Editor Configuration tutorial

Source: Internet
Author: User
Tags php server sql injection

Ckeditor&&ckfinder cracked version Baidu network disk address: Http://pan.baidu.com/s/1qWsDPKC Password: yydcdut

Place CKEditor and Ckfinder in the same folder.

ckeditor implementation edit box

CKEditor is actually replacing a textarea tag, so put textarea in a form, and when submitted to the PHP server, use $_post[' xxx ' to get the edited data.

Modify the CKEditor profile Config.js

The code is as follows Copy Code


Ckeditor.editorconfig = function (config)
{
Config.language = ' ZH-CN ';
Config.uicolor = ' #FFA ';
Config.skin = ' v2 ';
Config.width = 850;
Config.height = 400;
Config.toolbar = ' full ';
};


A simple web-page implementation

The code is as follows Copy Code

<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">
<title>yyd</title>
<body>
<form action= "post.php" method= "POST" >
<textarea name= "Editor1" >yyd</textarea>
<input type= "Submit" name= "submit" value= "Submit"/>
</form>
</body>

<script src= "Ckeditor/ckeditor.js" ></script>
<script type= "Text/javascript" >
Enable Ckeitor upload function, use the Ckfinder plugin
Ckeditor.replace (' Editor1 ', {
Filebrowserbrowseurl: ' ckfinder/ckfinder.html ',
Filebrowserimagebrowseurl: ' ckfinder/ckfinder.html? Type=images ',
Filebrowserflashbrowseurl: ' ckfinder/ckfinder.html? Type=flash ',
Filebrowseruploadurl: ' Ckfinder/core/connector/php/connector.php?command=quickupload&type=files ',
Filebrowserimageuploadurl: ' Ckfinder/core/connector/php/connector.php?command=quickupload&type=images ',
Filebrowserflashuploadurl: ' Ckfinder/core/connector/php/connector.php?command=quickupload&type=flash '
});
</script>


Implementation screenshot

     

Ckfinder upload Image

• Create uploads folders in the same directory as CKEditor and Ckfinder
• Modification of config.php documents
function on line 21st

  code is as follows copy code

function Checkauthentication ()
{
Warning:do not simply return "true". By doing so, your are allowing
"Anyone" to upload and list the files in your server. You must implement
Some kind of validation here. Even something very simple as ...

return isset ($_session[' isauthorized ']) && $_session[' isauthorized '];

... where $_session[' isauthorized ' is set to ' true ' as soon as the
User logs in your system. To is able to use session variables don ' t
Forget to add session_start () in the top of this file.

return false;
return true;
}


Line 66th, the uploads path that is modified to create

The code is as follows Copy Code

1 $baseUrl = '/ck/plugins/uploads/';

Implementation screenshot

    

Create a post.php file and print the post that is passed over

The code is as follows Copy Code

1 <?php
2 header ("content-type:text/html; Charset=utf-8 ");
3 $str = $_post[' editor1 '];
4 $data = stripslashes (Htmlspecialchars_decode ($STR));
5 echo $data;
6?>

    

Summary and resolution of issues                                                                                                                                                  

When I finished the configuration, after submit submitted to the dead and dead can not show the picture, look at the source code, found that double quotes were escaped, feel very egg pain. I don't know if this ckeditor escaped or was escaped by the browser, because just a few days ago, I was in the test of SQL injection when it can be injected, but not the results, and then on the machine on the password pass the value of the past printed out, found to be escaped, said very egg pain. So I used the $data = Stripslashes (Htmlspecialchars_decode ($STR)), and then I will escape and then reverse the lake area, the result is OK.

Ckeditor&&ckfinder combination can upload pictures, but also upload files.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.