forked from iinnovations/cupidweblib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocation.html
executable file
·178 lines (153 loc) · 6.89 KB
/
location.html
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?php require_once('/var/www/auth/user.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><!-- InstanceBegin template="/Templates/main.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- Get me some jquery-->
<script src="/mobile/js/jquery-1.7.1.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jqplot/jquery.jqplot.min.js"></script>
<link rel="stylesheet" type="text/css" href="js/jqplot/jquery.jqplot.css" />
<script type="text/javascript" src="/mobile/js/jqplot/plugins/jqplot.canvasTextRenderer.min.js"></script>
<script type="text/javascript" src="/mobile/js/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>
<script type="text/javascript" src="/mobile/js/jqplot/plugins/jqplot.dateAxisRenderer.js"></script>
<script type="text/javascript" src="/mobile/js/jqplot/plugins/jqplot.cursor.min.js"></script>
<script src="/js/iijslib.js" type="text/javascript"></script>
<script src="/js/cupidjslib.js" type="text/javascript"></script>
<script type="text/javascript">
var sessiondata = {}
sessiondata.username = "<?php if (!empty($_SESSION['user']['name'])) { echo $_SESSION['user']['name'];} ?>";
sessiondata.sessionid = "<?php if (!empty($_SESSION['user']['sessionid'])) {echo $_SESSION['user']['sessionid'];} ?>";
sessiondata.appip = "<?php if (!empty($_SESSION['user']['appip'])) {echo $_SESSION['user']['appip'];} ?>";
sessiondata.realip = "<?php if (!empty($_SESSION['user']['realip'])) {echo $_SESSION['user']['realip'];} ?>";
sessiondata.authlevel = "<?php if (!empty($_SESSION['user']['authlevel'])) {echo $_SESSION['user']['authlevel'];} ?>";
// <!--Log access-->
logUserAuths(sessiondata)
</script>
<!-- InstanceBeginEditable name="doctitle" -->
<title>CuPID Location</title>
<!-- InstanceEndEditable -->
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<style media="all" type="text/css">
@import "css/all.css";
</style>
<!-- InstanceBeginEditable name="head" -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<style type="text/css">
input[type="text"]{width:75px;}
</style>
<!-- Here we define some dynamic table functions -->
<SCRIPT language="javascript">
var stdmessage='You do not have sufficient authorization for this action'
var actauthlevel=2
var usercoord=[]
var servercoord=[]
// This method does not work if you're on a LAN and not outward facing
//var serverip ="<?php echo $_SERVER['SERVER_ADDR']; ?>";
//preg_match('/Current IP Address: ([\[\]:.[0-9a-fA-F]+)</', $externalContent, $m);\
// $externalIp = $m[1];\
var serverip = "<?php $externalContent = file_get_contents('http://checkip.dyndns.com/'); preg_match('/Current IP Address: ([\[\]:.[0-9a-fA-F]+)</', $externalContent, $m); $externalIP = $m[1]; echo $externalIP; ?>"
alert(serverip)
// to test
//var serverip='8.8.8.8'
// this will get us our user's latitude and longitude
$.getJSON('http://freegeoip.net/json/' , function(location) {
usercoord[0]=location.latitude;
usercoord[1]=location.longitude;
$('#userlat').html(usercoord[0])
$('#userlng').html(usercoord[1])
});
$.getJSON('http://freegeoip.net/json/' + serverip, function(location) {
servercoord[0]=location.latitude
servercoord[1]=location.longitude
$('#cupidlat').html(servercoord[0])
$('#cupidlng').html(servercoord[1])
});
$(document).ready(function(){
var map;
// This is a hacky way of making sure we have the IP information before we draw the map.
setTimeout(function(){
makeUserServerMap([servercoord,usercoord],['CuPID','You'],['CuPID','You'])
$('#cupidip').html(serverip)
$('#userip').html(sessiondata.appip)
},1000)
});
</script>
<!-- InstanceEndEditable -->
</head>
<body>
<div id="main">
<!-- InstanceBeginEditable name="NavBar" -->
<div id="header"> <a href="http://www.interfaceinnovations.org" class="logo"><img src="/images/cmstemplate/logo.png"alt="" /></a>
<ul id="top-navigation">
<li><span><span><a href="index.html">Home</a></span></span></li>
<li><span><span><a href="controlpanel.html">Panel</a></span></span></li>
<li><span><span><a href="smallpanel.html">SmPanel</a></span></span></li>
<li><span><span><a href="inputs.html">Inputs</a></span></span></li>
<li><span><span><a href="datalogs.html">Datalogs</a></span></span></li>
<li class="active"><span><span>Settings</span></span></li>
<li><span><span><a href="admin.html">Admin</a></span></span></li>
<li><span><span><a href="help.html">Help</a></span></span></li>
</ul>
<div id="login"><?php
if($user->logged_in()):
?>
<p>You are logged in as <?php echo $_SESSION['user']['name']; ?>. <a href="auth/logout">Log out</a></p>
<?php
endif;
if(!$user->logged_in()):
?>
<p>You are not logged in. <a href="auth/login">Log in</a>
<?php
endif;
?>
</div><!-- login -->
</div>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="MainBody" -->
<div id="middle">
<div id="full-column">
<div class="top-bar">
<h1>Location</h1>
<div class="breadcrumbs">Where are we today?</div>
</div> <!-- End top bar -->
<br />
<div class="table fulltable" ><img src="images/cmstemplate/bg-th-left.gif" width="8" height="7" alt="" class="left" /> <img src="images/cmstemplate/bg-th-right.gif" width="7" height="7" alt="" class="right" />
<table class="listing fulllisting" cellpadding="0" cellspacing="0" id="inputsdatatable">
<tr>
<th class="first"> </th>
<th>CuPID</th>
<th class="last">You</th>
</tr>
<tr>
<td>IP</td>
<td id ="cupidip"> </td>
<td id ="userip"> </td>
</tr>
<tr>
<td>Latitude</td>
<td id ="cupidlat"> </td>
<td id ="userlat"> </td>
</tr>
<tr>
<td>Longitude</td>
<td id ="cupidlng"> </td>
<td id ="userlng"> </td>
</tr>
</table>
</div> <!-- full table -->
<div class="fullcontent">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<div id="map" style="width:90%; height:600px; padding-top: 20px; border:2px; border-color:#111"></td></div>
</td>
</tr>
</table>
</div> <!-- fullcontent -->
</div>
</div>
<!-- InstanceEndEditable -->
<div id="footer"></div>
</div>
</body>
<!-- InstanceEnd --></html>