-
Notifications
You must be signed in to change notification settings - Fork 0
/
masuk.php
52 lines (50 loc) · 1.26 KB
/
masuk.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
<h3>Login</h3>
<?php
if(isset($_POST['usr'])){
$usr = $db->real_escape_string($_POST['usr']);
$passwd = $db->real_escape_string(md5($_POST['passwd']));
$q = $db->query("select * from usr where usr='$usr' and passwd='$passwd'");
if($q){
$d = $q->fetch_array();
$_SESSION['usr'] = $d['usr'];
$_SESSION['level'] = $d['level'];
switch ($d['level']) {
case 'adm':
eksyen('','apps/admin');
break;
case 'usr':
eksyen('','apps/user');
break;
case 'srv':
eksyen('','apps/survey');
break;
case 'wil':
eksyen('','apps/wil');
break;
default:
# code...
break;
}
}
}
?>
<div class="row">
<form class="col s12" action="" method="post">
<div class="row">
<div class="input-field col s6">
<input id="usr" name="usr" type="text" class="validate" maxlength="10" length="10" required>
<label for="usr">Username</label>
</div>
<div class="input-field col s6">
<input id="passwd" name="passwd" type="password" class="validate" required>
<label for="passwd">Password</label>
</div>
</div>
<button type="submit" class="btn waves-effect waves-light">Login</button>
</form>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('input#usr').characterCounter();
});
</script>