| Current Path : /var/www/html/venkat/electiveaug22/ |
| Current File : /var/www/html/venkat/electiveaug22/checklogin.php |
<?php
$id = addslashes($_POST['myusername']);
//$myusername = str_replace("'", "_", $myusername);
//$myusername = str_replace("-", "_", $myusername);
$id = str_replace(' ', 'a', $id);
$pd = $_POST['mypassword'];
//$mypassword = str_replace("'", "_", $mypassword);
//$mypassword = str_replace("-", "_", $mypassword);
//$id = stripslashes($myusername);
//$pd = stripslashes($mypassword);
session_start();
$incorrect = 0;
if ($_POST["vercode"] != $_SESSION["vercode"] OR $_SESSION["vercode"]=='') {
$incorrect = 1;
} else {
include("db1.php");
include_once("from_ldap.php");
//include_once("from_ldap1.php");
//echo chk_pass($id,$pd);
if (chk_pass($id, $pd) == TRUE || chk_pass1($id, $pd) == TRUE) {
$count = 1;
} else {
$count = 0;
}
if($count == 1){
ini_set('session.cookie_httponly', 1);
ini_set('session.use_only_cookies', 1);
ini_set('session.cookie_secure', 1);
session_destroy();
session_start();
session_regenerate_id(true);
$_SESSION['key'] = $id;
$quer1=mysql_query("select name from faculty where id='$id'") or die("Invalid Access3 !!!");
if($row=mysql_fetch_array( $quer1 )) {
$k = "faculty";
}
$quer1=mysql_query("select * from cgp where rollno='$id'") or die("Invalid Access3 !!!");
if($row=mysql_fetch_array( $quer1 )) {
$dept=$row['discipline'];
$deptdate=$row['dept_date'];
$semester = $row['semester'];
$dualdegree= $row['dualdegree'];
$k = "student";
}
$_SESSION['deptdate'] = $deptdate;
$_SESSION['dualdegree'] = $dualdegree;
$_SESSION['semester'] = $semester;
$_SESSION['dept'] = $dept;
$_SESSION['category'] = $k;
$_SESSION['hash'] = "hello";
header("location:login_success.php");
}
}
if ($incorrect == 1) {
echo "<font color='red'><center> Wrong Username or Password. Try Again. </center> </font><br>";
?>
<center> <h1> <font color="blue"> <i> Elective Submission Portal </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> Enter Code <img id='captcha' src='session1.php'> </td> <td> :</td>
<td> <br> <input type="text" id = "vercode" name="vercode" />
<a href="#" onclick="document.getElementById('captcha').src = 'session1.php?'+ Math.random(); return false;">[Refresh]</a>
</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
}
?>