<?php
    $loginpage = true;
    include_once 'data_connect.php'
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Login</title>
<link rel="stylesheet" type="text/css" href="cmstyle.css">
</head>
<body>
<style>
    html,body{background-color:transparent}
</style>
    
<script type="text/javascript">
        function formsubmit() {
            document.getElementById("usernameinp").setAttribute('readonly','true');
            document.getElementById("passwordinp").setAttribute('readonly','true');
        }
</script>
    
    <form name="login" action="login.php" method="post" onsubmit="submit.disabled=true; formsubmit(); return true;">
        
        
        <div class="login-wrapper">
            <b class="loginM">M</b>
            <h1 class="loginheading">MonoCMS</h1>
            <div id="login-container">
            <?php 
            
                if (isset($_SESSION['MONfailedlogin'])) {
                    
                    print '<div class="loginf">Incorrect username or password</div>';
                    unset($_SESSION['MONfailedlogin']);
                }
                
            ?>
            
                <!-- Username -->
                <div class="login-box">
                    <span class="cred">Username:</span>
                    <input class="login-input" id="usernameinp" name="username" type="text" autofocus>
                </div>
                
                
                <!-- Password -->
                <div class="login-box">
                    <span class="cred">Password:</span>
                    <input class="login-input" id="passwordinp" name="password" type="password">
                </div>
                
                <!-- Submit -->
                <input id="login-button" type="submit" name="submit" value="Login">
                <p class="logindes">Forgot your password?<br>Read the <span style="color:#333">readme.txt</span> for further instructions.</p>
            </div>
        </div>
    </form>
    
</body>
</html>