<?php
session_start();
$_SESSION['username'] = $_POST['user'];
$_SESSION['userpass'] = $_POST['password'];
$_SESSION['authuser'] = 0;
//Check username and password information
require("../common/database.php");
$login_query = "select Id,password from analyst where User_Name='".$_SESSION['username']."'";
$login_result = mysql_query($login_query,$link);
$raw = mysql_fetch_array($login_result);
$db_password = $raw['password'];
//converting input password to md5 format and aquire first 20 characters
$temp = md5($_SESSION['userpass']);
$in_password = substr($temp, 0, 20);
$check = strcmp($db_password, $in_password);
if ($check=="true"){
$_SESSION['authuser'] = 1;
$_SESSION['userid'] = $raw['Id'];
} else {
include "index.php";
echo '<div align="center"';
echo "<p> Your user name or password may be incorrect! </p>";
echo "</div>";
//echo $db_password." ".$in_password;
exit();
}
?>
<html>
<head>
<title>Decider - Information Gathering Assistant</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Login</title>
<link rel="stylesheet" type="text/css" href="../common/styles1.css"/>
<link rel="stylesheet" type="text/css" href="../common/styles.css"/>
</head>
<body>
<div id='maindiv' align="center" >
<table width="800px">
<tr>
<td align="left" valign="top"><?php require('../common/top.html'); ?></td>
</tr>
</table>
<form method="post" action="home.php">
<table align="center" background="../common/tableback2.png" width="800px" height="800px">
<tr><td align="center"><p class="label"> Wellcome <?php echo $_SESSION['username'];?> ........</p>
<p class="label">Click here to proceed</p> </td>
</tr>
<tr>
<td align="center"><input type="submit" name="Ok" value=" Ok " class="button">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>