|
|
|
| подскажите!
вот есть код
<?php
require_once "config.php";
$query2 = "SELECT id_reply author, date, text FROM replys WHERE id_new = 5";
$cat2 = mysql_query($query2);
// Проверяем успешность выполнения SQL-запроса
if(!$cat2) exit(mysql_erorr());
if (mysql_num_rows($cat2) > 0)
{
echo "<h2>комментарии:</h2>";
while(list($id, $name, $date, $text) = mysql_fetch_row($cat2))
{
$text = str_replace("","<i>", $text);
$text = str_replace("","</i>", $text);
$text = str_replace("","<b>", $text);
$text = str_replace("","</b>", $text);
$text = str_replace("[u]","<u>", $text);
$text = str_replace("[/u]","</u>", $text);
$text = str_replace('[smile:"=)"]', '<img src="smiles/=).gif" >', $text);
$text = str_replace('[smile:"bye"]', ' <img src="smiles/bye.gif" >', $text);
$text = str_replace('[smile:"clapping"]', ' <img src="smiles/clapping.gif" >', $text);
$text = str_replace('[smile:"close_tema"]', ' <img src="smiles/close_tema.gif" >', $text);
$text = str_replace('[smile:"cool"]', ' <img src="smiles/cool.gif" >', $text);
$text = str_replace('[smile:"evil]', ' <img src="smiles/crazy.gif" >', $text);
$text = str_replace('[smile:"flood"]', ' <img src="smiles/crazy_pilot.gif" >', $text);
$text = str_replace('[smile:"crazy"]', ' <img src="smiles/drinks.gif" >', $text);
$text = str_replace('[smile:"crazy_pilot"]', ' <img src="smiles/evil.gif" >', $text);
$text = str_replace('[smile:"drinks"]', ' <img src="smiles/flood.gif" >', $text);
$text = str_replace('[smile:"force"]', ' <img src="smiles/force.gif" >', $text);
$text = str_replace('[smile:"girl_devil"]', ' <img src="smiles/fuk.gif" >', $text);
$text = str_replace('[smile:"girl_witch"]', ' <img src="smiles/girl_devil.gif" >', $text);
$text = str_replace('[smile:"haha"]', ' <img src="smiles/girl_witch.gif" >', $text);
$text = str_replace('[smile:"help"]', ' <img src="smiles/haha.gif" >', $text);
$text = str_replace('[smile:"fuk"]', ' <img src="smiles/help.gif" >', $text);
$text = str_replace('[smile:"lol"]', ' <img src="smiles/lol.gif" >', $text);
$text = str_replace('[smile:"mad"]', ' <img src="smiles/mad.gif" >', $text);
$text = str_replace('[smile:"no"]', ' <img src="smiles/no.gif" >', $text);
$text = str_replace('[smile:"nono"]', ' <img src="smiles/nono.gif" >', $text);
$text = str_replace('[smile:"nyamf"]', ' <img src="smiles/nyam.gif" >', $text);
$text = str_replace('[smile:"ninzya"]', ' <img src="smiles/ph34r.gif" >', $text);
$text = str_replace('[smile:"wink"]', ' <img src="smiles/punish2.gif" >', $text);
$text = str_replace('[smile:"wall"]', ' <img src="smiles/rtfm.gif" >', $text);
$text = str_replace('[smile:"wacko"]', ' <img src="smiles/russian_roulette.gif" >', $text);
$text = str_replace('[smile:"to_babruysk"]', ' <img src="smiles/shok.gif" >', $text);
$text = str_replace('[smile:"tomato"]', ' <img src="smiles/slow.gif" >', $text);
$text = str_replace('[smile:"shok"]', ' <img src="smiles/spiteful.gif" >', $text);
$text = str_replace('[smile:"russian_roulette"]', ' <img src="smiles/tomato.gif" >', $text);
$text = str_replace('[smile:"read!"]', ' <img src="smiles/to_babruysk.gif" >', $text);
$text = str_replace('[smile:"punish"]', ' <img src="smiles/wacko.gif" >', $text);
$text = str_replace('[smile:"slow"]', ' <img src="smiles/wall.gif" >', $text);
$text = str_replace('[smile:"spiteful"]', ' <img src="smiles/wink.gif" >', $text);
$text = preg_replace("#\[url\][\s]*([\S]*)[\s]*\[\/url\]#isU",
'<a href="\\1" target=_blank>\\1</a>',
$text);
$text = preg_replace("#\[url[\s]*=[\s]*([\S]+)[\s]*\][\s]*([^\[]*)\[/url\]#isU",
'<a href="\\1" target=_blank>\\2</a>',
$text);
echo $text;
echo "<font color='#00ff00'>$name</font> написано $date<br>$text<hr color=#008800>";
}
}
?>
|
но скрипт НИЧЕГО не делает! например строку
2007-07-01 21:53:39 написано там пам [u]пам[/u] [smile:"girl_witch"]
так и возвращает! что это может быть и как с эти бороться? | |
|
|
|
|
|
|
|
для: выдр
(01.07.2007 в 19:22)
| | я бы советовал воспользоваться
1. регулярными
2. функцией strtr | |
|
|
|
|
|
|
|
для: bronenos
(01.07.2007 в 19:43)
| | дак это работает, но в другом коде =( конкретно в этом не пашет | |
|
|
|
|
|
|
|
для: выдр
(01.07.2007 в 20:03)
| | Такого быть не может. Начните удалять лишние строки, пока не найдете ошибку.
Вот PHP начнет на операцию 2 + 2 выдавать, например "5", то тогда есть повод для беспокойства. | |
|
|
|
|