-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemp_update_exit_code.php
More file actions
35 lines (30 loc) · 944 Bytes
/
emp_update_exit_code.php
File metadata and controls
35 lines (30 loc) · 944 Bytes
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
<?php
session_start();
$logged_in_id = $_SESSION['login_id'];
//check if value exists
if(!empty($logged_in_id)){
//create connection
$conn = new mysqli("localhost", "root", "", "museumsys");
if(mysqli_connect_error()){
die('Connect Error('.mysqli_connect_errno().')'.mysqli_connect_error());
}
else{
//getting system date and time
date_default_timezone_set('Asia/Kolkata');
$date = date('Y-m-d H:i:s');
//query for updating date and time
$UPDATE = "UPDATE staff SET exit_time = ? WHERE staffid = ? LIMIT 1";
$stmt = $conn->prepare($UPDATE);
$stmt->bind_param("ss", $date, $logged_in_id);
$stmt->execute();
$_SESSION['msg'] = "<script>window.alert('Exit Date and Time Updated successfully')</script>";
header('location: employee_menu.php');
}
$stmt->close();
$conn->close();
}
else{
$_SESSION['msg'] = "<script>window.alert('Login ID not present')</script>";
header('location: employee_menu.php');
}
?>