-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
59 lines (56 loc) · 1.63 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
<?php
include('head.php');
if (isset($_SESSION['login']) && $_SESSION['login']==1){
header('Location: /index.php');
exit();
}
$status = 'info';
$msg = '';
$t_msg = 'Login';
if(isset($_POST['mail']) &&
isset($_POST['passwd'])){
$uid = user_login($_POST['mail'], $_POST['passwd']);
if($uid > 0){
$_SESSION['login']=1;
$_SESSION['uid']=$uid;
header('Location: /profile.php?uid='.$_SESSION['uid']);
exit();
}
else{
$status = 'warning';
$msg .= 'User doesn\'t exist';
}
}
?>
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1>Login on The g00d corner</h1>
</div>
</div>
<div class="container">
<form role="form" method="POST" action="/login.php">
<div class="col-md-6">
<div class="bs-callout bs-callout-<?php echo $status; ?>">
<h4><?php echo $t_msg; ?></h4>
<p><?php echo $msg; ?></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input name="mail" type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input name="passwd" type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
</div>
<button type="submit" class="btn btn-success">Login</button>
</div>
</form>
</div>
<div class="container">
<hr>
<?php
include('foot.php');
?>