-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlockScreen.php
76 lines (61 loc) · 2.73 KB
/
lockScreen.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
<?php
require __DIR__."/../../config/bootstrap.php";
if(!allowedRoles($_SESSION['User']['Type'], $GLOBALS['NO_GUEST'])) redirectInside();
redirectOutside();
$firstLetterName = substr($_SESSION['User']['Name'], 0, 1);
$firstLetterSurname = substr($_SESSION['User']['Surname'], 0, 1);
$avatarColors = array('#0f7e8c','#a3d86d','#9113ff','#edc642','#2ac5a3','#ffb858','#955216');
$bgColorAvatar = array_rand($avatarColors,1);
$name = $_SESSION['User']['Name'];
$surname = $_SESSION['User']['Surname'];
$email = $_SESSION['User']['_id'];
$filename = glob('../assets/avatars/'.$_SESSION['User']['id'].'.*');
$avatarImg = $filename[0];
if (file_exists($avatarImg)){
$avatarExists = 1;
} else {
$avatarExists = 0;
}
logoutUser();
?>
<?php require "../htmlib/header.inc.php"; ?>
<body class="">
<div class="page-lock">
<div class="page-logo">
<img src="assets/layouts/layout/img/logo-big.png" alt="logo" />
</div>
<div class="page-body">
<div class="lock-head"> Locked </div>
<div class="lock-body">
<div class="pull-left lock-avatar-block">
<?php if($avatarExists == 1) { ?>
<img src="<?php echo $avatarImg; ?>" class="lock-avatar">
<?php }else{ ?>
<div class="lock-avatar" id="avatar-no-picture-lockscreen" style="background-color:<?php echo $avatarColors[$bgColorAvatar]; ?>"><?php echo $firstLetterName.$firstLetterSurname; ?></div>
<?php } ?>
</div>
<form class="lock-form pull-left" action="home/redirect.php" method="post">
<h4><?php echo $name.' '.$surname; ?> </h4>
<div class="alert alert-danger display-hide" id="err-lock-pwd">
<button class="close" data-close="alert"></button>
<span> Wrong password. </span>
</div>
<div class="form-group">
<input class="form-control form-control-solid placeholder-no-fix" type="password" autocomplete="off" placeholder="Password" name="password" />
<input type="hidden" name="usermail" value="<?php echo $email; ?>" />
<input type="hidden" id="base-url" value="<?php echo $GLOBALS['BASEURL']; ?>"/>
</div>
<div class="form-actions">
<button id="login-button" type="submit" class="btn green uppercase">Login</button>
</div>
</form>
</div>
<div class="lock-bottom">
<a href="<?php echo $GLOBAL['BASEURL']; ?>">Not <?php echo $name.' '.$surname; ?>?</a>
</div>
</div>
<?php require "../htmlib/footer-login.inc.php"; ?>
</div>
<?php
require "../htmlib/js.inc.php";
?>