forked from CS6083-DB-Project/LiveVibe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search_user.php
39 lines (33 loc) · 1.07 KB
/
search_user.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
<!-- Project: LiveVibe
Author: Xun Gong, Wei Yu
Date: Dec 4th, 2014 -->
<!-- PHP and manipulate with livevibe database -->
<?php
// Session start in connectdb.php file
require ("connectdb.php");
if (isset($_SESSION["username"]) && !empty($_POST["user"])) {
$get_user = $_POST["user"];
// Exactly username, case-sensitive
$stmtFU = $mysqli->prepare("SELECT username FROM users WHERE username = ?");
$stmtFU->bind_param("s", $get_user);
$stmtFU->execute();
$stmtFU->store_result();
if ($stmtFU->num_rows != 0) {
// Successfully Found and Redirecting
$user_page = "http://localhost:8888/livevibe/user_public.php?link=".$get_user;
$mysqli->next_result();
redirect($user_page);
exit();
}
else {
echo "<script>alert(\"Username Not Found!\")</script>";
redirect("http://localhost:8888/livevibe/search.php");
exit();
}
}
else {
echo "<script>alert(\"Empty Input!\")</script>";
redirect("http://localhost:8888/livevibe/search.php");
exit();
}
?>