make getpeername() return the original socket address which before it was intercepted
[hband-tools.git] / user-tools / dump_php_session.php
blob82e36af2d3266e0b8c8746a1ee0b61920b98ac87
1 #!/usr/bin/env php
2 <?php
4 $session_files = array_slice($argv, 1, $argc - 1);
5 if(count($session_files) < 1 or $session_files[0] == '--help')
7 die("Usage: $argv[0] files\n");
10 exec("mktemp -d", $output, $code);
11 if($code != 0) die($code);
12 $temp_dir = $output[count($output)-1];
13 echo "TMPDIR=$temp_dir" . PHP_EOL;
14 session_save_path($temp_dir);
16 foreach($session_files as $file)
18 @session_start();
19 session_decode(file_get_contents($file));
20 print_r($_SESSION);
21 session_destroy();
25 exec("rm -r ".escapeshellarg($temp_dir), $output, $code);
26 if($code != 0) die($code);