This repository has been archived by the owner on Oct 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
masuk.php
126 lines (120 loc) · 3.9 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
session_start();
/*
File: masuk.php
Fungsi: Form untuk login.
Auth: ShowCheap
*/
if(file_exists("upgrade/index.php")){
header('location: upgrade/index.php');
exit(0);
}
require 'sistem/config.php';
$pencet=$_POST['tmbl'];
sambung();
if(isset($_SESSION['level'])){
$sesi=$_SESSION['level'];
if(($sesi=='Admin' || $sesi=='Pustakawan')){
header('location: index.php');
}
}
$nama=mysql_real_escape_string($_POST['nama']);
$kunci=md5($_POST['kunci']);
?>
<html>
<head>
<title>Login | LIBSKA - SkanSoft™</title>
<link href="./tampilan/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script src='./tampilan/jq.js' type='text/javascript'></script>
<script type='text/javascript'>
$(document).ready(function(){
$('#user').focus();
})
</script>
<script type='text/javascript'>
$(document).ready(function(){
$.ajax({
url:'run.php',
success: function(data){
//$("#res").html(data);
}
})
});
</script>
<style>
.login {
width: 240px;
margin: 10% auto;
background-color: white;
border: 1px solid #999;
border: 1px solid rgba(0, 0, 0, 0.3);
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
outline: 0;
-webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0 3px 7px rgba(0,0,0,0.3);
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
-webkit-background-clip: padding-box;
-moz-background-clip: padding-box;
background-clip: padding-box;
}
</style>
</head>
<body>
<?php
if ($pencet != '' && $nama != '' && $kunci != ''){
$s=mysql_query("SELECT * FROM tbl_pustakawan WHERE user='".$nama."' AND kunci='".$kunci."'");
$c=mysql_num_rows($s);
if($c == '1'){
$t= mysql_fetch_array($s);
$log=$t['login'];
$log=$log+1;
mysql_query("UPDATE tbl_pustakawan SET login='$log' WHERE user='$nama'");
$_SESSION['nama']=$t['nama'];
$_SESSION['level']=$t['level'];
$_SESSION['uid']=$t['id'];
catat($_SESSION['nama'],"Berhasil Login");
//header('location: index.php');
echo "<script>window.location='index.php'</script>";
exit();
}else{
catat($nama,"Gagal Login");
$script= "<script type='text/javascript'>";
$script.="$('document').ready(function(){";
$script.="$('#result').html('<p class=\'alert alert-error\'>Username dan Password tidak cocok !</p>');";
$script.="})";
$script.="</script>";
echo $script;
}
};
?>
<div class="login" id="login" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: block;">
<div class="modal-header">
<h3 id="myModalLabel">Login User</h3>
</div>
<form action='' method='POST'>
<div class="modal-body">
<table>
<tbody><tr>
<td width="100%" id="tdUser">
<input id="user" type="text" name="nama" style="height:40px; width: 100%;" placeholder="User ID" value="">
</td>
</tr>
<tr>
<td id="tdPass">
<input type="password" id="pass" name="kunci" style="height:40px" placeholder="Password" value="">
</td>
</tr>
</tbody>
</table>
<div id="message"><!-- Result Message Here --></div>
</div>
<div id="result" style="margin: 5px;"><!-- Result --></div>
<div class="modal-footer" style="text-align: center;">
<input class='submit btn btn-info span2' type='submit' value='Masuk' name='tmbl'>
</div>
</form>
</div>
</body>
</html>