Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start(); // Right at the top of your script
- ?>
- <?php
- include("config.php");
- // cek apakah tombol daftar sudah diklik atau blum?
- if(isset($_POST['login'])){
- // ambil data dari formulir
- $username = $_POST['username'];
- $password = $_POST['password'];
- // buat query
- if ($username == 'admin' && $password == 'admin') {
- header('Location: pwebuts.php');
- }
- else{
- $sql = mysqli_query($db,"SELECT * FROM registrasi where username = '$username' and password = '$password'");
- $hasil = mysqli_fetch_array($sql);
- $username = $hasil['username'];
- $row = mysqli_num_rows($sql);
- // apakah query simpan berhasil?
- if($row>0) {
- $_SESSION['username']=$username;
- // kalau berhasil alihkan ke halaman index.php dengan status=sukses
- header('Location: pwebuts2.php');
- } else {
- // kalau gagal alihkan ke halaman indek.php dengan status=gagal
- header('Location: regispweb.php');
- echo "Username Tidak Terdaftar";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement