-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchange_password.php
More file actions
116 lines (116 loc) · 6.8 KB
/
change_password.php
File metadata and controls
116 lines (116 loc) · 6.8 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
<!DOCTYPE html>
<html lang="en">
<head>
<?php session_start(); ?>
<?php if (!isset($_SESSION['user']) OR isset($_POST['logout'])): ?>
<?php session_destroy(); ?>
<?php header("Location: login.php"); ?>
<?php endif; ?>
<?php if ($_SESSION['privilege'] != 'superuser'): ?>
<?php header("Refresh:1 url=users.php"); ?>
<?php die("Nemate ovlasti za ovu stranicu!"); ?>
<?php endif; ?>
<?php include "functions.php"; ?>
<?php $user_privilege = GetUserPrivilege($_GET['id']); ?>
<?php if ($user_privilege == 'superuser'): ?>
<?php header("Refresh:1 url=users.php"); ?>
<?php die("Nemate ovlasti za ovu stranicu!"); ?>
<?php endif; ?>
<title>Workify</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link href="css/sidebar.css" rel="stylesheet">
<link href="css/navbar.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/css/bootstrap-datepicker3.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/js/bootstrap-datepicker.min.js"></script>
</head>
<body>
<?php $current_user_id = $_GET['id']; ?>
<?php $current_user = GetUser($current_user_id); ?>
<?php if (isset($_POST["change_password"])): ?>
<?php $change_password = ChangePassword($current_user_id, $_POST['password']); ?>
<?php endif; ?>
<?php $active_ticket = GetCurrentActiveTicket($_SESSION['user']); ?>
<?php if (!empty($active_ticket)): ?>
<?php $active_ticket_name = GetTicket($active_ticket); ?>
<?php endif; ?>
<div class="d-flex" id="wrapper">
<div class="bg-light border-right" id="sidebar-wrapper">
<div class="sidebar-heading">
<a href="index.php"><img class="workify-logo" src="icons/logo.png"></a>
</div>
<div class="list-group list-group-flush">
<a href="jobs.php" class="list-group-item list-group-item-action bg-light"><span class="fas fa-clipboard-list"></span> Poslovi</a>
<a href="tickets.php" class="list-group-item list-group-item-action bg-light"><span class="fas fa-clipboard-list"></span> Radni nalozi</a>
<?php if ($_SESSION['privilege'] == 'superuser'): ?>
<a href="all_tickets.php" class="list-group-item list-group-item-action bg-light"><span class="fas fa-clipboard-list"></span> Svi radni nalozi</a>
<a href="finished_tickets.php" class="list-group-item list-group-item-action bg-light"><span class="fas fa-clipboard-list"></span> Završeni nalozi</a>
<?php endif; ?>
<a href="users.php" class="list-group-item list-group-item-action bg-light"><span class="fas fa-users"></span> Korisnici</a>
<?php if ($_SESSION['privilege'] != 'staff'): ?>
<a href="create_job.php" class="list-group-item list-group-item-action bg-light"><span class="fas fa-plus"></span> Kreiraj posao</a>
<a href="create_ticket.php" class="list-group-item list-group-item-action bg-light"><span class="fas fa-plus"></span> Kreiraj radni nalog</a>
<?php endif; ?>
<?php if ($_SESSION['privilege'] == 'superuser'): ?>
<a href="create_user.php" class="list-group-item list-group-item-action bg-light"><span class="fas fa-plus"></span> Kreiraj korisnika</a>
<?php endif; ?>
<?php if (!empty($active_ticket)): ?>
<a href="tickets.php" class="list-group-item list-group-item-action bg-light"><span class="badge badge-success">Radiš</span> <?php echo $active_ticket_name['name']; ?></a>
<?php else: ?>
<a href="tickets.php" class="list-group-item list-group-item-action bg-light"><span class="badge badge-danger">Ne radiš</span></a>
<?php endif; ?>
</div>
</div>
<div id="page-content-wrapper">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary border-bottom">
<div class="collapse navbar-collapse">
<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item">
<a class="nav-link" href="my_profile.php">Moj profil</a>
</li>
<form method="post">
<input type="submit" name="logout" class="btn btn-light" value="Odjava">
</form>
</ul>
</div>
</nav>
<div class="container-fluid">
<h1 class="mt-4">Nova lozinka</h1>
<h4><?php echo $current_user['full_name']; ?></h4>
<?php if (isset($change_password) AND !empty($change_password)): ?>
<?php if ($change_password == 1): ?>
<div class="alert alert-success" role="alert">
Uspješna promjena lozinke!
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<?php else: ?>
<div class="alert alert-danger" role="alert">
<?php echo $change_password; ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if (!empty($current_user) AND $current_user != false): ?>
<form method="post">
<div class="form-group">
<label for="exampleFormControlInput1">Nova lozinka</label>
<input name="password" type="password" class="form-control" id="exampleFormControlInput1" placeholder="Nova lozinka" value="<?php if (!empty($_POST['password'])): echo $_POST['password']; endif; ?>">
</div>
<div class="form-group">
<input name="change_password" type="submit" class="btn btn-primary" value="Potvrdi" >
</div>
</form>
<?php endif; ?>
</div>
</div>
<div>
</body>
</html>