<?php
session_start();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0030)http://10.1.0.87/cgi-bin/index -->
<html xmlns="http://www.w3.org/1999/xhtml">
    <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="expires" content="0">
	<title>Cardinal 825 - Programmable Digital Weight Indicator</title>
	<link href="main.css" rel="stylesheet" type="text/css">
	<link href="filemgr.css" rel="stylesheet" type="text/css">
    <link href="cardinal.css" rel="stylesheet" type="text/css">

	<meta name="viewport" content="width=device-width">

</head>
<body>


<div class="container">

		<div class="row">
            <div class="col-sm-4" id ="main_tab">
            <img src="Cardinal_logo.png" width="60%" background-size="100%">
            </div>
			<div class="col-sm-8" id ="main_tab">
				<ul class="nav nav-pills ">
					<li class="nav-item bg-light"><a href="#" class="nav-link"
						data-toggle="pill" data-target="#tabone">home</a>
                    </li>
					<li class="nav-item bg-light"><a href="#" class="nav-link"
						data-toggle="pill" data-target="#tabtwo">files</a>
                    </li>
					<li class="nav-item bg-light"><a class="nav-link"
                        href="#" data-target="#tabthree" data-toggle="pill">diagnostics</a>
                    </li>
                    <li class="nav-item bg-light"><a class="nav-link"
                        href="#" data-target="#tabthree" data-toggle="pill">admin</a>
                    </li>
                    <li class="nav-item bg-light"><a class="nav-link"
                        href="#" data-target="#tabfive" data-toggle="pill">reports</a>
                    </li>
                </ul>
			</div>
		</div>
</div>

<div class="container">
        <div class= "img">
        <img src="825_Banner.jpg" style="max-width: 100%; display:inline-block;">
        <prim >Login</prim>
        <sec >Login to access 825 resources</sec>
    </div>
</div>
    
	<br>
	<br>
    
	<div class="container">
		<div id="my-div" class="row">
<?php
if(isset($_POST['fm_usr']) && isset($_POST['fm_pwd'])) {
	$cmd = "sudo chkpw " . $_POST['fm_usr'] . " " . $_POST['fm_pwd'];
	//echo "<br/>" . $cmd;
	// $chkpw_buff = shell_exec($cmd);
	exec($cmd, $chkpw_buff, $return_var);
	// echo "<br/>response " . $chkpw_buff[0] . " ret " . $return_var;
	if($return_var == 0) {
		// echo "</br>Login successful";
		$_SESSION["user"] = $_POST['fm_usr'];
		header("location: tinyfilemanager.php");
		exit();
	} else {
		echo "Invalid Login";
	}
}
?>
            <legend>Login</legend>

            <form action="" method="post">
             <table><tbody>
             <tr><td><label for="fm_usr">User:</label></td>
              <td><input type="text" class="form-control" name="fm_usr" id="fm_usr"></td></tr>
             <tr><td><label for="fm_pwd">Password:</label></td>
             <td><input type="password" class="form-control" name="fm_pwd" id="fm_pwd"></td></tr>
			 <tr><td> </td><td><input type="submit" id="myBtn" value="Login"></td><tr>
			 </tbody></table>
			</form>

		</div>
	</div>
	<br>

	<br><br><br><br>
	<div id="footer">
		<div class="right">
		</div>
		<p>
			<a href="https://cardinalscale.com//">Cardinal Technical Support</a><br>
			© Copyright 2008 <a href="https://cardinalscale.com/product/">Cardinal Scale MFG</a> · All Rights Reserved
		</p>
	</div>

</body>
</html>  
