-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
122 lines (97 loc) · 2.71 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
setlocale(LC_CTYPE, 'en_US.UTF-8');
//date_default_timezone_set ('Etc/GMT-9');
$debug_message = '';
$error_message = '';
$output = '';
//$pwd = $_ENV["PWD"];
$pwd = dirname (__FILE__);
//$data_dir = dirname (__FILE__) . '/d';
function error ($message)
{
global $error_message;
$error_message .= $message.'<br />';
}
function debug ($message)
{
global $debug_message;
$debug_message .= $message.'<br />';
}
function error_handler($errno, $errstr, $errfile, $errline)
{
$errortype = array (
E_ERROR => 'Error',
E_WARNING => 'Warning',
E_PARSE => 'Parsing Error',
E_NOTICE => 'Notice',
E_CORE_ERROR => 'Core Error',
E_CORE_WARNING => 'Core Warning',
E_COMPILE_ERROR => 'Compile Error',
E_COMPILE_WARNING => 'Compile Warning',
E_USER_ERROR => 'User Error',
E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice',
E_STRICT => 'Runtime Notice',
E_RECOVERABLE_ERROR => 'Catchable Fatal Error'
);
error ($errfile.':'.$errline.': '.'['.$errortype[$errno].'('.$errno.')] '.$errstr);
return false;
}
// set to the user defined error handler
$old_error_handler = set_error_handler("error_handler");
function l($disp, $addr, $args=array())
{
$ret = '<a href="'.$addr;
if (count ($args))
{
$ret .= '?';
foreach ($args as $name => $value)
$ret .= $name.'='.$value.'&';
}
$ret .= '">'.$disp.'</a>';
return $ret;
}
if (isset ($_REQUEST['do']))
$do = $_REQUEST['do'];
else
$do = "nothing";
$args = explode ("/", $do);
$output .= "do : \"$do\"<br />";
$output .= "args : " . print_r ($args, TRUE) ."<br />";
setcookie("color","red");
$output .= "cookie color : ".$_COOKIE["color"]."<br />";
//setcookie("color","blue");
$output .= "cookie color : ".$_COOKIE["color"]."<br />";
//if ($get_src)
if (0)
{
header('Content-Type: document/text');
header('Content-Disposition: inline; filename=phpftp.php');
header('Content-Length: ' . filesize(__FILE__));
readfile (__FILE__);
exit (0);
}
if (isset ($output) || isset ($debug_message) || isset ($error_message))
{
echo '<html><head>';
echo '<meta name="viewport" ';
echo 'content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width" />';
echo '<style type="text/css">';
echo 'td.list_size { text-align: right; }';
echo 'table { border-collapse: collapse; }';
echo 'table tr td { border: 1px solid black; }';
echo '</style>';
echo '</head><body>';
if ($error_message != '')
{
echo '<div id="error">', $error_message, '</div>';
}
if ($debug_message != '')
{
echo '<div id="debug">', $debug_message, '</div>';
}
if (isset ($output))
echo $output;
echo '</body></html>';
}
?>