| Current Path : /var/www/html/mmishra/indem/lms/ |
| Current File : /var/www/html/mmishra/indem/lms/administration.php |
<?php
session_start();
include "header.inc";
include "inc/functions.inc";
dbConnect();
$tbl='leaveUser';
echo "<form method='POST' >
<center><p><b>Administrator Panel</b></p></center><br><br>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='60' style='text-align:center'></td>
<td><p><b>Administrator login</b></p></td>
</tr>
<tr>
<td width='60'> </td>
<td> </td>
</tr>
<tr>
<td width='60'> </td>
<td>Username:<br /><input type='text' name='user' size='35' value='' /></td>
</tr>
<tr>
<td width='60'> </td>
<td> </td>
</tr>
<tr>
<td width='60'> </td>
<td>Password:<br /><input type='password' name='pass' size='35' value='' /></td>
</tr>
<tr>
<td width='60'> </td>
<td> </td>
</tr>
<tr>
<td width='60'> <input type='hidden' name='pg' value='$pg' ></td>
<td><input type='submit' name='submit' value='Login' />
<input type='hidden' name='a' value='do_login' /><br />
<input type='hidden' name='pg' value='$pg' /><br /> </td>
</tr>
</table>";
//echo $_SESSION["passkey"];
if ($_POST[submit]=='Login'){
$uid = $_POST["user"];
$pass = $_POST["pass"];
if ($pass){
chk_pass($uid, $pass);
}
}
function chk_pass($uid, $pass){
$ds = ldap_connect("172.31.1.42");
if ($ds)
{
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
$srch = ldap_search($ds, "dc=iiita,dc=ac,dc=in", "uid=$uid");
$info = ldap_get_entries($ds, $srch);
$userdn = trim($info[0]["dn"]);
$bnd = ldap_bind($ds,$userdn,$pass);
ldap_close($ds);
if($bnd) {
echo "<font color='red'>Login Successfull</font>";
header("Location: http://profile.iiita.ac.in/prashantkr/lms2014/lms/?pg=leaveapplications");
//header("Location: http://website.iiita.ac.in/lms/?pg=leaveapplications&uid=$uid");
return true;
}else{
echo "<font color='red'>Login Unsuccessfull</font>";
return false;
}
}else {
echo "<font color='red'>Authentication Problem</font>";
}
}
?>