This repository has been archived by the owner on Dec 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
profile.php
70 lines (62 loc) · 2.71 KB
/
profile.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
<?php
session_start();
include_once(dirname(__FILE__).'/Controller/UserController.php');
if(!isset($_SESSION['user_id']) || !isset($_SESSION['user_name'])){
header("Location: login");
exit;
}
$user_controller = UserController::getInstance();
$id = $_SESSION['user_id'];
if(isset($_GET['id']) && $user_controller->isAdmin($_SESSION['user_id'])){
$id = $_GET['id'];
} else if(isset($_GET['id'])){
header("Location: profile");
exit;
}
$userprofile = $user_controller->getUserInfo($id);
?>
<html>
<head>
<title>NUSSU commIT</title>
<link href="includes/css/bootstrap.min.css" rel="stylesheet">
<link href="includes/css/bootstrap-theme.min.css" rel="stylesheet">
<link href="includes/css/style.css" rel="stylesheet">
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="includes/js/bootstrap.min.js"></script>
</head>
<body>
<?php $page = "user"; ?>
<?php include(dirname(__FILE__).'/includes/header.php');?>
<div class="container">
<?php
if(isset($_SESSION['success'])){
echo '<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert">X</button>'.$_SESSION['success'].'</div>';
unset($_SESSION['success']);
}
if(isset($_SESSION['error'])){
echo '<div class="alert alert-danger">'.$_SESSION['error'].'</div>';
unset($_SESSION['error']);
}
if ($user_controller->isAdmin($_SESSION['user_id']) != 0 || isset($_SESSION['original_login'])) {
echo "<a class=\"btn btn-primary\" href=\"loginas\">Login as</a>";
}
?>
<h1> User Profile</h1>
<br/>
<dl class="dl-horizontal">
<dt>Username: </dt> <?php echo '<dd>'.$userprofile['name'].'</dd>';?>
<dt>Matric number: </dt> <?php echo '<dd>'.$userprofile['matric_number'].'</dd>';?>
<dt>Cell: </dt> <?php echo '<dd>'.$userprofile['cell'].'</dd>';?>
<dt>Position: </dt> <?php echo '<dd>'.$userprofile['position'].'</dd>';?>
<dt>Contact: </dt> <?php echo '<dd>'.$userprofile['contact'].'</dd>';?>
<dt>Email: </dt> <?php echo '<dd>'.$userprofile['email'].'</dd>';?>
<dt>New notifications: </dt> <dd><?php echo $userprofile['notification']==1?"Subscribed":"Not subscribed";?></dd>
<br/>
<dt><a href="user?id=<?php echo $id;?>" class="btn btn-default"> Update profile</a></dt>
</dl>
<br/>
</div>
<?php include(dirname(__FILE__).'/includes/footer.php');?>
</body>
</html>