Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "koneksi2.php";
- $username = $_POST['names'];
- $password = $_POST['pass'];
- if (empty($username)){
- echo "<script>alert('Username belum diisi')</script>";
- echo "<meta http-equiv='refresh' content='1 url=index.html'>";
- }else if (empty($password)){
- echo "<script>alert('Password belum diisi')</script>";
- echo "<meta http-equiv='refresh' content='1 url=index.html'>";
- }else{
- session_start();
- $login = mysql_query("select * from users where username='$username' and password='$password'");
- if (mysql_num_rows($login) > 0){
- $_SESSION['username'] = $username;
- header("location:index.php");
- }else{
- echo "<script>alert('Username atau Password salah')</script>";
- echo "<meta http-equiv='refresh' content='1 url=index.html'>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement