<?php 
session_start();
if(isset($_SESSION['ses_knn_admin_id']))
{ 
	header("location:./");
	exit;
}
if(isset($_POST['username'])){
	require_once("./class/login.php");
	$login=new login();
	
	$username=$login->escapeString(@$_POST['username']);
	$password=$login->escapeString(@$_POST['password']);

	$pass=""; $user=""; $nama=""; $id_admin=0;
	$result = $login->verifikasi($username);
	if($result){
		foreach ($result as $key => $data) {
			$id_admin=$data['id_administrator'];
			$pass=$data['password'];
			$user=$data['username'];
			$nama=$data['nama'];
		}
		if (password_verify($password, $pass)) {
			$_SESSION['ses_knn_admin_id']=$id_admin;
			$_SESSION['ses_knn_admin_user']=$user;
			$_SESSION['ses_knn_admin_nama']=$nama;
			header("location:./");
		} else {
			$_SESSION['pass_cek']=2;
		}
	} else {
		$_SESSION['pass_cek']=2;
	}
}
?>
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link rel="apple-touch-icon" sizes="76x76" href="../assets/img/favicon.png">
  <link rel="icon" type="image/png" href="../assets/img/favicon.png">
  <title>Aplikasi Metode K-Nearest Neighbor | Metode KNN | Anindyadev.com</title>
  <meta name="description" content="Source Code aplikasi metode K-Nearest Neighbor (Metode KNN), Metode ANN/JST untuk klasifikasi, dapat digunakan untuk belajar dan atau dikembangkan untuk pengerjaan Tugas Akhir atau Skripsi. anindyadev.com siap membantu untuk pengembangan ataupun judul-judul lain diluar source code program aplikasi yang sudah ada.">
  <meta name="keywords" content="k-nearest neighbor, metode knn, lvq, jst, ann, jaringan syaraf tiruan, artificial neural network, demo aplikasi, software, klasifikasi, anindyadev.com"> 
  <!--     Fonts and icons     -->
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet" />
  <!-- Nucleo Icons -->
  <link href="../assets/css/nucleo-icons.css" rel="stylesheet" />
  <link href="../assets/css/nucleo-svg.css" rel="stylesheet" />
  <!-- Font Awesome Icons -->
  <script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script>
  <link href="../assets/css/nucleo-svg.css" rel="stylesheet" />
  <!-- CSS Files -->
  <link id="pagestyle" href="../assets/css/argon-dashboard.css?v=2.0.4" rel="stylesheet" />
</head>

<body class="">
  <div class="container position-sticky z-index-sticky top-0">
    <div class="row">
      <div class="col-12">
        <!-- Navbar -->
        <nav class="navbar navbar-expand-lg blur border-radius-lg top-0 z-index-3 shadow position-absolute mt-4 py-2 start-0 end-0 mx-4">
          <div class="container-fluid">
            <a class="navbar-brand font-weight-bolder ms-lg-0 ms-3 " href="./pages/dashboard.html">
                Aplikasi Metode K-Nearest Neighbor (KNN)
            </a>
            <button class="navbar-toggler shadow-none ms-2" type="button" data-bs-toggle="collapse" data-bs-target="#navigation" aria-controls="navigation" aria-expanded="false" aria-label="Toggle navigation">
              <span class="navbar-toggler-icon mt-2">
                <span class="navbar-toggler-bar bar1"></span>
                <span class="navbar-toggler-bar bar2"></span>
                <span class="navbar-toggler-bar bar3"></span>
              </span>
            </button>
         
          </div>
        </nav>
        <!-- End Navbar -->
      </div>
    </div>
  </div>
  <main class="main-content  mt-0">
    <section>
      <div class="page-header min-vh-100">
        <div class="container">
          <div class="row">
            <div class="col-xl-4 col-lg-5 col-md-7 d-flex flex-column mx-lg-0 mx-auto">
              <div class="card card-plain">
                <div class="card-header pb-0 text-start">
                  <h4 class="font-weight-bolder">Login</h4>
                  <p class="mb-0">Masukkan Username : <b>admin</b>, Password : <b>12345</b> untuk login</p>
                  <?php if(@$_SESSION['pass_cek']==2) { ?><br><div style="font-size:12px; padding:3px 3px; background-color:#FF3C3C; color:#FFF; border-radius:5px; text-align:center;">Username atau password yang Anda masukkan salah.</div><?php } unset($_SESSION['pass_cek']); ?>
                </div>
                <div class="card-body">
                  <form role="form" method="post" action="">
                    <div class="mb-3">
                      <input type="test" name="username" class="form-control form-control-lg" placeholder="Username" aria-label="Username">
                    </div>
                    <div class="mb-3">
                      <input type="password" name="password" class="form-control form-control-lg" placeholder="Password" aria-label="Password">
                    </div>
                    <div class="text-center">
                      <button type="submit" class="btn btn-lg btn-primary btn-lg w-100 mt-4 mb-0">Login</button>
                    </div>
                  </form>
                </div>
                
              </div>
            </div>
            <div class="col-6 d-lg-flex d-none h-100 my-auto pe-0 position-absolute top-0 end-0 text-center justify-content-center flex-column">
              <div class="position-relative bg-gradient-primary h-100 m-3 px-7 border-radius-lg d-flex flex-column justify-content-center overflow-hidden" style="background-image: url('../assets/img/bg_login_n.webp'); background-size: cover;">
                <span class="mask bg-gradient-primary opacity-8"></span>
                <h4 class="mt-5 text-white font-weight-bolder position-relative">"K-Nearest Neighbor (KNN)"</h4>
                <p class="text-white position-relative">KNN adalah singkatan dari K-Nearest Neighbor, sebuah algoritma machine learning yang bekerja berdasarkan prinsip bahwa objek yang mirip cenderung berada dalam jarak yang dekat satu sama lain. Dengan kata lain, data yang memiliki karakteristik serupa akan cenderung saling bertetangga dalam ruang fitur (feature space).</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </main>
  <!--   Core JS Files   -->
  <script src="../assets/js/core/popper.min.js"></script>
  <script src="../assets/js/core/bootstrap.min.js"></script>
  <script src="../assets/js/plugins/perfect-scrollbar.min.js"></script>
  <script src="../assets/js/plugins/smooth-scrollbar.min.js"></script>
  <script>
    var win = navigator.platform.indexOf('Win') > -1;
    if (win && document.querySelector('#sidenav-scrollbar')) {
      var options = {
        damping: '0.5'
      }
      Scrollbar.init(document.querySelector('#sidenav-scrollbar'), options);
    }
  </script>
  <!-- Control Center for Soft Dashboard: parallax effects, scripts for the example pages etc -->
  <script src="../assets/js/argon-dashboard.min.js?v=2.0.4"></script>
</body>

</html>
<!--
=========================================================
* Argon Dashboard 2 - v2.0.4
=========================================================

* Product Page: https://www.creative-tim.com/product/argon-dashboard
* Copyright 2022 Creative Tim (https://www.creative-tim.com)
* Licensed under MIT (https://www.creative-tim.com/license)
* Coded by Creative Tim

=========================================================

* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-->