|
|
Сохранение обратных слешей при добавлении и извлечении текста из БД. Вместо stripslashes() и addslashes() |
Обновлённый PHP-Fusion Bogatyr / Free CMS PHP-Fusion 7 Bogatyr / PHP-functions for text / Сохранение обратных слешей при добавлении и извлечении текста из БД. Вместо stripslashes() и addslashes()
Russian
Функции добавляют или удалят слеши перед двойными и одинарными кавычками. Это необходито для добавления и извлечения текстов из БД. Но не затрагивают прочие слеши перед другими символами, например n r и т. д. Такие символы используются в PHP-коде часто и регулярных выражениях типа preg_match(). |
Saving backslashes when adding and extracting text from the database. Instead of stripslashes() and addslashes() |
Обновлённый PHP-Fusion Bogatyr / Free CMS PHP-Fusion 7 Bogatyr / PHP-functions for text / Saving backslashes when adding and extracting text from the database. Instead of stripslashes() and addslashes()
English
Functions add or remove slashes before double and single quotes. This is necessary for adding and extracting texts from the database. But they do not affect other slashes in front of other symbols, for example, n r, etc. Such symbols are used in PHP code frequently and regular expressions Type preg_match (). |
|
PHP |
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\mail_bbcode_include.php on line 20
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\mail_bbcode_include.php on line 21
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\search_bbcode_include.php on line 39
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\mail_bbcode_include.php on line 20
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\mail_bbcode_include.php on line 21
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\search_bbcode_include.php on line 39
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\mail_bbcode_include.php on line 20
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\mail_bbcode_include.php on line 21
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\search_bbcode_include.php on line 39
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\mail_bbcode_include.php on line 20
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\mail_bbcode_include.php on line 21
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\search_bbcode_include.php on line 39
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\mail_bbcode_include.php on line 20
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\mail_bbcode_include.php on line 21
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\search_bbcode_include.php on line 39
PHP
<?php
$slash = str_replace(' ', '', ' \ ');
$quot2 = '"'; $quot1 = "'";
function delquotslashes($text=""){
global $slash, $quot2, $quot1;
$text = str_replace($slash.$quot2 , $quot2, $text);
$text = str_replace($slash.$quot2 , $quot2, $text);
$text = str_replace($slash.$quot1 , $quot1, $text);
$text = str_replace($slash.$quot1 , $quot1, $text);
return $text;
}
-
function addquotslashes($text=""){
global $slash, $quot2, $quot1;
$text = str_replace($quot2, $slash.$quot2 , $text);
$text = str_replace($quot1, $slash.$quot1 , $text);
return $text;
}
?>
// RU: обновление БД // до
// EN: Database update // before
PHP
// RU: // после
// EN: // after
PHP
<?php
$q = "UPDATE ".DB_PREFIX."phpfuncs SET
description='".addquotslashes($description])."'
WHERE id='".$id."' ";
?>
// RU: Получение текста // до
// EN: Getting the text // before
PHP
<?php
$description = stripslashes($_POST['description']);
?>
// после // after
PHP
|
Добавить комментарий |
Добавить комментарий Пожалуйста, залогиньтесь для добавления комментария.
|
HTML-code and BB-code for blogs and forums |
<a href="https://php-fusion.vveb.ws/php-fusion.php?id=30">Сохранение обратных слешей при добавлении и извлечении текста из БД. Вместо stripslashes() и addslashes()</a>
[url=https://php-fusion.vveb.ws/php-fusion.php?id=30]Сохранение обратных слешей при добавлении и извлечении текста из БД. Вместо stripslashes() и addslashes()[/url]
|
|