-
Notifications
You must be signed in to change notification settings - Fork 2
/
edit_user.php
executable file
·139 lines (122 loc) · 3.58 KB
/
edit_user.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
$main_page="Edit User";
include_once("dbconnect.php");
session_start();
?>
<!DOCTYPE html>
<html><!-- InstanceBegin template="/Templates/template.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<?php
if($current_user==FALSE)
{
header("location: index.php");
}
?>
<title>Nancin Christ Standard School
<?php
if(isset($main_page))
{
echo" : $main_page";
}
if(isset($sub_page))
{
echo" : ($sub_page)";
}
?>
</title>
<!-- InstanceEndEditable -->
<link href="styles.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
<body>
<div id="header">
<h1>Payroll</h1>
</div>
<div id="content">
<?php
if($main_page!="Login" && isset($_SESSION['current_user']))
{
?>
<p align="right" style="border-bottom:solid 1px #ccc;"><b>User:</b> <?php echo $_SESSION['current_user'];?></p>
<?php
}
?>
<h1 align="center"> <?php echo $main_page; ?> </h1>
<?php
if(isset($_SESSION['message']))
{
?>
<p class="<?php echo $_SESSION['messagetype']; ?>"><?php echo $_SESSION['message']; ?></p>
<?php
unset($_SESSION['message'],$_SESSION['messagetype']);
}
?>
<!-- InstanceBeginEditable name="mycontent" -->
<p align="center"><a href="home.php">Home </a>| <a href="manage_users.php">Back To Users</a></p>
<?php
$id=isset($_GET['id']) ? ($_GET['id']) : "";
$select_rec=mysql_query("select * from users where (id='$id')");
if($select_rec==FALSE)
{
die("Error encounterd Editing id!!!" .mysql_error());
}
$total_rec=mysql_num_rows($select_rec);
if($total_rec>0)
{
mysql_data_seek($select_rec,0);
$rowp=mysql_fetch_assoc($select_rec);
$username=isset($_POST['username']) ? $_POST['username'] : $rowp['username'];
$password=isset($_POST['password']) ? $_POST['password'] : $rowp['password'];
$name=isset($_POST['name']) ? $_POST['name'] : $rowp['name'];
}
?>
<form action="edit_user_process.php" method="post" id="myform">
<table align="center" cellpadding="10" cellspacing="1">
<tr bgcolor="#efefef">
<td>Username</td>
<td><input name="username" type="text" id="username" value="<?php echo $username ?>" /></td>
</tr>
<tr bgcolor="#cdcdcd">
<td>Password</td>
<td><input name="password" type="password" id="password" value="<?php echo $password ?>" /></td>
</tr>
<tr bgcolor="#efefef">
<td>Name</td>
<td><input name="name" type="text" id="name" value="<?php echo $name ?>" /></td>
</tr>
<tr bgcolor="#cdcdcd">
<td colspan="2" align="center"><input type="button" value="Edit User" onclick="add_bttn()" /></td>
</tr>
</table>
</form>
<script type="text/javascript">
document.getElementById("username").focus()
function add_bttn()
{
if(document.getElementById("username").value=="")
{
alert("Please put in your Username");
document.getElementById("username").focus()
return null;
}
if(document.getElementById("password").value=="")
{
alert("Please put in your password");
document.getElementById("password").focus()
return null;
}
if(document.getElementById("name").value=="")
{
alert("Please put in your Name");
document.getElementById("name").focus()
return null;
}
document.getElementById("myform").submit()
}
</script>
<!-- InstanceEndEditable -->
</div>
</body>
<!-- InstanceEnd --></html>