-
Notifications
You must be signed in to change notification settings - Fork 0
/
proses.php
44 lines (37 loc) · 1.35 KB
/
proses.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
<?php
//session_save_path('/tmp');
session_start();
include "plugins/config.php";
$username_login=$_POST['username'];
$password_login=$_POST['password'];
// Mencegah MySQL injection
$username = stripslashes($username_login);
$password = stripslashes($password_login);
$username = mysqli_real_escape_string($con, $username_login);
$password = mysqli_real_escape_string($con, $password_login);
// SQL query untuk memeriksa apakah username terdapat di database?
$query_cek_username = mysqli_query($con,"SELECT pengguna, sandi FROM admin WHERE pengguna='$username_login'");
if(mysqli_num_rows($query_cek_username)!=0){
$cocok=mysqli_fetch_array($query_cek_username);
$password_database=$cocok['sandi'];
if ($password_database == crypt($password_login ,$password_database)){
$_SESSION['admin'] = $username_login;
//$_SESSION['password'] = $password;
echo '<script>
window.location.assign("./")
</script>';
}
else{
echo '<script>
alert("Username atau password salah.");
window.location.assign("login.php")
</script>';
}
}
else{
echo '<script>
alert("Username atau password salah.");
window.location.assign("login.php")
</script>';
}
?>