-
Notifications
You must be signed in to change notification settings - Fork 1
/
modSuccess.php
107 lines (76 loc) · 2.11 KB
/
modSuccess.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
ob_start();
session_start();
require("database.php"); //db connector
if ($_SESSION['manager'] ==1){
//check for manager bit
/* the employee table and its types
+--------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+---------------+------+-----+---------+-------+
| eID | int(100) | YES | | NULL | |
| seniority | varchar(255) | YES | | NULL | |
| commission | int(3) | YES | | NULL | |
| startdate | date | YES | | NULL | |
| enddate | date | YES | | NULL | |
| weeklySalary | decimal(10,0) | YES | | NULL | |
| password | char(33) | YES | | NULL | |
+--------------+---------------+------+-----+---------+-------+
7 rows in set (0.00 sec)
*/
$eid = $_GET['eid'];
//variables
$name = $_GET['name'] ;
$seniority =$_GET['seniority'] ;
$commission=$_GET['commission'];
$startdate=$_GET['startdate'] ;
$enddate= $_GET['enddate'] ;
$weekly= $_GET['weekly'];
$password = $_GET['password'];
//begin html form
echo "<html>
<head>
<title>
Modify Employee $eid
</title>
</head>
<body>
";
//if someone submitted everything filled in
if ( isset($_GET['name']) &&
isset($_GET['seniority']) &&
isset($_GET['commission']) &&
isset($_GET['startdate']) &&
isset($_GET['enddate']) &&
isset($_GET['weekly']) &&
isset($_GET['password']) )
{
if ( !is_numeric($_GET['commission']) || !is_numeric($_GET['weekly'])) {
echo "Data was not entered correctly.<br/>";
}
else {
$query = "update employee
set name = '$name',
seniority='$seniority',
commission=$commission,
startdate = '$startdate',
enddate = '$enddate',
weeklysalary = $weekly,
password = '$password'
where eid = $eid";
echo "User is being added to database. <br/>";
echo $query;
//insert user
$result = mysql_query($query);
if( !$result)
echo "User not added";
else
require("showEmployees.php");
}
}
echo "</body></html>";
}
else
echo "Please log in as Manager.";
ob_end_flush();
?>