3 function spu_process_info($stream_info, $method, &$header, &$get, &$post, &$cookie)
9 foreach(preg_split("/(\r?\n)/", $stream_info) as $line) {
10 // printf("LINE: [%s]\n", $line);
12 if (!isset($header['The-Request'])) {
15 $req = explode(" ", $header['The-Request']);
18 if (isset($header['Cookie'])) {
19 $cookies = explode(";", $header['Cookie']);
20 for ($i = 0 ; $i < count($cookies) ; $i++) {
21 $nameval = explode("=", trim($cookies[$i]));
22 if (count($nameval) != 2) {
23 printf("WARNING: malformat cookie element [%s]\n", $cookies[$i]);
26 $cookie[$nameval[0]] = urldecode($nameval[1]);
29 // GET params management
30 $get_vars = explode('?', $req[1], 2);
32 if (count($get_vars) > 1) {
33 $a = explode('&', $get_vars[1]);
34 printf("A COUNT: [%s] %d\n", $a[0], count($a));
35 for ($i = 0 ; $i < count($a) ; $i++) {
36 $b = explode('=', $a[$i]);
37 $get[$b[0]] = urldecode($b[1]);
40 // POST params management
41 if ($req[0] == 'POST') {
42 if ($header['Content-Type'] != 'application/x-www-form-urlencoded'
43 || !isset($header['Content-Length'])) {
46 $post_len = mb_strlen($line, "latin1");
47 $a = explode('&', $line);
48 for ($i = 0 ; $i < count($a) ; $i++) {
49 $b = explode('=', $a[$i]);
50 $post[$b[0]] = urldecode($b[1]);
52 printf("INFO: postlen: %d\n", $post_len);
60 $split = explode(":", $line, 2);
61 $header[$split[0]] = $split[1];
66 function gpcs_var($name, $get, $post, $cookie)
68 if (isset($GLOBALS[$name]))
70 else if (isset($cookie[$name]))
71 return ($cookie[$name]);
72 else if (isset($post[$name]))
73 return ($post[$name]);
74 else if (isset($get[$name]))