| Current Path : /var/www/html/sumitupadhyay/ |
| Current File : /var/www/html/sumitupadhyay/marks.php |
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<br>
<content>
<center><h3 class="toggler-37">Linear Algebra (End sem): Jan - May 2024</h3></center>
<ul class="panel-37">
<?php
if(isset($_POST['username']) && isset($_POST['password'])){
$adServer = "ldap://pldap.iiita.ac.in";
$ldap = ldap_connect($adServer);
$username = $_POST['username'];
$password = $_POST['password'];
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
$a = ldap_search($ldap,"dc=iiita,dc=ac,dc=in", "uid=$username");
$b = ldap_get_entries($ldap, $a);
$dn = $b[0]["dn"];
//******************************************************
if(trim($username)==='' || trim($password)==='')
{
echo "Username and Password cannot be blank.";
}
elseif (ldap_bind($ldap, $dn, $password))
{
$username = strtoupper($username);
if (($handle = fopen("marks.csv", "r")) !== FALSE)
{
$flag=0;
if((($data0 = fgetcsv($handle, 1000, ",")) !== FALSE))
{
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
{
$num = count($data);
$fileuser = strtoupper($data[0]);
if ($num>0 && $fileuser==$username)
{
$flag = 1;
?>
<h2>Enrolment Number: <?php echo $data[0];?> Name : <?php echo $data[1];?></h2>
<br/>
<table class="fixed">
<col width="250px" />
<col width="100px" />
<thead>
<tr><td><b><u>Exam </u></b></td><td><b><u>Mark</u></b></td></tr>
</thead>
<tbody>
<?php
for ($c=2; $c < $num; $c++)
{
?>
<tr>
<td><?php echo $data0[$c];?></td>
<td><?php echo $data[$c];?></td>
</tr>
<?php
}
break;
}
}
?>
</tbody>
</table>
<?php
}
if($flag==0)
{
echo "No data found for this user. Please make sure that you are attending a valid course this semester";
}
fclose($handle);
}
else
{
echo "Primary data not found. Please inform at anand@iiita.ac.in";
}
}
else
echo "Wrong Username/Password";
ldap_close($ds);
}
else
{
?>
<h4>Log-In using your LDAP credentials</h4>
<form action="#" method="POST">
<label for="username">Username: </label><br>
<input id="username" type="text" name="username" /><br>
<label for="password">Password: </label><br>
<input id="password" type="password" name="password" /><br><br>
<input type="submit" name="submit" value="Submit" /><br>
</form>
<?php } ?>
</ul>
</content>
</body>
</html>