-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdate_process.php
92 lines (85 loc) · 2.11 KB
/
update_process.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
<?php
$conn=mysqli_connect('localhost','pjuser','12345678','awscop');
settype($_GET['id'], 'integer');
$basic=$_POST['basic'];
$extra=$_POST['extra'];
if ($basic <= 2000000){
$tax=0.01;
}
elseif ($basic <= 4000000) {
$tax=0.02;
}
else {
$tax=0.03;
}
$salary=($basic+$extra)*(1-$tax);
$filtered=array(
'id' => mysqli_real_escape_string($conn, $_GET['id']),
'name' => mysqli_real_escape_string($conn, $_POST['name']),
'position' => mysqli_real_escape_string($conn, $_POST['position']),
);
$sql="
UPDATE employee_salary
SET name='{$filtered['name']}',position='{$filtered['position']}',base_pay=$basic,extra_pay=$extra,tax_rate=$tax,salary=$salary
WHERE id='{$filtered['id']}';
"
;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AWSCOP</title>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.png">
<link rel="stylesheet" href="css/style.css" type="text/css">
</head>
<body>
<div id="page">
<div id="header">
<div id="logo">
<a href="index.php"><img src="images/logo.png" alt="LOGO"></a>
</div><!--logo-->
<ul id="navigation">
<li><a href="create.php">Resistration</a></li>
<li><a href="print.php">View/Modify</a></li>
</ul><!--navigation-->
</div><!--header-->
<div id="contents">
<?php
$result=mysqli_query($conn, $sql);
if($result === false) {
echo 'There was an error in editing the article. Please contact your administrator.';
echo error_log(mysqli_error($conn));
} else {
header('Location: print.php');
}
?>
</div><!--contents-->
<div id="footer">
<div id="links">
<li>
<h4>When Something Wrong</h4>
<ul>
<li>TEL : 0212345678</li>
<li>E-MAIL : [email protected]</li>
</ul>
</li>
<li>
<h4>Social Links</h4>
<ul id="connect">
<li>
<a href="https://twitter.com/" target="_blank">Twitter</a>
</li>
<li>
<a href="https://www.facebook.com/" target="_blank">Facebook</a>
</li>
</ul><!--connect-->
</li>
</div><!--links-->
<p class="footnote">
© 2020. Hong Su Min all rights reserved.
</p>
</div><!--footer-->
</div><!--page-->
</body>
</html>