Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head>
- <title>Testing</title>
- <meta charset="utf-8">
- </head>
- <body>
- <?php
- echo '<pre>';
- $_SERVER['REDIRECT_SSL_CLIENT_S_DN'] = '../CN=\x00M\x00\xC4\x00,\x00I\x00S\x00,\x004\x000\x003\x001\x002\x000\x000\x002/SN=..';
- $pattern = '/CN=(.*)\\/SN=/';
- preg_match($pattern, $_SERVER['REDIRECT_SSL_CLIENT_S_DN'], $server_matches);
- $string = $server_matches[1];
- $string = str_replace('\x00', NULL, $string);
- preg_match('/\\\x[A-F0-9]{2}/', $string, $matches);
- foreach ($matches as $key => $value) {
- $string = str_replace($value, utf8_encode(chr(hexdec($value))), $string);
- }
- echo($string);
- $splitted = str_split($string);
- print_r($splitted);
- echo '<input value="'.$string.'">';
- /*
- results:
- String content (CORRECT)
- MÄ,IS,40312002
- Array content: (STRANGE)
- (
- [0] => M
- [1] => �
- [2] => �
- [3] => ,
- [4] => I
- [5] => S
- [6] => ,
- [7] => 4
- [8] => 0
- [9] => 3
- [10] => 1
- [11] => 2
- [12] => 0
- [13] => 0
- [14] => 2
- )
- Input content: (CORRECT)
- MÄ,IS,40312002
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement