-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
454 lines (391 loc) · 13.4 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<html>
<head>
<title>Make My Journey</title>
<link rel="stylesheet" href="cssFile.css">
</head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#25274d">
<meta name="description" content="A Train seat reservation system ">
<meta name="author" content="James Muriitih">
<meta name="keywords" content="bus,bus seats,">
<meta property="og:site_name" content="google.com">
<meta property="og:title" content="Bus Seat Reservation System" />
<meta property="og:description" content="A Train seat reservation system" />
<meta property="og:image:url" itemprop="image" content="A bus seat reservation system made by James">
<meta property="og:image" content="https://james-muriithi.github.io/bus/images/logo-400.png" />
<meta property="og:image:url" content="https://james-muriithi.github.io/bus/images/logo-400.png" />
<meta property="og:image:secure_url" content="https://james-muriithi.github.io/bus/images/logo-400.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="400" />
<meta property="og:image:height" content="400" />
<meta property="og:locale" content="en_GB" />
<meta property="og:type" content="website" />
<meta name="application-name" content="My Bus" />
<meta name="apple-mobile-web-app-title" content="My Bus" />
<meta name="msapplication-TileColor" content="#2b5797" />
<!-- //for-mobile-apps -->
<title>Make My Journey</title>
<!-- icons -->
<link rel="icon" type="image/png" href="images/logo-96.png" sizes="96x96" />
<link rel="icon" type="image/png" href="images/logo-16.png" sizes="16x16" />
<link rel="icon" type="image/png" href="images/logo-32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="images/logo-64.png" sizes="64x64" />
<link rel="icon" type="image/png" href="images/logo-128.png" sizes="128x128" />
<link rel="apple-touch-icon" sizes="120x120" href="images/apple-touch-icon.png" />
<link rel="mask-icon" href="images/safari-pinned-tab.svg" color="#5bbad5" />
<link rel="manifest" href="site.webmanifest">
<!-- end of icons -->
<!-- css -->
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrapValidator.css">
<link rel="stylesheet" type="text/css" href="css/nice-select.css">
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/jquery.seat-charts.css">
<link rel="stylesheet" type="text/css" href="fonts/font-awesome/css/font-awesome.min.css">
<link href="fonts/material-design-icons/material-icon.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="plugins/material-datetimepicker/bootstrap-material-datetimepicker.css" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/animate.css">
<link rel="stylesheet" type="text/css" href="css/material.min.css">
<link rel="stylesheet" type="text/css" href="plugins/lobibox/css/lobibox.min.css">
<link rel="stylesheet" type="text/css" href="css/simplelightbox.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<body>
<nav class="navbar navbar-expand-lg navbar-dark static-top">
<div class="container">
<a class="navbar-brand" href="index.html">
<h1>
<img src="images/p1.png" alt="logo" width="120" height="55" style="margin-top: -10px">
<span>J</span>
<span>O</span>
<span>U</span>
<span>R</span>
<span>N</span>
<span>E</span>
<span>Y</span>
</h1>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<!-- <li class="nav-item active">
<a class="nav-link" href="#">Reprint
<span class="sr-only">(current)</span>
</a>
</li> -->
<li class="nav-item">
<a href="index.html"><button class="btn btn-outline-warning my-2 my-sm-0 ml-3" type="submit">Login</button></a>
</li>
<li class="nav-item">
<a href="index.html"> <button class="btn btn-outline-warning my-2 my-sm-0 ml-2" type="submit">Sign Up</button></a>
</li>
<!-- <li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li> -->
</ul>
</div>
</div>
</nav>
<main class="col-md-12">
<div class="col-md-11 col-ls-9 mx-auto window">
<section class="stepper">
<ul style="display:initial;justify-content: center" id="progressbar">
<a href="firstpage.html"> <li>Passenger Details</li> </a>
<a href="Hotel/index.html" target="_blank"> <li> Reserve Hotel </li> </a>
<a href="food.html" target="_blank"> <li> Order Food </li> </a>
<a href="Cab/index.html" target="_blank" > <li> Book Cab</li> </a>
<a href="fetch.html"> <li> Ticket </li> </a>
</ul>
</section>
<br><br><br>
<div id="login-box">
<div class="left">
<h3 > Sign up </h3>
<input type="text" id="username" name="username" placeholder="Username" />
<input type="text" id="email" name="email" placeholder="E-mail" />
<input type="password" id="password" name="password" placeholder="Password" />
<input type="submit" id='sighUp' name="signup_submit" value="Signup" />
</div>
<div class="right">
<h3 id='status'>Login</h3>
<input type="text" id="email" name="email" placeholder="E-mail" />
<input type="password" id="password1" name="password" placeholder="Password" />
<input type="submit" id='login' name="login" value="Login" />
<input type="submit" id='logout' name="logout" value="Logout" />
</div>
<div class="or">OR</div>
</div>
</div>
</main>
</body>
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.4.0/firebase-app.js";
import { getDatabase, set, ref, update } from "https://www.gstatic.com/firebasejs/9.4.0/firebase-database.js";
import { getAuth, createUserWithEmailAndPassword, signInWithEmailAndPassword, onAuthStateChanged, signOut } from "https://www.gstatic.com/firebasejs/9.4.0/firebase-auth.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
import { getFirestore, getDocs, collection } from "https://www.gstatic.com/firebasejs/9.6.10/firebase-firestore.js";
const firebaseConfig = {
apiKey: "AIzaSyA8BtYSRJ-nzEKEUZXbnwYrycE5RDO-weM",
authDomain: "staffaccess-30df8.firebaseapp.com",
projectId: "staffaccess-30df8",
storageBucket: "staffaccess-30df8.appspot.com",
messagingSenderId: "726139754345",
appId: "1:726139754345:web:71dce6ca836960498d0ff8"
};
var passwordval;
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const database = getDatabase(app);
var auth = getAuth(app);
sighUp.addEventListener('click',(e) => {
var email = document.getElementById('email').value;
var password = document.getElementById('password').value;
passwordval=password.toString();
// console.log(password);+
var username = document.getElementById('username').value;
createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
console.log(user);
set(ref(database, 'users/' + user.uid),{
username: username,
email: email
})
alert('User created!');
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
alert(errorMessage);
// ..
});
});
var auth = getAuth(app);
login.addEventListener('click',(e)=>{
var email = document.getElementById('email').value;
var password1 = document.getElementById('password1').value;
password1=password1.toString();
console.log(passwordval);
console.log(password1);
if (passwordval == password1){
signInWithEmailAndPassword(auth, email, password1)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
const dt = new Date();
console.log(user);
update(ref(database, 'users/' + user.uid),{
last_login: dt,
})
alert('User loged in!');
location.href ="firstpage.html";
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
alert(errorMessage);
});
}
else
{
alert("Enter valid password ")
}
} );
const user = auth.currentUser;
onAuthStateChanged(auth, (user) => {
if (user) {
// User is signed in, see docs for a list of available properties
// https://firebase.google.com/docs/reference/js/firebase.User
const uid = user.uid;
//bla bla bla
// ...
} else {
// User is signed out
// ...
//bla bla bla
}
});
logout.addEventListener('click',(e)=>{
signOut(auth).then(() => {
// Sign-out successful.
alert('user loged out');
}).catch((error) => {
// An error happened.
const errorCode = error.code;
const errorMessage = error.message;
alert(errorMessage);
});
});
</script>
<style>
body {
font: normal 75% Arial, Helvetica, sans-serif;
overflow: auto;
width: 100%;
/* background-color: #0c0032;
background-image: url('banner.jpg');
background-position: 50% 50%;
background-repeat: no-repeat;
background-attachment: fixed;
background-origin: padding-box;
background-clip: border-box;
background-size: cover;*/
}
/*@import url(https://fonts.googleapis.com/css?family=Roboto:400,300,500);*/
*:focus {
outline: none;
}
/*body {
margin: 0;
padding: 0;
background: #DDD;
font-size: 16px;
color: #222;
font-family: 'Roboto', sans-serif;
font-weight: 300;
}
*/
#login-box {
position: relative;
margin: 5% auto;
width: 600px;
height: 400px;
background: #FFF;
border-radius: 2px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.left {
position: absolute;
top: 0;
left: 0;
box-sizing: border-box;
padding: 40px;
width: 300px;
height: 400px;
}
/*
h1 {
margin: 0 0 20px 0;
font-weight: 300;
font-size: 28px;
}
*/
input[type="text"],
input[type="password"] {
display: block;
box-sizing: border-box;
margin-bottom: 20px;
padding: 4px;
width: 220px;
height: 32px;
border: none;
border-bottom: 1px solid #AAA;
font-family: 'Roboto', sans-serif;
font-weight: 400;
font-size: 15px;
transition: 0.2s ease;
}
input[type="text"]:focus,
input[type="password"]:focus {
border-bottom: 2px solid #16a085;
color: #16a085;
transition: 0.2s ease;
}
input[type="submit"] {
margin-top: 28px;
width: 120px;
height: 32px;
background: #16a085;
border: none;
border-radius: 2px;
color: #FFF;
font-family: 'Roboto', sans-serif;
font-weight: 500;
text-transform: uppercase;
transition: 0.1s ease;
cursor: pointer;
}
input[type="submit"]:hover,
input[type="submit"]:focus {
opacity: 0.8;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
transition: 0.1s ease;
}
input[type="submit"]:active {
opacity: 1;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
transition: 0.1s ease;
}
.or {
position: absolute;
top: 180px;
left: 280px;
width: 40px;
height: 40px;
background: #DDD;
border-radius: 50%;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
line-height: 40px;
text-align: center;
}
.right {
position: absolute;
top: 0;
right: 0;
box-sizing: border-box;
padding: 40px;
width: 300px;
height: 400px;
background: url('https://goo.gl/YbktSj');
background-size: cover;
background-position: center;
border-radius: 0 2px 2px 0;
}
.right .loginwith {
display: block;
margin-bottom: 40px;
font-size: 28px;
color: #FFF;
text-align: center;
}
button.social-signin {
margin-bottom: 20px;
width: 220px;
height: 36px;
border: none;
border-radius: 2px;
color: #FFF;
font-family: 'Roboto', sans-serif;
font-weight: 500;
transition: 0.2s ease;
cursor: pointer;
}
button.social-signin:hover,
button.social-signin:focus {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
transition: 0.2s ease;
}
button.social-signin:active {
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
transition: 0.2s ease;
}
button.social-signin.facebook {
background: #32508E;
}
button.social-signin.twitter {
background: #55ACEE;
}
button.social-signin.google {
background: #DD4B39;
}
</style>
</html>