|
|
|
ช่วยอธิบายขั้นตอนการทำงานทีคับงงมากๆเลยคับ function CheckTag($temp){ global $url; $temp = strip |
|
|
|
|
|
|
|
function CheckTag($temp){
global $url;
$temp = stripslashes(htmlspecialchars($temp));
$temp = eregi_replace ( "<" , "<" , $temp ) ;
$temp = eregi_replace ( ">" , ">" , $temp ) ;
$temp = eregi_replace ( "\n", "<br>" , $temp ) ;
//ÊÓËÃѺà»ÅÕè¹ÍÑ¡¢ÃзÕè¡Ó˹´ ãËéà»ç¹á·¡ html µèÒ§æ
$temp = eregi_replace ( "\[b\]", "<b>" , $temp ) ;
$temp = eregi_replace ( "\[/b\]", "</b>" , $temp ) ;
$temp = eregi_replace ( "\[i\]", "<i>" , $temp ) ;
$temp = eregi_replace ( "\[/i\]", "</i>" , $temp ) ;
$temp = eregi_replace ( "\[u\]", "<u>" , $temp ) ;
$temp = eregi_replace ( "\[/u\]", "</u>" , $temp ) ;
$temp = eregi_replace ( "\[\-\-\-\]", " " , $temp ) ;
$temp = eregi_replace ( "\[color=red\]", "<font color=red>" , $temp ) ;
$temp = eregi_replace ( "\[color=green\]", "<font color=green>" , $temp ) ;
$temp = eregi_replace ( "\[color=blue\]", "<font color=blue>" , $temp ) ;
$temp = eregi_replace ( "\[color=orange\]", "<font color=FF6600>" , $temp ) ;
$temp = eregi_replace ( "\[color=pink\]", "<font color=FF00FF>" , $temp ) ;
$temp = eregi_replace ( "\[color=gray\]", "<font color=999999>" , $temp ) ;
$temp = eregi_replace ( "\[/color\]", "</font>" , $temp ) ;
// ¤ÓÊÑè§áÊ´§ÃÙ»·Õèá·Ã¡¤ÓÊÑè§à¢éÒÁÒ
$temp = eregi_replace ("\[img\]([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]])\[/img\]", "<img src=\"\\1://\\2\\3\">",$temp ) ;
// ÊÃéÒ§ÅÔ§¤ì URL ·Õèá·Ã¡¤ÓÊÑè§à¢éÒÁÒ (¡Ã³ÕãËé¤ÓÊÑè§ url à¢éÒÁÒ)
$temp = eregi_replace ("\[url\]([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])\[/url\]","<a href=\"\\1://\\2\\3\" target=\"_blank\">\\1://\\2\\3</a>",$temp ) ;
// ÊÃéÒ§ÅÔ§¤ì URL ·Õèá·Ã¡¤ÓÊÑè§à¢éÒÁÒ (µèÒ§¡Ñ¹·Õè¡ÒÃàÇ鹪èͧÇèҧ˹éÒËÅѧ)
$temp = eregi_replace (" ([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=]) "," <a href=\"\\1://\\2\\3\" target=\"_blank\">\\1://\\2\\3</a> ",$temp ) ;
// ÊÃéÒ§ÅÔ§¤ì URL ·Õèá·Ã¡¤ÓÊÑè§à¢éÒÁÒ (µèÒ§¡Ñ¹·Õè¡ÒÃàÇ鹪èͧÇèÒ§ËÅѧÍÂèÒ§à´ÕÂÇ)
$temp = eregi_replace ("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=]) "," <a href=\"\\1://\\2\\3\" target=\"_blank\">\\1://\\2\\3</a> ",$temp ) ;
//ÊÃéÒ§ÅÔ§¤ìÍÕàÁÅì
$temp = eregi_replace ("([^[:space:]]*)@([^[:space:]]*)([[:alnum:]])","<a href=\"./mail2me/mail2me.php?wemail=\\1@\\2\\3&name=\\1@\\2\\3\" target=\"_blank\">\\1@\\2\\3</a>",$temp ) ;
return ( $temp ) ;
}
Tag : - - - -
|
|
|
|
|
|
Date :
31 ม.ค. 2550 21:28:33 |
By :
ve |
View :
1776 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$temp = stripslashes(htmlspecialchars($temp));
$temp = eregi_replace ( "<" , "<" , $temp ) ;
เป็น คำสั่งเพื่อให้แสดง ภาษา html ได้อย่างถูกต้อง และเก้บลงฐานข้อมมูลจะไม่มีผลได้ๆ กับคำสั่ง php เพื่อป้องกันผิดพลาดของโค้ดที่ใกล้เคียงกัน
|
|
|
|
|
Date :
1 ก.พ. 2550 02:09:52 |
By :
arsachi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sfsdfdsfdsfdsfdsfdsfdsfdsfddsfdsfafdsfsf
|
|
|
|
|
Date :
2009-07-07 22:44:44 |
By :
napasools |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|