Table Details: Student Table
Table Details: Student Table
Table Details: Student Table
Student table:
Courses Table:
Question Table:
Adminlogin Table:
Receipt Table (Values updated automatically after allocation)
Student Login Table:
Output:
Changes in the code:
Admin Login
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome</title>
</head>
<body background="images.jpg">
<br>
{ echo'
<font size=5>
<center>
<br>
<br>
<br>
<br>
<br>
</form>
</font>
</center> '; }
else {
$username = $_REQUEST['username'];
$password = $_REQUEST['password'];
$result = $pdo->query($sql);
$output = $result->fetch();
$_SESSION['Username'] = "$username";
if($output['Password']== $password)
header('Location:ADMIN_MAIN.html.php');
else
header('Location:ADMIN_LOGIN.html.php');
?>
</body>
</html>
Admin Main
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome</title>
</head>
<body background="images.jpg">
<br><br><br><br>
</font>
<br> <br>
<?php
session_start();
$compute_rank=0;
if(!isset($_REQUEST['password']))
{ echo'
<font size=5>
<center>
<br>
Student Password: <input type="password" name="password" id="password" required>
<br>
<br><br>
</form>
</font>
</center> '; }
else {
$result = $pdo->query($sql);
$i=0;
echo "<br><br><br>";
$i=0;
while($row = $result->fetch())
$i++;
$regno=$row['RNO'];
$name=$row['name'];
$rank=$row['rank']=$i;
$result= $pdo->query($sql1);
echo "<br><br><br>";
$compute_rank=0;
if(!isset($_REQUEST['password1']))
echo'
<font size=5>
<center>
<br>
Student Password:
<br>
<br><br>
</form>
</font>
</center> '; }
else
$result = $pdo->query($sql);
$i=0;
echo "<br><br><br>";
$i=0;
while($row = $result->fetch())
$sqle="";
$regno=$row['RNO'];
$name=$row['name'];
$pf1=$row['pref1'];
$pf2=$row['pref2'];
$rank=$row['rank'];
$alloted=0;
$result2=$pdo->query($sql2);
$row2=$result2->fetch();
if(strcmp($row['reser'],"YES")==0)
$flag=0;
if($row1['reser']>0)
$alloted=$row1['CCODE'];
$reser=$row1['reser']-1;
$flag=1;
else if ($row1['avail']>0)
$alloted=$row1['id'];
$avail=$row1['avail']-1;
$flag=1;
else if($row2['reser']>0)
$alloted=$row2['CCODE'];
$reser=$row2['reser']-1;
$flag=2;
else if ($row2['avail']>0)
$alloted=$row2['CCODE'];
$avail=$row2['avail']-1;
$flag=2;
else
if ($row1['avail']>0)
$alloted=$row1['CCODE'];
$avail=$row1['avail']-1;
$flag=1;
else if($row2['avail']>0)
$alloted=$row2['CCODE'];
$avail=$row2['avail']-1;
$flag=2;
if($flag==1)
$cname=$row1['CNAME'];
echo "$regno\t$name\t$rank\t$cname\t\n";
elseif ($flag==2)
echo "$regno\t$name\t$rank\t$cname\t\n";
$result3 = $pdo->query($sqle);
$result4 = $pdo->query($sqle1);
?>
</body>
</html>
Login
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome</title>
</head>
<body background="images.jpg">
<?php session_start();
$regno=$_SESSION['regno'];
$result=$pdo->query($sql);
$row=$result->fetch();
$name=$row["name"];
$sex=$row['GENDER'];
$pref1=$row['pref1'];
$pref2=$row['pref2'];
$reser=$row['reser'];
$atte=$row['atte'];
$rank=$row['rank'];
$allot=$row['allot'];
$re=$row['recp'];
$score=$row['score'];
$result1=$pdo1->query($sql1);
$row1=$result1->fetch();
$result2=$pdo->query($sql2);
$row2=$result2->fetch();
$pfname1=$row1['CNAME'];
$pfname2=$row2['CNAME'];
if (strcmp($atte,"YES")==0)
$score=$row['score'];
else
if (strcmp($allot,NULL)==0)
?>
<br>
</font>
<br> <br>
</form>
</form>
<?php
if(isset($_REQUEST['btn']))
if (strcmp($atte,"no")==0)
header('Location:MAIN.html.php');
else
$_SESSION['btn']="$score";
header('location :TEST.html.php');
if(isset($_REQUEST['rec']))
header('Location:MAIN.html.php');
else
$_SESSION['rec'] = "$re";
header('location:RECEIPT.php');
?>
<br>
</body>
</html>
Main:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome</title>
</head>
<body background="images.jpg">
<?php
session_start();
if (!isset($_REQUEST['regno']))
echo'
<font size=5>
<center>
</form>
</font>
</center>
';
else
$regno = $_REQUEST['regno'];
$password = $_REQUEST['password'];
$result = $pdo->query($sql);
$output = $result->fetch();
$_SESSION['regno'] = "$regno";
if($output['password']== $password)
header('Location:MAIN.html.php');
else
header('Location:LOGIN.php');
}
?>
</body>
</html>
Test:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome</title>
</head>
<body background="images.jpg">
<?php
$answer=0;
session_start();
$regno=$_SESSION['regno'];
$result=$pdo->query($sql);
$output = $result->fetch();
$qid=$output['q_id'];
$score=$output['score'];
$result1=$pdo->query($sql1);
$answer_array=array();
$row=$result1->fetch();
if(!isset($_REQUEST['btn']))
echo '<br>';
echo '<br>';
echo $row['Question'];
echo '<br>';
echo '<br>';
echo '<br>';
echo '<br>';
echo '<br>';
echo '<br>';
echo '<br>';
echo '<br>';
echo '<br>';
echo '<br>';
echo'Answer <?php echo ; ?> :<input type="text" name="answer" id="answer<?php echo ; ?>"
required>';
array_push($answer_array,$row['Correct']);
echo'
</form>
';
else
$score++;
?>
</body>
</html>
Receipt:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome</title>
</head>
<body background="images.jpg">
<?php
session_start();
$re=$_SESSION['rec'];
$regno=$_SESSION['regno'];
$result=$pdo->query($sql);
$row=$result->fetch();
$name=$row['name'];
$allot=$row['allot'];
$result1=$pdo1->query($sql1);
$row1=$result1->fetch();
$cname=$row1['CNAME'];
$fee=$row1['fee'];
$total_fee=($fee*112)/100;
$result2=$pdo->query($sql2);
?>
<br>
<br>
<br>
<br>
>
<br>
<br>
<br>
<br>
</body>
</html>