Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require 'config/connect.php';
- // Jika Pernah Login
- if (isset($_SESSION['uid'])) {
- header('Location:profile.php');
- exit;
- }
- if ($_SERVER['REQUEST_METHOD']=='POST') {
- $username=$_POST['username'];
- $password=md5($_POST['password']);
- $login =$config->query("SELECT * FROM user FROM username='$username', password='$password'");
- if ($login->num_rows == 1) {
- $result =$login->fetch_assoc();
- $_SESSION['uid']=$result['id'];
- header('Location:profile.php');
- exit;
- }else{
- echo "Wah Gagal we, cobain lagi gih";
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Login Page</title>
- </head>
- <body>
- <form action="" method="post">
- <input type="text" name="username"><input type="password" name="password"><button type="submit">Login</button>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement