-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit_user.php
More file actions
122 lines (119 loc) · 4.44 KB
/
Copy pathedit_user.php
File metadata and controls
122 lines (119 loc) · 4.44 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
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
<?php
require('dbconfig.php');
if(!$dbfun->is_logged_in()){ header('Location: login.php'); }
if(isset($_POST['btn-update'])){
$id = $_GET['edit_id'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$isadmin = $_POST['isadmin'];
if($dbfun->updateUser($id,$firstname,$lastname,$email,$isadmin))
{
$msg = "<div class='alert alert-info'>
Użytkownik został uaktualniony <strong><a href='users.php'>Wróć</a></strong>
</div>";
}
else
{
$msg = "<div class='alert alert-warning'>
<strong>SORRY!</strong> ERROR
</div>";
}
}
if(isset($_GET['edit_id'])){
$id = $_GET['edit_id'];
extract($dbfun->getUserDetailsbyID($id));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="pl">
<head>
<meta charset="utf-8">
<title>Drawing Tasks System</title>
<meta name="Marek Kozłowski">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.validate.min.js"></script>
<script>
$(document).ready(function(){
$('#edit_user-form').validate({
rules: {
firstname: {required: true},
lastname: {required: true},
email: {required: true, email: true}
},
messages: {
firstname: {required: 'Musisz podać imię'},
lastname: {required: 'Musisz podać nazwisko'},
email: {required: 'Musisz podać adres', email: 'Musisz podać poprawny adres'}
},
errorElement: 'div',
errorLabelContainer: '.errorTxt'
});
});
</script>
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<style type="text/css">
body { background: url(assets/bglight.png);}
.hero-unit { background-color: #fff; }
.center { display: block; margin: 0 auto; }
.navbar-fixed-bottom {background-color: #f5f5f5; }
</style>
</head>
<body>
<?php
if($dbfun->isadmin($_SESSION['key']) == 1){
include_once("ui/logged_navtop_admin.htm");
}else {
include_once("ui/logged_navtop.htm");
}
?>
<div class="container hero-unit">
<?php
if(isset($msg))
{
echo $msg;
}
?>
<form id="edit_user-form" role="form" method='post'>
<table class='table table-bordered'>
<tr>
<td>Imię</td>
<td><input type='text' name='firstname' class='form-control' value="<?php echo $firstname; ?>"></td>
</tr>
<tr>
<td>Nazwisko</td>
<td><input type='text' name='lastname' class='form-control' value="<?php echo $lastname; ?>"></td>
</tr>
<tr>
<td>Email</td>
<td><input type='text' name='email' class='form-control' value="<?php echo $email; ?>"></td>
</tr>
<tr>
<td>Admin</td>
<td>
<div class="btn-group" data-toggle="buttons" id="isadmin_radio">
<label class="btn btn-primary active">
<input type="radio" name="isadmin" id="option1" autocomplete="off" value="1"> Tak
</label>
<label class="btn btn-primary">
<input type="radio" name="isadmin" id="option2" autocomplete="off" value="0" checked> Nie
</label>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<button type="submit" class="btn btn-primary" name="btn-update">
<span class="glyphicon glyphicon-edit"></span> Aktualizuj
</button>
<a href="users.php" class="btn btn-success"><i class="glyphicon glyphicon-backward"></i>Innym razem</a>
</td>
</tr>
</table>
<div class="errorTxt"></div>
</form>
</div>
<?php include("ui/footer.htm"); ?>
</body>
</html>