Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(isset($_SESSION['username']) || !empty($_SESSION['username'])){
- header("location:blog.php");
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Template Login</title>
- <link rel="stylesheet" href="style.css">
- <meta name="viewport" content="width=device-width , initial-scale=1">
- </head>
- <body>
- <div id="login">
- <div class="center">
- <h2>Login - Web</h2>
- <?php
- if (isset($_POST['login'])) {
- $username = $_POST['username'];
- $filter = mysql_real_escape_string(stripcslashes(strip_tags(htmlspecialchars($username, ENT_QUOTES))));
- $password = md5($_POST['password']);
- //inisialisasi memakai akun tanpa database
- $user = 'dganisha';
- $key = md5('11rpl1');
- if ((!empty($username) && !empty($password))) {
- if($username == $user && $password == $key){
- $_SESSION['username'] = $username;
- $_SESSION['password'] = $password;
- //dialihkan ke halaman utama
- header("location:blog.php");
- }else{
- echo "<p style='color:red;font-size:13px;margin:2px auto;'>(*) Usernanme atau Password Salah. </p>";
- }
- }else{
- echo "<p style='color:red:font-size:13px;margin:2px auto;'>(*) Silahkan isi Form yang telah tersedia </p>";
- }
- }
- ?>
- <form class="f1" action="" method="post">
- <input class="itpw" type="text" name="username" placeholder="Username or Email" required><br>
- <input class="itpw" type="password" name="password" placeholder="Password" required><br>
- <input class="its" type="submit" name="login" value="LOGIN">
- </form>
- <p><a href="#">Forget Your Password? </a> | <a href="#">Created an account</a> </p>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement