 |
| ::: T4VN Statistics ::: |
PHP Scripts : 64 |
PHP Example : 67 |
PHP Tutorials : 21 |
PHP News : 93 |
Total Coupon : 36 |
Other Tutorials : |
Member : 215 |
Visitor Online : 2 |
Today Visit: 312 |
Total Visitor : 301334 |
Most Online : 41 |
|
 |
 |
BBCode Using MySQL
Author : hack adept
It takes the information from the database and translates the text a user enters into HTML, for security.
| PHP Example : | | <?php
function bbcode($text) {
$sql = mysql_query("SELECT * FROM bbcode") or die(mysql_error());
$tagArray = array();
while($row = mysql_fetch_array($sql)) {
$tagArray[$row['tagName']] = 'open' => $row['replaceOpen'], 'close' => $row['replaceClose'];
}
foreach($tagArray as $tagName => $replace) {
$tagEnd = preg_replace('/W/Ui','',$tagName);
$text = preg_replace("|[$tagName](.*)[/$tagEnd]|Ui","$replace[open]\1$replace[close]",$text);
}
return $text;
}
?>
| |
| |

|
 |
| ::: Resources ::: |
|
|
| ::: New Templates ::: |
|
| ::: Other Tutorials ::: |
|
 |