Answer the question
In order to leave comments, you need to log in
How to save large text to database and render it harmless?
Good evening.
I am using the Markdown Editor . It will be called on the page, after which some text is typed in the markup. Then I need to store all this in MySQL for later output through the parser.
In the Readme I see this method for getting text from the editor (it's built into <textarea>
): editor.codemirror.getValue();
Now I have a few questions:
Answer the question
In order to leave comments, you need to log in
1. Yes, it turns out like this. You can send it like this:
var text = editor.codemirror.getValue();
$.post('/addnews',{post_text:text,post_parametr:'значение'},function(data){
//... в data будет ответ от сервера
});
var text = 'я 123 тру-кодер 123 жи есть!';
var result = text.replace(/123/g,'');
alert(result);
function process($source) {
if( function_exists( "get_magic_quotes_gpc" ) && get_magic_quotes_gpc() ) $source = stripslashes( $source );
$source = str_ireplace( "{include", "{include", $source );
$source = str_ireplace( "{content", "{content", $source );
$source = str_ireplace( "{custom", "{custom", $source );
$source = $this->remove( $this->decode( $source ) );
if( $this->code_count ) {
foreach ( $this->code_text as $key_find => $key_replace ) {
$find[] = $key_find;
$replace[] = $key_replace;
}
$source = str_replace( $find, $replace, $source );
}
$this->code_count = 0;
$this->code_text = array ();
$source = preg_replace( "#<script#i", "<script", $source );
/*if ( !$this->safe_mode ) {
$source = preg_replace_callback( "#<iframe(.+?)src=['\"](.+?)['\"](.*?)>(.*?)</iframe>#is", array( &$this, 'check_frame'), $source );
}*/
//$source = str_ireplace( "<iframe", "<iframe", $source );
//$source = str_ireplace( "</iframe>", "</iframe>", $source );
$source = str_replace( "<?", "<?", $source );
$source = str_replace( "?>", "?>", $source );
$source = addslashes( $source );
return $source;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question