-
Notifications
You must be signed in to change notification settings - Fork 0
/
loguser.php
64 lines (59 loc) · 1.55 KB
/
loguser.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
<?php
session_start();
$flag=isset($_SESSION['username']);
if($flag==false){
header ('location: ./login.php');
}
$_SESSION['active_page']="loguser";
include("./header.php");
?>
<div class="container">
<div class="starter-template">
<h1>Log User</h1>
<br>
<div class="row">
<div class="col-md-4 col-md-offset-4">
<form class="form-horizontal" role="form" action="loguser_request.php" method="POST">
<div class="form-group">
<label for="username" class="col-sm-3 control-label">Username</label>
<div class="col-sm-9">
<select class="form-control" id="username" name="username" required>
<?php
include 'dbconnect.php';
$result = mysqli_query($con,"SELECT * FROM users");
$flag=true;
while($row = mysqli_fetch_array($result))
{
echo "<option value='".$row['username']."'>".$row['username']."</option>";
}
?>
</select>
</div>
</div>
<button type="submit" class="btn btn-default">Log User</button>
</form>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-4 col-md-offset-4">
<?php
if(isset($_SESSION['error']))
{
$error=$_SESSION['error'];
if($error=="username_invalid")
{
echo "<div class='alert alert-danger'>
Invalid Username";
}
echo "</div>";
unset($_SESSION['error']);
}
?>
</div>
</div>
</div>
</div><!-- /.container -->
<?php
include("./footer.php");
?>