Deprecated: Function ereg_replace() is deprecated
dit is het script en zouden jullie mij misschien kunnen laten zien wat en hoe ik het precies moet veranderen:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
session_start();
if($_SESSION['name']) {
include "../config.php";
function parseubb($message){
$message = str_replace ("[br]","\n",$message);
$message = str_replace ("\n","<br>",$message);
$message = str_replace ("","<b>Code:</b><br><table bgcolor=\"#000000\" cellspacing=\"1\" width=\"90%\"><tr><td><table cellpadding=2 cellspacing=\"0\" bgcolor=\"#FFFFFF\" width=\"100%\"><tr><td><font face=Courier size=\"1\" color=\"#000000\">", $message);
$message = str_replace ("", "</font></td></tr></table></td></tr></table>", $message);
$message = preg_replace("/\[b\](.*?)\[\/b\]/si", "<b>\\1</b>",$message);
$message = preg_replace("/\[i\](.*?)\[\/i\]/si", "<i>\\1</i>",$message);
$message = preg_replace("/\[u\](.*?)\[\/u\]/si", "<u>\\1</u>",$message);
$message = preg_replace("/\[s\](.*?)\[\/s\]/si", "<s>\\1</s>",$message);
$message = preg_replace("/\[move\](.*?)\[\/move\]/si", "<div align=\"center\"><marquee width=\"90%\">\\1</marquee></div>",$message);
$message = preg_replace ("#\[color=(\#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]#si", "<font color=\"\\1\">\\2</font>", $message);
$message = preg_replace ("/\[font=(.*)\](.*)\[\/font\]/", "<font face=\"$1\">$2</font>", $message);
$message = preg_replace ("/\[size=(.*)\](.*)\[\/size\]/", "<font size=\"$1\">$2</font>", $message);
$message = preg_replace("/\[img\](.*?)\[\/img\]/si", "<a href=\"\\1\" target=\"_blank\"><img src=\"\\1\" border=\"0\" width=\"20\"></a>",$message);
$message = preg_replace("/\[tt\](.*?)\[\/tt\]/si", "<tt>\\1</tt>",$message);
$message = preg_replace("/\[left\](.*?)\[\/left\]/si", "<div align=\"left\">\\1</div>",$message);
$message = preg_replace("/\[center\](.*?)\[\/center\]/si", "<div align=\"center\">\\1</div>",$message);
$message = preg_replace("/\[right\](.*?)\[\/right\]/si", "<div align=\"right\">\\1</div>",$message);
$message = preg_replace("/\[sub\](.*?)\[\/sub\]/si", "<sub>\\1</sub>",$message);
$message = preg_replace("/\[sup\](.*?)\[\/sup\]/si", "<sup>\\1</sup>",$message);
$message = preg_replace("/\[fixed\](.*?)\[\/fixed\]/si", "<font face=\"Courier New\">\\1</font>",$message);
$message = str_replace ("[[","{{",$message);
$message = str_replace ("]]","}}",$message);
$message = str_replace ("|","|",$message);
$message = preg_replace("/\[pre\](.*?)\[\/pre\]/si", "<pre>\\1</pre>",$message);
$message = str_replace ("{{","[",$message);
$message = str_replace ("}}","]",$message);
$message = str_replace ("[hr]","<hr color=\"#FFFFFF\" noshade />",$message);
$message = eregi_replace("\\[email=([^\\[]*)\\]([^\\[]*)\\[/email\\]", "<a href=\"mailto:\\1\">\\2</a>",$message);
$message = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\2</a>",$message);
$message = preg_replace("/\[url\](.*?)\[\/url\]/si", "<a href=\"\\1\" target=_blank>\\1</a>",$message);
$message = preg_replace("/\[email\](.*?)\[\/email\]/si", "<a href=\"mailto:\\1\">\\1</a>",$message);
$message = preg_replace ("#\[ftp\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/ftp\]#", "<a href=\"ftp://\\1\\2\" target=\"_blank\">\\2</a>", $message);
$message = preg_replace ("#\[ftp\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/ftp\]#", "<a href=\"ftp://\\1\" target=\"_blank\">\\1</a>", $message);
$message = preg_replace ("#\[ftp=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/ftp\]#", "<a href=\"ftp://\\1\\2\" target=\"_blank\">\\2</a>", $message);
$message = preg_replace ("#\[ftp=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/ftp\]#", "<a href=\"ftp://\\1\" target=\"_blank\">\\2</a>", $message);
$message = str_replace(":)"," <img src=\"images/smilies/smile.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("8["," <img src=\"images/smilies/huh.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":o"," <img src=\"images/smilies/ohmy.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(";)"," <img src=\"images/smilies/wink.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":P"," <img src=\"images/smilies/tongue.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":p"," <img src=\"images/smilies/tongue.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":D"," <img src=\"images/smilies/biggrin.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("8)"," <img src=\"images/smilies/cool.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("*-)"," <img src=\"images/smilies/rolleyes.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":?"," <img src=\"images/smilies/dry.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":@"," <img src=\"images/smilies/mad.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":("," <img src=\"images/smilies/sad.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("8-)"," <img src=\"images/smilies/unsure.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":["," <img src=\"images/smilies/blink.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("[:-]"," <img src=\"images/smilies/ph34r.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(";/"," <img src=\"images/smilies/happy.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("[-)"," <img src=\"images/smilies/sleep.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("(l)"," <img src=\"images/smilies/wub.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("(L)"," <img src=\"images/smilies/wub.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":s"," <img src=\"images/smilies/wacko.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":S"," <img src=\"images/smilies/wacko.gif\" alt=\"Smilie\" />",$message);
return $message;
}
$query1 = mysql_query("SELECT * FROM ichatgesprek WHERE code = '".$_GET['code']."' AND id1 = '".$_SESSION['userid']."'") or die (mysql_error());
while ($obj1 = mysql_fetch_assoc($query1)) {
$stat = $obj1['status'];
if($stat == 'close') {
echo '<b>Your contact has closed the conversation. He/she doesnt receive anything from you anymore.</b>';
}
}
$query = mysql_query("SELECT * FROM ichatchat WHERE code = '".$_GET['code']."' ORDER BY id ASC") or die (mysql_error());
while ($obj = mysql_fetch_assoc($query)) {
$nick = $obj['nick'];
$message = htmlspecialchars($obj['message']);
$time1 = $obj['time'];
if($time1 > $_SESSION['time']) {
echo '<b>'.$nick.':</b> '.parseubb($message).'<br />';
}
}
}
?>
session_start();
if($_SESSION['name']) {
include "../config.php";
function parseubb($message){
$message = str_replace ("[br]","\n",$message);
$message = str_replace ("\n","<br>",$message);
$message = str_replace ("","<b>Code:</b><br><table bgcolor=\"#000000\" cellspacing=\"1\" width=\"90%\"><tr><td><table cellpadding=2 cellspacing=\"0\" bgcolor=\"#FFFFFF\" width=\"100%\"><tr><td><font face=Courier size=\"1\" color=\"#000000\">", $message);
$message = str_replace ("", "</font></td></tr></table></td></tr></table>", $message);
$message = preg_replace("/\[b\](.*?)\[\/b\]/si", "<b>\\1</b>",$message);
$message = preg_replace("/\[i\](.*?)\[\/i\]/si", "<i>\\1</i>",$message);
$message = preg_replace("/\[u\](.*?)\[\/u\]/si", "<u>\\1</u>",$message);
$message = preg_replace("/\[s\](.*?)\[\/s\]/si", "<s>\\1</s>",$message);
$message = preg_replace("/\[move\](.*?)\[\/move\]/si", "<div align=\"center\"><marquee width=\"90%\">\\1</marquee></div>",$message);
$message = preg_replace ("#\[color=(\#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]#si", "<font color=\"\\1\">\\2</font>", $message);
$message = preg_replace ("/\[font=(.*)\](.*)\[\/font\]/", "<font face=\"$1\">$2</font>", $message);
$message = preg_replace ("/\[size=(.*)\](.*)\[\/size\]/", "<font size=\"$1\">$2</font>", $message);
$message = preg_replace("/\[img\](.*?)\[\/img\]/si", "<a href=\"\\1\" target=\"_blank\"><img src=\"\\1\" border=\"0\" width=\"20\"></a>",$message);
$message = preg_replace("/\[tt\](.*?)\[\/tt\]/si", "<tt>\\1</tt>",$message);
$message = preg_replace("/\[left\](.*?)\[\/left\]/si", "<div align=\"left\">\\1</div>",$message);
$message = preg_replace("/\[center\](.*?)\[\/center\]/si", "<div align=\"center\">\\1</div>",$message);
$message = preg_replace("/\[right\](.*?)\[\/right\]/si", "<div align=\"right\">\\1</div>",$message);
$message = preg_replace("/\[sub\](.*?)\[\/sub\]/si", "<sub>\\1</sub>",$message);
$message = preg_replace("/\[sup\](.*?)\[\/sup\]/si", "<sup>\\1</sup>",$message);
$message = preg_replace("/\[fixed\](.*?)\[\/fixed\]/si", "<font face=\"Courier New\">\\1</font>",$message);
$message = str_replace ("[[","{{",$message);
$message = str_replace ("]]","}}",$message);
$message = str_replace ("|","|",$message);
$message = preg_replace("/\[pre\](.*?)\[\/pre\]/si", "<pre>\\1</pre>",$message);
$message = str_replace ("{{","[",$message);
$message = str_replace ("}}","]",$message);
$message = str_replace ("[hr]","<hr color=\"#FFFFFF\" noshade />",$message);
$message = eregi_replace("\\[email=([^\\[]*)\\]([^\\[]*)\\[/email\\]", "<a href=\"mailto:\\1\">\\2</a>",$message);
$message = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\2</a>",$message);
$message = preg_replace("/\[url\](.*?)\[\/url\]/si", "<a href=\"\\1\" target=_blank>\\1</a>",$message);
$message = preg_replace("/\[email\](.*?)\[\/email\]/si", "<a href=\"mailto:\\1\">\\1</a>",$message);
$message = preg_replace ("#\[ftp\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/ftp\]#", "<a href=\"ftp://\\1\\2\" target=\"_blank\">\\2</a>", $message);
$message = preg_replace ("#\[ftp\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/ftp\]#", "<a href=\"ftp://\\1\" target=\"_blank\">\\1</a>", $message);
$message = preg_replace ("#\[ftp=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/ftp\]#", "<a href=\"ftp://\\1\\2\" target=\"_blank\">\\2</a>", $message);
$message = preg_replace ("#\[ftp=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/ftp\]#", "<a href=\"ftp://\\1\" target=\"_blank\">\\2</a>", $message);
$message = str_replace(":)"," <img src=\"images/smilies/smile.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("8["," <img src=\"images/smilies/huh.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":o"," <img src=\"images/smilies/ohmy.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(";)"," <img src=\"images/smilies/wink.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":P"," <img src=\"images/smilies/tongue.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":p"," <img src=\"images/smilies/tongue.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":D"," <img src=\"images/smilies/biggrin.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("8)"," <img src=\"images/smilies/cool.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("*-)"," <img src=\"images/smilies/rolleyes.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":?"," <img src=\"images/smilies/dry.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":@"," <img src=\"images/smilies/mad.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":("," <img src=\"images/smilies/sad.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("8-)"," <img src=\"images/smilies/unsure.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":["," <img src=\"images/smilies/blink.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("[:-]"," <img src=\"images/smilies/ph34r.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(";/"," <img src=\"images/smilies/happy.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("[-)"," <img src=\"images/smilies/sleep.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("(l)"," <img src=\"images/smilies/wub.gif\" alt=\"Smilie\" />",$message);
$message = str_replace("(L)"," <img src=\"images/smilies/wub.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":s"," <img src=\"images/smilies/wacko.gif\" alt=\"Smilie\" />",$message);
$message = str_replace(":S"," <img src=\"images/smilies/wacko.gif\" alt=\"Smilie\" />",$message);
return $message;
}
$query1 = mysql_query("SELECT * FROM ichatgesprek WHERE code = '".$_GET['code']."' AND id1 = '".$_SESSION['userid']."'") or die (mysql_error());
while ($obj1 = mysql_fetch_assoc($query1)) {
$stat = $obj1['status'];
if($stat == 'close') {
echo '<b>Your contact has closed the conversation. He/she doesnt receive anything from you anymore.</b>';
}
}
$query = mysql_query("SELECT * FROM ichatchat WHERE code = '".$_GET['code']."' ORDER BY id ASC") or die (mysql_error());
while ($obj = mysql_fetch_assoc($query)) {
$nick = $obj['nick'];
$message = htmlspecialchars($obj['message']);
$time1 = $obj['time'];
if($time1 > $_SESSION['time']) {
echo '<b>'.$nick.':</b> '.parseubb($message).'<br />';
}
}
}
?>
Gewijzigd op 10/11/2011 19:15:10 door Ouassim B
de preg_* functie gebruiken, ook is je script lek
daar heb ik van gehoord maar ik heb het script zelf niet geschreven dus zou je mij dit script met de veranderingen kunnen geven?
Oke ik snap wat jullie bedoelen maar zoals ik net vertelde ben ik nu niet echt bepaald de super ster in PHP dus ik zou het heel erg waarderen als iemand die veranderingen voor mij zou kunnen maken.
Code (php)
1
2
2
$message = preg_replace("~\\[email=([^\\[]*)\\]([^\\[]*)\\[/email\\]~", "<a href=\"mailto:\\1\">\\2</a>",$message);
$message = preg_replace("~\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]~","<a href=\"\\1\" target=_blank>\\2</a>",$message);
$message = preg_replace("~\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]~","<a href=\"\\1\" target=_blank>\\2</a>",$message);
Gewoon eens delimiter toevoegen voor en achter aan je expressie.