-
Notifications
You must be signed in to change notification settings - Fork 20
/
result.php
181 lines (156 loc) · 7.13 KB
/
result.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
session_start();
if($_SESSION['status']=='loggedin')
{
?>
<!DOCTYPE html>
<html>
<head>
<title>Letstravel</title>
<link rel="shortcut icon" href="images/favicon.png">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,500" rel="stylesheet">
<!--Bootstrap CSS-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="override.css">
<link rel="stylesheet" type="text/css" href="survey.css">
</head>
<body style="background-color: #000000;">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<a class="navbar-brand heading" href="home.php?status=loggedin"><b>Letstravel</b></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbarNavDropdown" class="navbar-collapse collapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="home.php?status=loggedin">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="home.php?status=loggedin#Upcoming">Upcoming Trips</a>
</li>
<li class="nav-item">
<a class="nav-link" href="www.google.com">FAQ</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item dropdown" id="in_nav">
<a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Hi, <?php
$servername = 'localhost';
$username = 'root';
$password = '';
$db='letstravel';
$conn = mysqli_connect($servername,$username,$password,$db);
if (!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$email=$_SESSION['user_email'];
$sql="SELECT FirstName FROM user WHERE Email='".$email."'";
$fname = mysqli_query($conn,$sql);
while ($row=$fname->fetch_assoc()) {
echo $row['FirstName'];
}
?>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<!-- <a class="dropdown-item" href="#">Edit Profile</a> -->
<a class="dropdown-item" href="logout.php" name="logout_link">Logout</a>
</div>
</li>
</ul>
</div>
</nav>
<div class="header">
You could go to one of these places!
</div>
<!--recommendation tab-->
<div class="tab">
<div class="tabContent">
<?php
$servername = 'localhost';
$username = 'root';
$password = '';
$db='letstravel';
$conn = mysqli_connect($servername,$username,$password,$db);
if (!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
if(isset($_POST['GetResult']))
{
//category, budget, group, age_group
if(!empty($_POST['category']) || !empty($_POST['group']))
{
$inner = "";
$outer = "";
if(!empty($_POST['category']))
{
$inner = "'".$_POST['category'][0]."'";
for ($i=1; $i<sizeof($_POST['category']) ; $i++)
{
$inner = $inner.",'".$_POST['category'][$i]."'";
}
}
if(!empty($_POST['group']))
{
$outer = "'".$_POST['group'][0]."'";
for ($i=1; $i<sizeof($_POST['group']) ; $i++)
{
$outer = $outer.",'".$_POST['group'][$i]."'";
}
}
if($inner == "")
$sql = 'SELECT distinct Location, Link from recom_locs WHERE TripGroup IN ('.$outer.')';
else if($outer == "")
$sql = 'SELECT distinct Location, Link from recom_locs WHERE Category IN ('.$inner.')';
else
$sql = 'SELECT distinct Location, Link from recom_locs WHERE TripGroup IN ('.$outer.') AND Category IN ('.$inner.')';
//echo $sql;
$result = mysqli_query($conn,$sql);
$rows = mysqli_num_rows($result);
for($i=0;$i<$rows;$i++)
{
$loc = mysqli_fetch_assoc($result);
echo '<div class="result">
<img src ="images/recommendation/'.$loc['Location'].'.jpg">
<div class="info">
<h3>'.$loc['Location'].'</h3>
<a href="'.$loc['Link'].'">Know More...</a>
</div>
</div>';
}
if($rows==0)
{
echo
'<div class="result" style="margin-left: 20%;">
<img src="images/error.png" style="width: 20%;">
<div class="info">
<p style="color: #fafafa;">We are sorry! We could not find any location to match your requirements. Click <a href="home.php?status=loggedin">here</a> to browse other trips planned by Letstravel.</p>
</div>
</div>';
}
}
}
?>
</div>
</div>
<!--tab ends-->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="js/animations.js"></script>
</body>
</html>
<?php
}
else
{
header("location:userlogin.html");
}
mysqli_close($conn);
?>