-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
155 lines (146 loc) · 5.77 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
<?php
include 'config_db.php';
//check whether logged or not
$log_status = isset($_COOKIE['loggedin']);
if($log_status) {
$userid = $_GET['uid'];
include 'config_db.php';
$query = mysql_query("SELECT * FROM guest WHERE guestID='$userid'");
while($row= mysql_fetch_array($query)){
$userName = $row['guestName'];
}
}else{
$userid = null;
$userName = '';
}
?>
<html>
<head>
<script src="javascripts/jquery-2.1.0.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/style.css" media="screen" type="text/css" />
<link rel="stylesheet" href="css/bootstrap/css/bootstrap.css" media="screen" type="text/css" />
</head>
<body onload="checkLogin(<?php echo $log_status?>)">
<div class="container-fluid">
<div class="navbar navbar-default navbar-fixed-top" style="background-color:rgba(0,0,0,0.2);"role="navigation">
<div class="container">
<div class="navbar-header">
<div class="navbar-collapse.collapse">
<ul class="nav navbar-nav nav-me-text" >
<li id="no_login" class="nav-me-text"><a href="login.php" style="color:white;"> LOGIN </a></li>
<li id="to_logout" class="nav-me-text"><a href="logout.php" style="color:white;"> LOGOUT </a></li>
<li id="yes_login" class="nav-me-text">
<a href="login_userdata.php?uid=<?php echo $userid; ?>" style="color:white;"><?php echo $userName; ?></a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="search">
<div class="search-by-name">
<div class="search-title-name">
<h2>Search By Name</h2>
</div>
<form method="POST" id="search-form-name" name="search-form-name" class="navbar-form navbar-left" role="search">
<input value=">>" onclick="searchByName(this.form.searchName.value,this.form.userid.value)" style="background-color:rgba(255,255,255,0.7); border:0px; height:50px;" type="button" class="btn btn-default"/>
<div class="form-group">
<input type="hidden" name="userid" value="<?php echo $userid; ?>"/>
<input type="text" class="form-control" name="searchName" placeholder="Search for members by NAME" style="width:300px;height:50px;border-radius:0;"/>
</div>
</form>
</div>
<div class="search-by-location">
<div class="search-title-location">
<h2>Search By Location</h2>
</div>
<form method="POST" id="search-form-location" name="search-form-location"class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="hidden" name="userid" value="<?php echo $userid; ?>"/>
<input type="text" class="form-control" name="searchLocation" placeholder="Search for members by LOCATION" style="width:300px;height:50px;border-radius:0;"/>
</div>
<input value="<<" onclick="searchByLocation(this.form.searchLocation.value,this.form.userid.value)" style="background-color:rgba(255,255,255,0.7); border:0px; height:50px;" type="button" class="btn btn-default"/>
</form>
</div>
</div>
</div>
<div class="declearation">
<h2>HEY!</h2>
<h4>This is only a <span>DEMO</span> bokking system, allowing users' <span>registeration | login | searching | booking | delete</span> operations.</h2>
<h4>Information are fake and just created for testing.</h3>
<h4>There are two hotelNames available in database: <span>Qinglv</span> and <span>Suba</span></h4>
<h4>And two hotelLocations available: <span>Waterloo</span> and <span>Kitchener</span></h4>
<h4><span>Tips:</span> unknown users are able to SEARCH but cannot execute BOOKING without a loggedin account</h4>
</div>
<div class="search-result" id="show-result">
<b>NO RESULT YET!</b>
</div>
<script type="text/javascript">
function checkLogin(iflog){
$("#to_logout").hide();
$("#yes_login").hide();
if(iflog){
$("#no_login").hide();
$("#to_logout").show();
$("#yes_login").show();
}
}
</script>
<script type="text/javascript">
function searchByName(hotelname,userid){
if (hotelname == "") {
document.getElementById("show-result").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("show-result").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","index_search_name.php?searchq="+hotelname+"&uid="+userid,true);
xmlhttp.send();
}
}
</script>
<script type="text/javascript">
function searchByLocation(hotelname,userid){
if (hotelname == "") {
document.getElementById("show-result").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("show-result").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","index_search_location.php?searchq="+hotelname+"&uid="+userid,true);
xmlhttp.send();
}
}
</script>
<style type="text/css">
.declearation {
font-family: "Myriad Set Pro";
}
.declearation span {
color: rgb(226, 81, 62);
font-size: 24px;
}
</style>
</body>
</html>