-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.inc.php
More file actions
152 lines (140 loc) · 5.92 KB
/
index.inc.php
File metadata and controls
152 lines (140 loc) · 5.92 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
// password add-on start
session_start();
$pass = sha1('changeme'); // the pass for proxy access
$gpass = isset($_SESSION['pass']) ? $_SESSION['pass'] : '';
if($gpass != $pass)
{
$data['category'] = 'login';
}
if(isset($_POST['loginacc']))
{
$_SESSION['pass'] = sha1(isset($_POST['password']) ? $_POST['password'] : '');
if($pass == $_SESSION['pass'])
{
$data['category'] = 'success';
}
}
// password add-on end
if (basename(__FILE__) == basename($_SERVER['PHP_SELF']))
{
exit(0);
}
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>PHProxy</title>
<link rel="stylesheet" type="text/css" href="style.css" title="Default Theme" media="all" />
</head>
<body onload="document.getElementById('address_box').focus()">
<div id="container">
<h1 id="title">PHProxy</h1>
<ul id="navigation">
<li><a href="<?php echo $GLOBALS['_script_base'] ?>">URL Form</a></li>
<li><a href="javascript:alert('cookie managment has not been implemented yet')">Manage Cookies</a></li>
</ul>
<?php
switch ($data['category'])
{
case 'auth':
?>
<div id="auth"><p>
<b>Enter your username and password for "<?php echo htmlspecialchars($data['realm']) ?>" on <?php echo $GLOBALS['_url_parts']['host'] ?></b>
<form method="post" action="">
<input type="hidden" name="<?php echo $GLOBALS['_config']['basic_auth_var_name'] ?>" value="<?php echo base64_encode($data['realm']) ?>" />
<label>Username <input type="text" name="username" value="" /></label> <label>Password <input type="password" name="password" value="" /></label> <input type="submit" value="Login" />
</form></p></div>
<?php
break;
// password-related forms start
case 'login':
?>
<div id="auth"><p>
<b>Enter your password</b>
<form method="post" action="">
<input type="hidden" name="loginacc" value="1">
<label>Password <input type="password" name="password" value="" /></label> <input type="submit" value="Login" />
</form></p></div>
<?php
break;
case 'success':
?>
<div id="auth"><p>
<b>Success!</b><div>
You have logged in succesfully!</div></p></div>
<?php
break;
// password-related forms end
case 'error':
echo '<div id="error"><p>';
switch ($data['group'])
{
case 'url':
echo '<b>URL Error (' . $data['error'] . ')</b>: ';
switch ($data['type'])
{
case 'internal':
$message = 'Failed to connect to the specified host. '
. 'Possible problems are that the server was not found, the connection timed out, or the connection refused by the host. '
. 'Try connecting again and check if the address is correct.';
break;
case 'external':
switch ($data['error'])
{
case 1:
$message = 'The URL you\'re attempting to access is blacklisted by this server. Please select another URL.';
break;
case 2:
$message = 'The URL you entered is malformed. Please check whether you entered the correct URL or not.';
break;
}
break;
}
break;
case 'resource':
echo '<b>Resource Error:</b> ';
switch ($data['type'])
{
case 'file_size':
$message = 'The file your are attempting to download is too large.<br />'
. 'Maxiumum permissible file size is <b>' . number_format($GLOBALS['_config']['max_file_size']/1048576, 2) . ' MB</b><br />'
. 'Requested file size is <b>' . number_format($GLOBALS['_content_length']/1048576, 2) . ' MB</b>';
break;
case 'hotlinking':
$message = 'It appears that you are trying to access a resource through this proxy from a remote Website.<br />'
. 'For security reasons, please use the form below to do so.';
break;
}
break;
}
echo 'An error has occured while trying to browse through the proxy. <br />' . $message . '</p></div>';
break;
}
if($data['category'] != 'login')
{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<ul id="form">
<li id="address_bar"><label>Web Address <input id="address_box" type="text" name="<?php echo $GLOBALS['_config']['url_var_name'] ?>" value="<?php echo isset($GLOBALS['_url']) ? htmlspecialchars($GLOBALS['_url']) : '' ?>" onfocus="this.select()" /></label> <input id="go" type="submit" value="Go" /></li>
<?php
foreach ($GLOBALS['_flags'] as $flag_name => $flag_value)
{
if (!$GLOBALS['_frozen_flags'][$flag_name])
{
echo '<li class="option"><label><input type="checkbox" name="' . $GLOBALS['_config']['flags_var_name'] . '[' . $flag_name . ']"' . ($flag_value ? ' checked="checked"' : '') . ' />' . $GLOBALS['_labels'][$flag_name][1] . '</label></li>' . "\n";
}
}
?>
</ul>
</form>
<?php
}
?>
<!-- The least you could do is leave this link back as it is. This software is provided for free and I ask nothing in return except that you leave this link intact
You're more likely to recieve support should you require some if I see a link back in your installation than if not -->
<div id="footer"><a href="http://whitefyre.com/poxy/">PHProxy</a> <?php echo $GLOBALS['_version'] ?></div>
</div>
</body>
</html>