Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- session_start();
- include '../connect.php';
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title></title>
- </head>
- <body>
- <?php
- if ($_SESSION['id'] == false) {
- ?>
- <h2> Login Admin </h2>
- <form action="index.php" method="post">
- <label> username </label> <input type="text" name="username"/>
- <label> passowrd </label> <input type="text" name="password"/>
- <input type="submit" value="login"/>
- </form>
- <?php
- if(isset ($_POST['username']) or isset ($_POST['password']))
- {
- if($_POST['username'] == "" or $_POST['password'] == "") {
- echo "username dan password belum di masukan !";
- } else
- {
- $query = mysql_query("select * from admin where username = '$_POST[username]' and password = '$_POST[password]'");
- $num = mysql_num_rows($query);
- if($num == 0){
- echo "Username tidak di temukan !";
- } else
- {
- $data = mysql_fetch_array($query);
- $_SESSION['id'] = $data['id'];
- echo "<meta http-equiv='refresh' content='0;url=index.php' />";
- }
- }
- }
- } else {
- ?>
- <h3>Welcome Admin</h3>
- <p>Ini adalah halaman admin untuk mengelola toko anda</p>
- <a href="add_product.php"> Add Product </a>
- <a href="logout.php"> Logout </a>
- <?php
- }
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment