<?php
session_start();
include("dbconfig.php");

if (isset($_POST['username']) && isset($_POST['password'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];

    // Prepare and execute query to select username and password
    $stmt = $db->prepare("SELECT id, username, password FROM accountant WHERE username = ?");
    $stmt->bind_param("s", $username);  // "s" indicates the type is a string
    $stmt->execute();
    $result = $stmt->get_result();
    $row = $result->fetch_assoc();

    if ($row) {
        // Compare plain text password (adjust if using hashed passwords)
        if ($password === $row['password']) {
            // Password is correct, set session
            $_SESSION['username'] = $username;

            // Redirect to dashboard or home page using header()
            echo "<script>alert('Login successful!');</script>";
            header("Location: default/index.php");
            exit();  // Ensure the script stops executing after redirection
        } else {
            echo "<script>alert('Invalid username or password');</script>";
        }
    } else {
        echo "<script>alert('Invalid username or password');</script>";
    }

    $stmt->close();
}
?>



<!DOCTYPE html>
<html lang="en">

<!-- Mirrored from colorlib.com//polygon/admindek/default/auth-sign-in-social.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 20 Jul 2019 05:31:25 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head>
<title> Vidyaranya Hospital PVt LTD.</title>


<!--[if lt IE 10]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
      <![endif]-->


<link rel="icon" href="images/logo.png" type="image/x-icon">

<link rel="icon" type="image/icon" href="images/logo.png" />

<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" rel="stylesheet"><link href="https://fonts.googleapis.com/css?family=Quicksand:500,700" rel="stylesheet">

<link rel="stylesheet" type="text/css" href="files/bower_components/bootstrap/css/bootstrap.min.css">

<link rel="stylesheet" href="files/assets/pages/waves/css/waves.min.css" type="text/css" media="all"> <link rel="stylesheet" type="text/css" href="../files/assets/icon/feather/css/feather.css">

<link rel="stylesheet" type="text/css" href="files/assets/icon/themify-icons/themify-icons.css">

<link rel="stylesheet" type="text/css" href="files/assets/icon/icofont/css/icofont.css">

<link rel="stylesheet" type="text/css" href="files/assets/icon/font-awesome/css/font-awesome.min.css">

<link rel="stylesheet" type="text/css" href="files/assets/css/style.css"><link rel="stylesheet" type="text/css" href="files/assets/css/pages.css">
<script>
	if ( window.history.replaceState ) {
  window.history.replaceState( null, null, window.location.href );
}
</script>
<style>
img.img1234 {
    width: 7%;
    margin-bottom: 8px;
    margin-left: -36px;
    margin-top: -14px;
}
</style>

</head>
<body themebg-pattern="theme1">

<div class="theme-loader">
<div class="loader-track">
<div class="preloader-wrapper">
<div class="spinner-layer spinner-blue">
<div class="circle-clipper left">
<div class="circle"></div>
</div>
<div class="gap-patch">
<div class="circle"></div>
</div>
<div class="circle-clipper right">
<div class="circle"></div>
</div>
</div>
<div class="spinner-layer spinner-red">
<div class="circle-clipper left">
<div class="circle"></div>
</div>
<div class="gap-patch">
<div class="circle"></div>
</div>
<div class="circle-clipper right">
<div class="circle"></div>
</div>
</div>
<div class="spinner-layer spinner-yellow">
<div class="circle-clipper left">
<div class="circle"></div>
</div>
<div class="gap-patch">
<div class="circle"></div>
</div>
<div class="circle-clipper right">
<div class="circle"></div>
</div>
</div>
<div class="spinner-layer spinner-green">
<div class="circle-clipper left">
<div class="circle"></div>
</div>
<div class="gap-patch">
<div class="circle"></div>
</div>
<div class="circle-clipper right">
<div class="circle"></div>
</div>
</div>
</div>
</div>
</div>

<section class="login-block">

<div class="container-fluid">
<div class="row">
<div class="col-sm-12">

<form method="POST">
    <div class="text-center">
    <img src="logo.png" alt="logo.png" class="img1234">
    </div>
    <div class="auth-box card">
        <div class="card-block">
            <div class="row m-b-20">
                <div class="col-md-12">
                    <h3 class="text-center txt-primary">Sign In</h3>
                </div>
            </div>
            <p class="text-muted text-center p-b-5">Sign in with your regular account</p>
            <div class="form-group form-primary">
                 <label class="float-label">Username</label>
                <input type="text" name="username" class="form-control" placeholder="Username" required="">
                <span class="form-bar"></span>
               
            </div>
            <div class="form-group form-primary">
                <label class="float-label">Password</label>
                <input type="password" name="password" class="form-control" placeholder="Password" required="">
                <span class="form-bar"></span>
                
            </div>
            <div class="row m-t-25 text-left">
              <!--  <div class="col-12">
                <div class="checkbox-fade fade-in-primary">
                    <label>
                        <input type="checkbox" value="">
                        <span class="cr"><i class="cr-icon icofont icofont-ui-check txt-primary"></i></span>
                        <span class="text-inverse">Remember me</span>
                    </label> 
                </div>
                <div class="forgot-phone text-right float-right">
                    <a href="auth-reset-password.html" class="text-right f-w-600"> Forgot Password?</a>
                </div>
                </div>-->
            </div>
                <div class="row m-t-30">
                    <div class="col-md-12">
                        <button type="submit" class="btn btn-primary btn-md btn-block waves-effect text-center m-b-20">LOGIN</button>
                    </div>
                </div>
        </div>
    </div>
</form>

</div>

</div>

</div>

</div>

</section>


<!--[if lt IE 10]>
<div class="ie-warning">
    <h1>Warning!!</h1>
    <p>You are using an outdated version of Internet Explorer, please upgrade <br/>to any of the following web browsers to access this website.</p>
    <div class="iew-container">
        <ul class="iew-download">
            <li>
                <a href="http://www.google.com/chrome/">
                    <img src="../files/assets/images/browser/chrome.png" alt="Chrome">
                    <div>Chrome</div>
                </a>
            </li>
            <li>
                <a href="https://www.mozilla.org/en-US/firefox/new/">
                    <img src="../files/assets/images/browser/firefox.png" alt="Firefox">
                    <div>Firefox</div>
                </a>
            </li>
            <li>
                <a href="http://www.opera.com">
                    <img src="../files/assets/images/browser/opera.png" alt="Opera">
                    <div>Opera</div>
                </a>
            </li>
            <li>
                <a href="https://www.apple.com/safari/">
                    <img src="../files/assets/images/browser/safari.png" alt="Safari">
                    <div>Safari</div>
                </a>
            </li>
            <li>
                <a href="http://windows.microsoft.com/en-us/internet-explorer/download-ie">
                    <img src="../files/assets/images/browser/ie.png" alt="">
                    <div>IE (9 & above)</div>
                </a>
            </li>
        </ul>
    </div>
    <p>Sorry for the inconvenience!</p>
</div>
<![endif]-->


<script type="010180188524844d0ef6ed51-text/javascript" src="files/bower_components/jquery/js/jquery.min.js"></script>
<script type="010180188524844d0ef6ed51-text/javascript" src="files/bower_components/jquery-ui/js/jquery-ui.min.js"></script>
<script type="010180188524844d0ef6ed51-text/javascript" src="files/bower_components/popper.js/js/popper.min.js"></script>
<script type="010180188524844d0ef6ed51-text/javascript" src="files/bower_components/bootstrap/js/bootstrap.min.js"></script>

<script src="files/assets/pages/waves/js/waves.min.js" type="010180188524844d0ef6ed51-text/javascript"></script>

<script type="010180188524844d0ef6ed51-text/javascript" src="files/bower_components/jquery-slimscroll/js/jquery.slimscroll.js"></script>

<script type="010180188524844d0ef6ed51-text/javascript" src="files/bower_components/modernizr/js/modernizr.js"></script>
<script type="010180188524844d0ef6ed51-text/javascript" src="files/bower_components/modernizr/js/css-scrollbars.js"></script>
<script type="010180188524844d0ef6ed51-text/javascript" src="files/assets/js/common-pages.js"></script>

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-23581568-13" type="010180188524844d0ef6ed51-text/javascript"></script>
<script type="010180188524844d0ef6ed51-text/javascript">
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-23581568-13');
</script>
<script src="../../../../ajax.cloudflare.com/cdn-cgi/scripts/95c75768/cloudflare-static/rocket-loader.min.js" data-cf-settings="010180188524844d0ef6ed51-|49" defer=""></script></body>

<!-- Mirrored from colorlib.com//polygon/admindek/default/auth-sign-in-social.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 20 Jul 2019 05:31:25 GMT -->
</html>
