-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisitor_out.php
More file actions
47 lines (38 loc) · 1.03 KB
/
visitor_out.php
File metadata and controls
47 lines (38 loc) · 1.03 KB
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
<?php
session_start();
if ($_SESSION["loggedIn"] == 0)
header("location: index.php");
$userOf = $_SESSION["user"];
?>
<?php
$name = $rid = $time = $date = $success = "";
$server = "localhost";
$uname = "root";
$pass = "";
$db = "db_vms";
$connect = mysqli_connect($server, $uname, $pass, $db);
if (!$connect)
die("Error" . mysqli_connect_error());
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (!empty($_POST["rid"]))
$rid = $_POST["rid"];
date_default_timezone_set("Africa/Nairobi");
$time = date("H:i:s");
$date = date("d/m/Y");
if (empty($rid))
echo "You have not entered the required fields Correctly !!";
else {
$query_s = "SELECT ReceiptID FROM info_visitor WHERE ReceiptID = '$rid'";
$query = "UPDATE info_visitor SET Status = 'OFFLINE' , TimeOUT = '$time', loggedOutBy = '$userOf' WHERE ReceiptID = '$rid' ";
if (mysqli_num_rows(mysqli_query($connect, $query_s)) > 0) {
mysqli_query($connect, $query);
$success = 1;
//echo $success;
// and refresh
} else {
$success = 0;
//echo $success;
}
}
}
?>