-
Notifications
You must be signed in to change notification settings - Fork 1
/
login.php
71 lines (50 loc) · 2.11 KB
/
login.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
<?php include_once("inc/header1_with_login.php");
// if you need to return header() statements, do them here. SQL connection has already been established.
include_once("inc/header2.php"); ?>
BBDB</title>
<?php // include anything else you want to put in <head> here.
include_once("inc/header3.php");
if ($LoginCode == 1) {
echo "<h1>Access denied!</h1><p>$error_message</p>";
}
if ($LoginCode == 2)
{ // login is OK!
$login = TRUE;
echo "<h1>Login successful</h1><p>All looks good here - login is good to go!</p>";
// if ((mysql_numrows(mysql_query("SELECT * FROM feedback WHERE UserEntryID = $UserEntryID"))==0) && (time() < 1279756799)) {
// echo "<p style=\"font-weight:bold\">I would be very grateful if you could fill in the <a href=\"feedback.php\">feedback form</a> - Thanks!</p>";
// }
$sql = $conn->prepare("SELECT DISTINCT rp.permission_id, p.description AS permission_desc
FROM bb_user_role ru
INNER JOIN bb_role_permission rp ON ru.role_id = rp.role_id
INNER JOIN bb_permission p ON rp.permission_id = p.permission_id
WHERE ru.user_id = ?
ORDER BY p.description");
$sql->execute(array($user_id));
$permission_data = $sql->fetchAll(PDO::FETCH_ASSOC);
$_SESSION['permission'] = array();
echo '<p>You have the following permissions...</p>'.PHP_EOL.'<ul>'.PHP_EOL;
foreach($permission_data AS $row) {
$_SESSION['permission'][] = (int) $row['permission_id'];
echo '<li>' . $row['permission_desc'] . '</li>'.PHP_EOL;
}
echo '</ul><p>Woo.</p>';
}
if ($LoginCode == 0)
{
?>
<h1>Login page</h1>
<form method="post" action = "login.php">
<table>
<tr><td>User Name</td>
<td><input name="uname" type = "text" size = "50" maxlength="64"/></td></tr>
<tr><td>Password</td>
<td><input name="pwd" type = "password" size="50" maxlength="70"/></td></tr>
<tr><td></td><td><input type="submit" name ="submit" value="Log me in"/></td></tr>
</table>
</form>
<p>Argh, actually I want you to <a href="logout.php">log me out!</a></p>
<p>If you have forgotten your password, then <a href="contact.php">contact me</a> so I can reset it for you.</p>
<?php
}
include_once("inc/footer.php"); ?>