-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_edit.php
More file actions
84 lines (75 loc) · 3.52 KB
/
user_edit.php
File metadata and controls
84 lines (75 loc) · 3.52 KB
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
<?php
include_once 'connection/checkUser.php';
include_once 'database/User.php';
include_once 'database/Database.php';
include_once 'parts/header.php';
$err = '';
//Check if post back
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$err = User::testEdit();
}
if (($_SERVER["REQUEST_METHOD"] == "POST") && empty($err)) {
User::updateUser($_SESSION["user"], $_POST["first_name"], $_POST["last_name"]);
header('Location: user_info.php');
} else {
?>
<body>
<div id="wrapper">
<?php include_once 'parts/nav.php';?>
<!-- Page Content -->
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">User Info</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="panel panel-default">
<div class="panel-heading">
Information
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<form role="form" method="POST" action=<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>>
<?php
$results = User::getUser($_SESSION['user']);
?>
<?php if(!empty($err)) { ?>
<div class="alert alert-danger" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<?php echo $err?>
</div>
<?php }?>
<div class="form-group">
<label>Username:</label>
<input class="form-control" type="text" placeholder="<?php echo $results[0]["USERNAME"];?>" disabled>
</div>
<div class="form-group">
<label>First Name</label>
<input class="form-control" name="first_name" type="text" value="<?php echo $results[0]["FIRST_NAME"];?>">
</div>
<div class="form-group">
<label>Last Name</label>
<input class="form-control" name="last_name" type="text" value="<?php echo $results[0]["LAST_NAME"];?>">
</div>
<button type="submit" class="btn btn-default">Save</button>
</form>
</div>
</div>
<!-- /.row (nested) -->
</div>
<!-- /.panel-body -->
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
</div>
<!-- /#wrapper -->
<?php
include_once 'parts/bottom.php';
include_once 'parts/footer.php';
}?>