-
Notifications
You must be signed in to change notification settings - Fork 0
/
cek.php
49 lines (43 loc) · 1 KB
/
cek.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
<?php
/**
* cek apakah script diakses secara langsung
* file cek.php hanya boleh diakses dari login.php
*/
if ( isset( $_POST['username'] ) ) {
// mendefinisikan username dan password yang benar
$username = 'siswa';
$password = 'siswa';
/**
* INPUT User ID harus 'siswa'
* INPUT Password harus 'siswa'
*/
if ( $_POST['username'] == $username ) {
echo 'username BENAR';
if ( $_POST['password'] == $password ) {
echo 'Password BENAR';
} else {
echo 'Password SALAH';
}
} else {
echo 'username SALAH';
}
} else {
echo 'HARUS LEWAT LOGIN!';
}
/**
* $_POST : untuk membaca kiriman data dari form menggunakan POST
*/
/**
* TUGAS
*
* Buatlah validasi password
* jika password bernilai 'admin'
* munculkan pesan 'Password Benar'
* jika bukan
* munculkan pesan 'Password Salah'
*/
/**
* JIKA Username DAN Password BENAR
* Munculkan pesan : Berhasil Login
* Selain itu, munculkan pesan : Coba Lagi
*/