<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Nahid - Prescription & EMR Software</title>
<link rel="stylesheet" href="winseven.css?v=4" type="text/css">
<link rel="shortcut icon" href="favicon.png" sizes="256x256">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<script>
$(document).ready(function() {
    $(".login_username").focus();	
    
    $(".z_login_but_2").click(function() {	
        window.location.href = "register.php"; 
    });
});
</script>
</head>
<body>
<div class="z_login_header">
<img src="images/nahid_logo.png" alt="Nahid">
</div>

<div class="z_login_cnt">
<div class="z_login_box">
<div class="z_login_but_1 active">Login</div>
<div class="z_login_but_2">Register</div>

<div class="z_login_bdy">
<form action="login_process.php" method="POST" autocomplete="off">
    <input type="hidden" name="key" value="hsgRw537Mxhsgywtsdgtwfsd">
    
    <table>
        <tr>
            <td>
                <input type="text" name="username" placeholder="Username or Email" 
                       class="login_username" autocomplete="off" required>
            </td>
        </tr>
        <tr>
            <td>
                <input type="password" name="password" placeholder="Password" 
                       class="login_password" autocomplete="off" required>
            </td>
        </tr>
    </table>
    
    <div class="z_login_submit">
        <button type="submit" class="login_subm_bt">Log In</button>
        <forgot>
            <u><a href="forgot.php">I forgot password</a></u>
        </forgot>
        
        <?php if(isset($_GET['error'])): ?>
            <div class="login_err_bar">
                <?php 
                    if($_GET['error'] == 1) echo "Invalid username or password";
                    elseif($_GET['error'] == 2) echo "Invalid security key";
                ?>
            </div>
        <?php endif; ?>
        
        <?php if(isset($_GET['success'])): ?>
            <div class="login_success_bar">Logout successful</div>
        <?php endif; ?>
    </div>
</form>
</div>
</div>
</div>

<div style="text-align: center; margin-top: 10px; color: #666; font-size: 12px;">
    &copy; 2026 Nahid. All rights reserved.
</div>
</body>
</html>