-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
206 lines (191 loc) · 6.76 KB
/
index.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<!DOCTYPE html>
<html>
<head>
<title>Impact Game</title>
<style type="text/css">
html,body {
background-color: #000;
color: #fff;
font-family: helvetica, arial, sans-serif;
margin: 0;
padding: 0;
font-size: 12pt;
}
#canvas {
position: absolute;
margin: auto;
border: 5px solid #555;
}
#canvasWrapper{
position:absolute;
left: 80px;
top: 80px;
}
#signUp_logIn{
position: absolute;
z-Index: 100;
}
#sign_up{
position: absolute;
z-Index: 100;
left: 15px;
top: 315px;
background-image:url('media/signIn_bg.png');
padding-left:10px;
padding-right:10px;
padding-bottom:10px;
border-style:solid;
border-width:1px;
}
#log_in{
position: absolute;
z-Index: 100;
left: 605px;
top: 315px;
background-image:url('media/logIn_bg.png');
padding-left:10px;
padding-right:10px;
padding-bottom:10px;
border-style:solid;
border-width:1px;
}
</style>
<script type="text/javascript">
function SignUp(email, password) {
if(email == "" || password == "")
document.getElementById("welcome").innerHTML = "Please complete the form";
else{
var user_table = "users";
var weapons_table = "weapons";
var password_col = "password";
var email_col = "email";
var queryString = "?user_table=" + user_table + "&weapons_table=" + weapons_table +"&password=" + password + "&email=" + email + "&password_col=" + password_col + "&email_col=" + email_col;
var text_out;
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
ajaxRequest.onreadystatechange = function()
{
if(ajaxRequest.readyState == 4)
{
text_out = ajaxRequest.responseText;
if(text_out == "success"){
document.getElementById("signUp_logIn").innerHTML = "";
document.getElementById("welcome").innerHTML = "Welcome";
document.getElementById("user").innerHTML = email;
document.getElementById("signUp").innerHTML = "true";
}
else
document.getElementById("welcome").innerHTML = text_out;
}
}
ajaxRequest.open("POST", "/Senior-Project/lib/game/database/sign_upAction.php" + queryString, true);
ajaxRequest.send(null);
}
}
function LogIn(email, password) {
var text_out;
if(email == "" || password == "")
document.getElementById("welcome").innerHTML = "Please complete the form";
else{
var dataSections;
var users_table = "users";
var weapons_table = "weapons";
var chests_table = "chests";
var keys_table = "game_keys";
var doors_table = "doors";
var password_col = "password";
var email_col = "email";
var queryString = "?users_table=" + users_table + "&weapons_table=" + weapons_table + "&chests_table=" + chests_table + "&keys_table=" + keys_table + "&doors_table=" + doors_table + "&password=" + password + "&email=" + email + "&password_col=" + password_col + "&email_col=" + email_col;
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
ajaxRequest.onreadystatechange = function()
{
if(ajaxRequest.readyState == 4)
{
text_out = ajaxRequest.responseText;
if(text_out != "Invalid Password"){
dataSections = text_out.split(",");
document.getElementById("userData").innerHTML = dataSections[0];
document.getElementById("keys").innerHTML = dataSections[1];
document.getElementById("chests").innerHTML = dataSections[2];
document.getElementById("doors").innerHTML = dataSections[3];
document.getElementById("signUp_logIn").innerHTML = "";
document.getElementById("welcome").innerHTML = "Welcome";
document.getElementById("user").innerHTML = email;
}
else{
document.getElementById("welcome").innerHTML = text_out;
}
}
}
ajaxRequest.open("POST", "/Senior-Project/lib/game/database/loadAction.php" + queryString, true);
ajaxRequest.send(null);
}
}
</script>
<script type="text/javascript" src="lib/impact/impact.js"></script>
<script type="text/javascript" src="lib/game/main.js"></script>
</head>
<body>
<div id="canvasWrapper">
<canvas id="canvas"></canvas>
<div id="signUp_logIn">
<div style="" id="sign_up">
<h3 style="text-align:center; border-bottom-style:solid; border-width:1px">Sign Up</h3>
Email:<input id="email_signUp" type="text" name="email" /><br/><br/>
Password:<input id="password_signUp" type="password" name="password" /><br/>
<input type="button" value="Sign Up" onclick="SignUp(document.getElementById('email_signUp').value, document.getElementById('password_signUp').value)" />
</div>
<div style="" id="log_in">
<h3 style="text-align:center; border-bottom-style:solid; border-width:1px">Log In</h3>
Email:<input id="email_logIn" type="text" name="email" /><br/><br/>
Password:<input id="password_logIn" type="password" name="password" /><br/>
<input type="button" value="Log In" onclick="LogIn(document.getElementById('email_logIn').value, document.getElementById('password_logIn').value)"/>
</div>
</div>
</div>
<h4>
<div id="welcome">
</div><div id="user">
</div>
</h4>
<!-- in-game variables -->
<span id="signUp" hidden="hidden"></span>
<span id="userData" hidden="hidden"></span>
<span id="chests" hidden="hidden"></span>
<span id="keys" hidden="hidden"></span>
<span id="doors" hidden="hidden"></span>
</body>
</html>