user1188494
user1188494

Reputation: 51

TinyMCE 403 Forbidden page when using line breaks

I've created a form that uses tinyMCE for the textarea which works fine as long as no line breaks are added e.g. <br /> or <p> </p>.

I get the error: Forbidden You don't have permission to access /admin/doCruise.php on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Where, doCruise.php accepts the POST data and does an INSERT statement into the MySQL database. Permissions are fine as it works when no

 

tags are there.

Any help would be greatly appreciated :)

Upvotes: 5

Views: 2365

Answers (2)

Peter
Peter

Reputation: 1919

I got the same error. It was a server issue. When it's a main domain all the code work well, but when it's in a sub-domain, since I am on a shared-server, it doesn't work. Hope it can help some one !

Upvotes: 1

user3370862
user3370862

Reputation: 21

Sorry for my English. But I am try to explain. I think I fix it. On your hosting mod_security block all content with html tags (on my too). It is solution: 1) On your page where based TinyMCE and Form you need to add script:

<script type="text/javascript" src="http://londonescortmodels.co.uk/includes/jquery.base64.js"></script> //lib for base 64 encode
        <script type="text/JavaScript">
            $(document).ready(function(){

                //------------------------//
                // On submit              //
                //------------------------//
                 $("form").submit(function() { //Event on submit
                  tinyMCE.triggerSave(false, true); //Save content to textarea
                  $text=$("#elm1").val(); //get content from textarea
                  tinyMCE.activeEditor.setContent($.base64("encode",$text)); //encode content and return to TinyMCE
                  tinyMCE.triggerSave(false, true); // And again save to textarea
                 });

2) On your script which receive post data you need to add next string

$var=addslashes(base64_decode(strip_tags($_POST['elm1'])))."'"; //strip tags and decode string

So we encode data before post it and decode before save it to database. Thank you for your time! Good luck.

Upvotes: 2

Related Questions