-
Notifications
You must be signed in to change notification settings - Fork 19
/
functionmis.php
72 lines (58 loc) · 1.83 KB
/
functionmis.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
<?php
/**
* Created by PhpStorm.
* User: vishal
* Date: 10/21/17
* Time: 4:16 PM
*/
include_once 'db.php';
if (isset($_POST['login'])) {
$username = $_POST['username'];
$password = $_POST['password'];
echo $username;
echo $password;
$query = "select * from login where username = '$username' and password='$password'";
$result = mysqli_query($connection, $query);
$userdetails = mysqli_fetch_assoc($result);
if($userdetails['username']=='manager')
{
header('Location: index.php?room_mang');
}
else{
header('Location: login.php');
}
}
if (isset($_POST['submit'])) {
$emp_id = $_POST['emp_id'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$staff_type_id = $_POST['staff_type_id'];
$shift_id= $_POST['shift_id'];
$id_card_type = $_POST['id_card_type'];
$id_card_no = $_POST['id_card_no'];
$address = $_POST['address'];
$contact_no = $_POST['contact_no'];
$joining_date = strtotime($_POST['joining_date']);
$salary = $_POST['salary'];
$query="UPDATE staff
SET emp_name='$first_name $last_name', staff_type_id='$staff_type_id', shift_id='$shift_id', id_card_type=$id_card_type,
id_card_no='$id_card_no',address='$address',contact_no='$contact_no',joining_date='$joining_date',salary='$salary'
WHERE emp_id=$emp_id ";
//echo $query;
if (mysqli_query($connection, $query)) {
header('Location: index.php?staff_mang');
} else {
echo "Error updating record: " . mysqli_error($conn);
}
}
if (isset($_GET['empid'])!="")
{
$emp_id=$_GET['empid'];
$deleteQuery = "DELETE FROM staff WHERE emp_id=$emp_id";
if (mysqli_query($connection, $deleteQuery)) {
header('Location: index.php?staff_mang');
} else {
echo "Error updating record: " . mysqli_error($connection);
}
}
?>