-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.php
258 lines (236 loc) · 13.9 KB
/
home.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
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
<?php
session_start();
if(!isset($_SESSION['username']) ) {
header("Location: login.php");
exit;
}
include 'dbconnect.php';
$username = $_SESSION['username'];
if(!$dbcon){
die('Error Connecting to database');
}
$profiledata = mysqli_query($dbcon,"SELECT users.Name,users.Username,users.Email,users.Bio,users.Website,pictures.Profile,pictures.Cover FROM `users`, `pictures` WHERE users.Username='$username' AND pictures.Username = '$username'");
$data = mysqli_fetch_array($profiledata);
$name = $data['Name'];
$bio = $data['Bio'];
$web = $data['Website'];
$profilepic = $data['Profile'];
if(isset($_POST['update'])){
$posted = mysqli_real_escape_string($dbcon, $_POST['posted']);
$insert="INSERT INTO posts (Username,Name,Post,Time) values('$username','$name','$posted','".date('U')."')";
$result=$dbcon->query($insert);
header('Location: home.php');
}
$all = "SELECT DISTINCT users.Name,users.Username,(SELECT pictures.Profile from pictures where users.Username = pictures.Username) as Profile FROM users,followers ORDER BY RAND() LIMIT 5";
$allusers=$dbcon->query($all);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="theme-color" content="#243447">
<title>Home</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/bot.css">
<link rel="stylesheet" href="css/styles.css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="icon" href="favicon.ico" type="image/x-icon">
</head>
<body>
<nav class="navbar navbar-expand-md fixed-top bg-custom-2 navbar-dark">
<!-- Brand -->
<div class="container">
<a class="navbar-brand" href="home.php">The Hub</a>
<!-- Toggler/collapsibe Button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar" style="outline:none">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Navbar links -->
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item">
<form action="search.php?" method="get" name="searchForm">
<div class="input-group">
<input type="text" name="query" id="" class="form-control search-1" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-custom search-2" id="" name="search">
<i class="fas fa-search"></i>
</button>
</span>
</div>
</form>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="home.php">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Interests</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="interests.php">Add Interests</a>
<a class="dropdown-item" href="findusers.php">Find Users</a>
<a class="dropdown-item" href="discover.php">Discover</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<?php
echo $name;
?>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="profile.php?user=<?php echo $username; ?>">Profile</a>
<a class="dropdown-item" href="settings.php">Settings</a>
<a class="dropdown-item" href="signout.php">Sign Out</a>
</div>
</li>
</ul>
</div>
</div>
</nav>
<section id="home">
<article class="container">
<div class="row ">
<div class="col-md-4 d-md-none d-block text-left">
<div class="container">
<div class="row shadow" id="mb-view">
<div>
<a href="profile.php?user=<?php echo $username; ?>">
<img src=<?php if($profilepic!='' ) { echo "'$profilepic'"; } else{ echo "'img/profile_pic/default.png'"; } ?> class="rounded small-pic">
</a>
</div>
<div class="text-left mars-lft-5">
<h5 class="mars-lft-5" style="margin-bottom:0; margin-top:5px">
<?php echo $name; ?>
</h5>
<h6 class="mars-lft-5">@
<?php echo $username; ?>
</h6>
<?php
if(isset($web)){
echo '<p><a class=" mars-lft-5" href="'.$web.'" target="_blank">'.$web.'</a></p>';
}
?>
</div>
</div>
<?php if($bio!=""){
echo '<div class="row shadow" id="mb-view-2">
<p>'.$bio.'</p>
</div>';
} ?>
</div>
</div>
<div class="col-md-4 d-none d-md-block mars-btm-20 text-center">
<div id="exp" class="wow animated fadeIn">
<a href=<?php echo "profile.php?user=$username" ?>>
<img src=<?php if($profilepic!='' ) { echo "'$profilepic'"; } else{ echo "'img/profile_pic/default.png'"; } ?> class="img-responsive home-pic">
<h3 class="mars-top-10" style="margin-bottom:0px;"><?php echo $name; ?></h3>
<h6>@<?php echo $username; ?></h6>
<p style="margin-bottom:5px; padding:10px;" class="container"><?php if(isset($bio)){echo $bio;} ?></p>
<?php
if(isset($web)){
echo '<p><a href="'.$web.'" target="_blank">'.$web.'</a></p>'; } ?>
</a>
</div>
<div class="row wow animated fadeIn" style="margin-top:30px; ">
<div class="col-7">
<h5 class="text-left">Other Users</h5>
</div>
<div class="col-5 linked text-right">
<a href="users.php" style="color:blue">See All</a>
</div>
</div>
<div id="other-user" class="container wow animated slideInUp">
<?php
while($row=$allusers->fetch_assoc()){
$url = $row['Profile'];
if($url!=''){
$url = $row['Profile'];
}
else{
$url = "img/profile_pic/default.png";
}
echo
'<a href="profile.php?user='.$row["Username"].'"><div class="row text-left mars-btm-20" id="other-lines">
<div class="col-3">
<img src="'.$url.'" class="rounded" alt="">
</div>
<div class="col-9">
<h6 style="margin-bottom:0px; font-size:1.1em;">'.$row["Name"].'</h6>
<p>@'.$row["Username"].'</p>
</div>
</div></a>';
}
?>
</div>
</div>
<div class="col-md-8 col-sm-12 mars-btm-20 text-md-left text-center text-lg-center wow animated fadeIn">
<form action="home.php" method="post" name="postForm">
<textarea id="home-textarea" class="form-control" type="text" placeholder="Share your thoughts" name="posted" style="resize:none; height:120px; box-shadow: -1px 1px 10px 0.1px rgba(0, 0, 0, 0.35);" required></textarea>
<button type="submit" name="update" class="btn btn-block btn-primary mars-top-10" style="box-shadow: -1px 1px 10px 0.1px rgba(0, 0, 0, 0.35);">POST</button>
</form>
<div class="mars-top-10 container" id="filter">
</div>
<div id="posts" class="mars-top-10"></div>
</div>
</div>
<div id="chat-open">
<div class="col-12" id="main-box">
<header class="header">
<h5 class="text-left">Hub Bot (AI Chatbot)</h5>
<h6 id="status"><span><i class="fas fa-circle" style="color:grey"></i></span> Checking...</h6>
<span class="closer">
<span class="voice-box" title="Listen to the HubBot"><input type="checkbox" onclick="voice();" id="voice" name="voice">
<label for="voice" class="label-color-voice">
<i class="fas fa-volume-up"></i>
</label>
</span>
</span>
</header>
<div id="chat-container">
<ul id="conversation">
<li class="responder">Hi! I'm the HubBot. I can help you with your queries. Please select a quick link below or type your question
in the space provided.<br>
<div>
<button class="btn btn-outline-primary btn-sm m-t-10" onclick="start('Hello')">Hello</button>
<button class="btn btn-outline-primary btn-sm m-t-10" onclick="start('Ticket Status')">Ticket Status</button>
<button class="btn btn-outline-primary btn-sm m-t-10" onclick="start('Order Details')">Order Details</button>
<button class="btn btn-outline-primary btn-sm m-t-10" onclick="start('Customer Details')">Customer Details</button>
</div>
</li>
</ul>
<div id="bottom"></div>
</div>
<div id="typing" class="text-muted">
<img src="img/typing.gif" width="50px">
</div>
<section class="row" id="input">
<div class="col-9 col-md-10" style="padding-right: 0">
<input type="text" id="chat-input" placeholder="Enter your message" class="form-control text-box1" style="padding-right:30px">
<span id="mic"><i class="fas fa-microphone" onclick="listen()"></i></span>
</div>
<div class="col-3 col-md-2" style="padding-left: 5px">
<button id="btn" class="btn btn-primary btn-block" onclick="send()"><i class="fas fa-paper-plane"></i></button>
</div>
</section>
</div>
<div id="fab" class="shadow" onclick="openchat()"><i class="fas fa-1x fa-envelope"></i></div>
<div id="fab-close" class="shadow" onclick="closechat()"><i class="fas fa-1x fa-envelope-open"></i></div>
</div>
</article>
</section>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js"></script>
<script defer src="https://use.fontawesome.com/releases/v5.0.4/js/all.js"></script>
<script src="js/wow.js"></script>
<script>
new WOW().init();
</script>
<script src="js/bot.js"></script>
<script src="js/posts.js"></script>
</body>
</html>