functie-smilie
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?
function smilie($text) {
$textresult = mysql_query("SELECT smilietext FROM smilies");
$imageresult = mysql_query("SELECT smilie FROM smilies");
$textrows = mysql_num_rows($textresult);
for ($i = 0; $list = mysql_fetch_array($textresult); $i++) {
$patterntext["$i"] = "/$list[smilietext]/";
}
for ($i = 0; $list = mysql_fetch_array($imageresult); $i++) {
$patternimage["$i"] = "<img src=\"" . $list[smilie] . "\">";
}
if ($textrows > '0') {
$text = preg_replace($patterntext, $patternimage, $text);
}
return $text;
}
?>
function smilie($text) {
$textresult = mysql_query("SELECT smilietext FROM smilies");
$imageresult = mysql_query("SELECT smilie FROM smilies");
$textrows = mysql_num_rows($textresult);
for ($i = 0; $list = mysql_fetch_array($textresult); $i++) {
$patterntext["$i"] = "/$list[smilietext]/";
}
for ($i = 0; $list = mysql_fetch_array($imageresult); $i++) {
$patternimage["$i"] = "<img src=\"" . $list[smilie] . "\">";
}
if ($textrows > '0') {
$text = preg_replace($patterntext, $patternimage, $text);
}
return $text;
}
?>