forked from telephone/LookingGlass
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathindex.php
160 lines (149 loc) · 5.64 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
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
153
154
155
156
157
158
159
160
<?php
// lazy config check/load
if (file_exists('LookingGlass/Config.php')) {
require 'LookingGlass/Config.php';
if (!isset($ipv4, $ipv6, $siteName, $siteUrl, $serverLocation, $testFiles, $theme)) {
exit('Configuration variable/s missing. Please run configure.sh');
}
} else {
exit('Config.php does not exist. Please run configure.sh');
}
function getIP() {
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '') {
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip_address = $_SERVER['REMOTE_ADDR'];
}
return $ip_address;
}
?>
<!DOCTYPE html>
<html lang="en">
<!--
__ _
.: .' '.
/: / \_
;: ; ,-'/`:\
|: | | |() :|
;: ; '-.\_:/
\: \ /`
':_'._.'
||
/__\
.---. {====}
.' _,"-,__|:: |
/ ((O)=;--.:: |
; `|: | |:: |
| |: | |:: | *****************************
| |: | |:: | * LookingGlass by Telephone *
| |: | |:: | * http://iamtelephone.com *
| |: | |:: | *****************************
| |: | |:: |
| /:'__\ |:: |
| [______]|:: |
| `----` |:: |__
| _.--|:: | ''--._
; .' __{====}__ '.
\ .'_.-'._ `""` _.'-._ '.
'--'/` `''''` `\ '.__
'._ _.'
`""--......--""`
-->
<head>
<meta charset="utf-8">
<title><?php echo $siteName; ?> - Looking Glass</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="LookingGlass - Open source PHP looking glass">
<meta name="author" content="Telephone">
<!-- IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Styles -->
<link href="assets/css/<?php echo $theme; ?>.min.css" rel="stylesheet">
</head>
<body>
<!-- Container -->
<div class="container">
<!-- Header -->
<header class="header nohighlight" id="overview">
<div class="row">
<div class="span12">
<h1><a id="title" href="<?php echo $siteUrl; ?>"><?php echo $siteName; ?></a></h1>
</div>
</div>
</header>
<!-- Network Information -->
<section id="information">
<div class="row">
<div class="span12">
<div class="well">
<span id="legend">网络信息</span><!-- IE/Safari dislike <legend> out of context -->
<p>服务器位置: <b><?php echo $serverLocation; ?></b></p>
<div style="margin-left: 10px;">
<p>测试 IPv4: <?php echo $ipv4; ?></p>
<p><?php if (!empty($ipv6)) { echo '测试 IPv6: ',$ipv6; } ?></p>
<p>测试文件: <?php
foreach ($testFiles as $val) {
echo "<a href=\"{$val}.test\" id=\"testfile\">{$val}</a> ";
}
?></p>
</div>
<p>您的IP: <b><a href="#tests" id="userip"><?php echo getIP(); ?></a></b></p>
</div>
</div>
</div>
</section>
<!-- Network Tests -->
<section id="tests">
<div class="row">
<div class="span12">
<form class="well form-inline" id="networktest" action="#results" method="post">
<fieldset>
<span id="legend">网络测试</span>
<div id="hosterror" class="control-group">
<div class="controls">
<input id="host" name="host" type="text" class="input-large" placeholder="域名或IP">
</div>
</div>
<select name="cmd" class="input-medium" style="margin-left: 5px;">
<option value="host">host</option>
<option value="mtr">mtr</option>
<?php if (!empty($ipv6)) { echo '<option value="mtr6">mtr6</option>'; } ?>
<option value="ping" selected="selected">ping</option>
<?php if (!empty($ipv6)) { echo '<option value="ping6">ping6</option>'; } ?>
<option value="traceroute">traceroute</option>
<?php if (!empty($ipv6)) { echo '<option value="traceroute6">traceroute6</option>'; } ?>
</select>
<button type="submit" id="submit" name="submit" class="btn btn-primary" style="margin-left: 10px;">开始测试</button>
</fieldset>
</form>
</div>
</div>
</section>
<!-- Results -->
<section id="results" style="display:none">
<div class="row">
<div class="span12">
<div class="well">
<span id="legend">测试结果</span>
<pre id="response" style="display:none"></pre>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="footer nohighlight">
<p class="pull-right">
<a href="<?php echo $siteUrl . "/en.php"; ?>">English</a>
<a href="#">回到顶部</a>
</p>
<p>Modified by <a href="https://github.com/ILLKX/LookingGlass">LookingGlass</a> - Powered by <a href="https://github.com/telephone/LookingGlass">LookingGlass</a></p>
</footer>
</div><!-- /container -->
<!-- Javascript -->
<script src="assets/js/jquery-1.11.2.min.js"></script>
<script src="assets/js/LookingGlass.min.js"></script>
<script src="assets/js/XMLHttpRequest.min.js"></script>
</body>
</html>