°Ô½ÃÆǵîÀ» º¸¸é ƯÁ¤ ÇѱÛÀÌ "££4022;" Çü½ÄÀ¸·Î ÄÚµåÈµÇ´Â°É º¼ ¼ö Àִµ¥¿ä.
¹üÀÎÀº htmlspecialchars() ¿´½À´Ï´Ù.
¿ÀŸ³ª Çر«ÇÑ Åë½Å¿ë¾î¸¦ »ç¿ëÇÒ °æ¿ì¿¡ À§¿Í °°Àº ¹®Á¦°¡ ¹ß»ýÇÕ´Ï´Ù.
À§ ÇÔ¼ö¸¦ »ç¿ëÇÏÁö ¾ÊÀ¸¸é ¿ø·¡ ±ÛÀÚ°¡ ±×´ë·Î ³ª¿É´Ï´Ù.
ÇØ°á¹æ¹ýÀº htmlspecialchars()´ë½Å..
$new_string = ereg_replace('<','£¦lt;',$string);
ÀÌ·¸°Ô ÇÏ½Ã¸é µÇ°Ú½À´Ï´Ù. ¹°·Ð '>'µµ '£¦gt;'·Î º¯°æÇÏ¸é µÇ°ÚÁö¸¸ '<'¸¸ ¹Ù±îÁÒµµ Àß µË´Ï´Ù.
¾Æ·¡ ´ëüÇÔ¼ö¸¦ ¼Ò°³ÇÕ´Ï´Ù.
// htmlspecialchars °¡ ÇѱÛÀ» ±ú¸ÔÀ¸´Ï±î. »õ·ÎÁ¤ÀÇÇÑ´Ù.
function htmlspecialchars2($str) {
$str = str_replace( "&", "&", $str );
$str = str_replace( """,""", $str );
$str = str_replace( "'","'", $str );
$str = str_replace( "<", "<", $str );
$str = str_replace( ">", ">", $str );
return $str;
}
|