Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6377867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:55:48+00:00 2026-05-25T01:55:48+00:00

I am using TinyMCE to allow users to edit the content of certain pages,

  • 0

I am using TinyMCE to allow users to edit the content of certain pages, the problem is that I should store html tags, along with class=”” -es and ..etc.
How should I defend the application against SQL injection, and store the html tags? (main problem is the ” -s, It is messing up the mysql query)

In nutshell, I don’t know how to add the $_POST (which is a text) to the insert_to_content() function.

    $html = "";
    $url = "";if (isset($_GET["page"])) {$url = safesql($_GET["page"]);}
    $sqlSelectPageText = mysql_query('SELECT * FROM content WHERE name="'.$url.'" LIMIT 1');
    $pageText = mysql_fetch_array($sqlSelectPageText); /**/ $sqlSelectPageText = ""; 
    if (isset($_GET["edit"]) and isset($_POST["text"])) {
        insert_to_content($url,I_SHOULD_DO_SOMTHG_WAAA($_POST["text"]));
        header('Location: admin.php?page='.$url);
    }

    $html .= '<div id="editor1div">';
    $html .= '<form action="admin.php?page='.$url.'&edit" method="post">';
    $html .= '  <input class="formsSubmit" type="image" src="images/yep2.png" alt="Save" />';
    $html .= '<p>Content:</p>';
    $html .= '  <textarea id="editor1" name="text">';
            $html .= '      '.$pageText["text"]; /**/$pageText = ""; 
    $html .= '  </textarea>';
    $html .= '</form>';
    $html .= '</div>';


    echo $html;

function insert_to_content($whatPage, $text) {
    if (mysql_query('UPDATE content SET text="'.$text.'", lastdate=NOW() WHERE name="'.$whatPage.'"')) {
        return true;
    } else {
        return false;   
    }
}

function I_SHOULD_DO_SOMTHG_WAAA($text) {
           //what should i do with it?
}

EDIT:
@CaNNaDaRk:
I am trying to use your work, but never used PDO (or OOP PHP) so.
So, is it possible that I don’t have this function? 😀
“Class ‘PDO’ not found in..”
`

$db = new PDO("mysql:host=$sqlHost;dbname=$sqlDb;$sqlUser,$sqlPass"); 
$stmt = $db->prepare('UPDATE content SET text=:text, lastdate=NOW() WHERE name=:name');
$stmt->execute( array(':text' => $html, ':name' => $whatPage ) );
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:55:49+00:00Added an answer on May 25, 2026 at 1:55 am

    Use of prepared statements can prevent injection and help you with the " issue.
    A little example based on your code:

    $stmt = $db->prepare('UPDATE content SET text=:text, lastdate=NOW() WHERE name=:name');
    $stmt->execute( array(':text' => $html, ':name' => $whatPage ) );
    

    Execute method also returns bool so you don’t have to change your code much.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I'm using Struts 1.2 and I installed TinyMCE. The problem is that struts
I am using TinyMCE to allow users to write in what will eventually be
Running an ASP.Net website and using TinyMCE for content management. Users need to be
I`m using tinymce for the textarea .The php code that adds the content to
i have tinymce embedded in my website, so if users want to edit content,
I'm using TinyMCE to provide users the capability of simple text formatting (bold, italics,
I am using tinymce editor to have html page and then insert it in
I am using TinyMCE editor. I want to clear the content inside the editor
I have a website that allows to enter HTML through a TinyMCE rich editor
I have a pretty simple ASP.NET MVC page and am using TinyMCE to allow

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.