<?php
require '../conn/codeblocs.php';
//accessCheck();


?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>Survey Display Login Page</title>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">

		<link rel="stylesheet" type="text/css" href="../assets/styles/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" href="../assets/styles/font-awesome.min.css">
		<link rel="stylesheet" type="text/css" href="../assets/styles/animate.css">
		<link rel="stylesheet" type="text/css" href="../assets/styles/perfect-scrollbar.css">
		<link rel="stylesheet" type="text/css" href="../assets/styles/util.css">
		<link rel="stylesheet" type="text/css" href="../assets/styles/login.css">

		<meta name="robots" content="noindex, nofollow">
	</head>
	<body>


        <div class="" style="padding-left:0">
            <div class="" id="">
                
            </div>
            <div class="">
                
                <div class="sign-up" id="sign-in-info" style="text-align:center">
                    <div id="login-result" style="padding:1em;color:#aaa; font-size:smaller"></div>
                <h1>Sign In</h1>
                
                <form id="sign-in-form" method="post">
                    <div>
                     <input type="text" name="username" placeholder="Username"/>
                    </div>
                    <div>
                        <input type="password" name="password" placeholder="Password"/>
                    </div>
                    <p class="forgot-password">Forgot your password?</p>
                    <button class="control-button up">Sign In</button>
                </form>
                </div>
            </div>
        </div>

        <?php if( ($_SERVER['SYSTEMROOT']??'') == 'C:\WINDOWS'):?>
		<script src="http://localhost/doc/javascripts/NEW/jquery-2.2.4.min.js" integrity="" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
		<?php else:?>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
		<?php endif?>
		<script src="../assets/js/script.js"></script>
		<script>
			$(function(){
		

				$('#sign-in-form').submit(function(e){
                    e.preventDefault();
					let d = $(this).serialize();
	-
                    $.post('login-submit.php', d, function(o){
                        console.log(o);
                        let O = JSON.parse(o);
                        console.log(O);

                        $('#login-result').html(O.res);

                        if(O.res == '1'){
                            window.location='<?=APP_ROOT?>display/';
                        }else{
                            console.log('ERROR', O)
                        }
                    });
				});
			});
		</script>
	</body>
</html>
