| Current Path : /var/www/html/venkat/army1/ |
| Current File : /var/www/html/venkat/army1/checklogin.php |
<?php
include_once("db1.php");
$id=$_POST['myusername'];
$pd=$_POST['mypassword'];
/*include_once("from_ldap.php");
if (chk_pass($id, $pd) == TRUE) {
$count = 1;
} else {
$count = 0;
}
//if($id == "iit2012204") {
// $count = 1;
//}
*/
//$sql="SELECT * FROM login WHERE user='$id' and pass='$pd'";
//$result=mysql_query($sql);
//$count=mysql_num_rows($result);
$sql = $conn->prepare("SELECT username FROM armyuser where username = :id and password = :pd");
$sql->bindValue(':id',$id);
$sql->bindValue(':pd',$pd);
$sql->execute();
$row = $sql->rowCount();
if($row > 0) {
//while($row = $sql->fetch(PDO::FETCH_ASSOC)) {
// $_SESSION['dept'] = $row['dept'];
// $_SESSION['name'] = $row['name'];
header("location:login_success.php");
// }
// }
ini_set('session.cookie_httponly', 1);
ini_set('session.use_only_cookies', 1);
ini_set('session.cookie_secure', 1);
session_start();
$_SESSION['key'] = $id;
// else {
// echo "You are Not required to submit";
// session_destroy();
// }
}
else {
include("inde.php");
echo "<font color='red'><center> Wrong Username or Password. Try Again. </center> </font><br>";
?>
<center> <h1> <font color="blue"> <i> Login Again </i> </font> </h1> </center>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="checklogin.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>User Login </strong></td>
</tr>
<tr>
<td width="250">Username</td>
<td width="16">:</td>
<td width="394"><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="mypassword" type="password" id="mypassword"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td width="50"><div align="right"><input type="submit" name="Submit" value="Login" onmouseover="validateForm()"></div></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<?php
}
?>