Skip to content

Commit

Permalink
student submission done
Browse files Browse the repository at this point in the history
  • Loading branch information
GenerousDev committed Dec 21, 2022
1 parent 61da50a commit 1504c8d
Show file tree
Hide file tree
Showing 27 changed files with 803 additions and 246 deletions.
121 changes: 117 additions & 4 deletions adminfile/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,123 @@
</head>

<Body>
<div class="container">
<a class="btn btn-primary float-end" onclick="location.href='../student/createstudentpage.php'">CREATE STUDENT</a>
<a class="btn btn-primary float-end" onclick="location.href='../examiner/createexaminerpage.php'">CREATE EXAMAINER</a>
</div>
<?php include "../php/readstudent.php"; ?>
<div class="container">
<div class="box">
<h4 class="display-4 text-center">Student Data</h4><br>
<?php if (isset($_GET['success'])) { ?>
<div class="alert alert-success" role="alert">
<?php echo $_GET['success']; ?>
</div>
<?php } ?>
<?php if (isset($_GET['error'])) { ?>
<div class="alert alert-danger" role="alert">
<?php echo $_GET['error']; ?>
</div>
<?php } ?>
<?php if (mysqli_num_rows($result)) { ?>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Email</th>
<th scope="col">Matric Number</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
while ($rows = mysqli_fetch_assoc($result)) {
$i++;
?>
<tr>
<th scope="row"><?= $i ?></th>
<td><?php echo $rows['fullname']; ?></td>
<td><?php echo $rows['email']; ?></td>
<td><?php echo $rows['matricnumber']; ?></td>
<td>
<a href="../student/studentupdate.php?id=<?= $rows['id'] ?>" class="btn btn-success">Update</a>
<a href="../php/detailsstudent.php?id=<?= $rows['id'] ?>" class="btn btn-secondary">Details</a>
<!-- href="../php/deletestudent.php?id=<?= $rows['id'] ?>" -->
<a class="btn btn-danger">Delete</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<div class="link-right">
<a class="btn btn-primary float-end" onclick="location.href='../student/createstudentpage.php'">CREATE STUDENT</a>
</div>
</div>
</div>





<?php include "../php/readexaminer.php"; ?>

<div class="container">
<div class="box">
<h4 class="display-4 text-center">Examiner Data</h4><br>
<!-- <?php if (isset($_GET['success'])) { ?>
<div class="alert alert-success" role="alert">
<?php echo $_GET['success']; ?>
</div>
<?php } ?> -->
<?php if (mysqli_num_rows($result)) { ?>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Email</th>
<th scope="col">Username</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
while ($rows = mysqli_fetch_assoc($result)) {
$i++;
?>
<tr>
<th scope="row"><?= $i ?></th>
<td><?php echo $rows['fullname']; ?></td>
<td><?php echo $rows['email']; ?></td>
<td><?php echo $rows['username']; ?></td>
<td><a href="../examiner/examinerupdate.php?id=<?= $rows['id'] ?>" class="btn btn-success">Update</a>
<!-- href="../php/detailsexaminer.php?id=<?= $rows['id'] ?>" -->
<a class="btn btn-secondary">Details</a>
<a href="../php/deleteexaminer.php?id=<?= $rows['id'] ?>" class="btn btn-danger">Delete</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<div class="link-right">
<a class="btn btn-primary " onclick="location.href='../examiner/createexaminerpage.php'">CREATE EXAMAINER</a>

<div class="container text-center">
<div class="row">
<div class="col">
<h4 class="display-4 text-center">Submitted Data</h4><br>
<a class="btn btn-secondary mb-5" onclick="location.href='../submitted/submittedsolutions.php'">SUBMITTED PROJECTS</a>
<a class="btn btn-secondary mb-5 btn btn-info" onclick="location.href='../submitted/gradingsystem.php'"> GRADING SCALE </a>
<a class="btn btn-success float-end mb-5" onclick="location.href='../welcome.php'">LOGOUT</a>
</div>
</div>
</div>

</Body>
</div>
</div>
</div>


</html>
86 changes: 37 additions & 49 deletions examiner/createexaminerpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,48 @@
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create Student and Examiner</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create Student and Examiner</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
</head>

<Body>
<div class="container">
<form action="../php/createexaminer.php"
method="post">

<h4 class="display-4 text-center">Create Examiner</h4><hr><br>
<?php if (isset($_GET['error'])) { ?>
<div class="alert alert-danger" role="alert">
<?php echo $_GET['error']; ?>
</div>
<?php } ?>
<div class="form-group">
<label for="name">Name</label>
<input type="name"
class="form-control"
id="name"
name="name"
value="<?php if(isset($_GET['name']))
echo($_GET['name']); ?>"
placeholder="Enter name">
</div>
<div class="container">
<form action="../php/createexaminer.php" method="post">

<div class="form-group">
<label for="email">Email</label>
<input type="email"
class="form-control"
id="email"
name="email"
value="<?php if(isset($_GET['email']))
echo($_GET['email']); ?>"
placeholder="Enter email">
</div>
<div class="mb-3">
<label for="username" class="form-label">User name</label>
<input type="text" class="form-control" name="username" id="username" placeholder="Enter a username">
</div>
<h4 class="display-4 text-center">Create Examiner</h4>
<hr><br>
<?php if (isset($_GET['error'])) { ?>
<div class="alert alert-danger" role="alert">
<?php echo $_GET['error']; ?>
</div>
<?php } ?>
<div class="form-group">
<label for="name">Name</label>
<input type="name" class="form-control" id="name" name="fullname" value="<?php if (isset($_GET['name']))
echo ($_GET['name']); ?>" placeholder="Enter your full name">
</div>

<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" name="password" class="form-control" id="password">
</div>
<button type="submit"
class="btn btn-primary"
name="create">Create</button>
<a href="read.php" class="link-primary">View Details</a>
</form>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" value="<?php if (isset($_GET['email']))
echo ($_GET['email']); ?>" placeholder="Enter email">
</div>
<div class="mb-3">
<label for="username" class="form-label">User name</label>
<input type="text" class="form-control" name="username" id="username" placeholder="Enter a username">
</div>

<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" name="password" class="form-control" id="password">
</div>
<button type="submit" class="btn btn-primary" name="create">Create</button>
<!-- <a href="read.php" class="link-primary">View Details</a> -->
</form>
</div>
</Body>

Expand Down
1 change: 1 addition & 0 deletions examiner/examinerdetailpage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hi
53 changes: 53 additions & 0 deletions examiner/examinerupdate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create Student and Examiner</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
</head>

<Body>
<div class="container">
<form action="../php/updateexaminer.php" method="post">

<h4 class="display-4 text-center">Update Examiner</h4>
<hr><br>
<?php if (isset($_GET['error'])) { ?>
<div class="alert alert-danger" role="alert">
<?php echo $_GET['error']; ?>
</div>
<?php } ?>
<div class="form-group">
<label for="name">Name</label>
<input type="name" class="form-control" id="name" name="fullname" value="<?php if (isset($_GET['name']))
echo ($_GET['name']); ?>" placeholder="Enter your full name">
</div>

<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" value="<?php if (isset($_GET['email']))
echo ($_GET['email']); ?>" placeholder="Enter email">
</div>
<div class="mb-3">
<label for="username" class="form-label">User name</label>
<input type="text" class="form-control" name="username" id="username" placeholder="Enter a username">
</div>

<input type="text" name="id" value="<?= $row['id'] ?>" hidden>


<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" name="password" class="form-control" id="password">
</div>
<button type="submit" class="btn btn-primary" name="create">Update</button>
<!-- <a href="read.php" class="link-primary">View Details</a> -->
</form>
</div>
</Body>

</html>
50 changes: 30 additions & 20 deletions php/check-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,41 @@ function test_input($data)

// Hashing the password
// $password = md5($password);
// if ($row['role'] === "admin") {
$sql = "SELECT * FROM adminuser WHERE username='$username' AND password='$password'";
// }
// else{
// $sql = "SELECT * FROM examineruser WHERE username='$username' AND password='$password'";
// }
$result = mysqli_query($conn, $sql);
echo mysqli_num_rows($result);
if (mysqli_num_rows($result) >= 1) {
// the user name must be unique
$row = mysqli_fetch_assoc($result);
if ($row['password'] === $password && $row['role'] == $role) {
$_SESSION['id'] = $row['id'];
$_SESSION['role'] = $row['role'];
$_SESSION['username'] = $row['username'];
if ($row['role'] === "admin") {
header("Location: ../adminfile/admin.php");
if ($_POST['role'] == "admin") {
$sql = "SELECT * FROM adminuser WHERE username='$username' AND password='$password'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) == 1) {
// the user name must be unique
$row = mysqli_fetch_assoc($result);
if ($row['password'] === $password && $row['role'] == $role) {
$_SESSION['id'] = $row['id'];
$_SESSION['role'] = $row['role'];
$_SESSION['username'] = $row['username'];
header("Location: ../adminfile/admin.php");
} else {
header("Location: ../examiner/examiner.php");
header("Location: ../welcome.php?error=Incorrect Username or password");
}
} else {
header("Location: ../welcome.php?error=Incorrect Username or password");
header("Location: ../welcome.php?error=Incorrect User name or password");
}
} else {
header("Location: ../welcome.php?error=Incorrect User name or password");
$sql = "SELECT * FROM examineruser WHERE username='$username' AND password='$password'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) == 1) {
// the user name must be unique
$row = mysqli_fetch_assoc($result);
if ($row['password'] === $password && $row['role'] == $role) {
$_SESSION['id'] = $row['id'];
$_SESSION['role'] = $row['role'];
$_SESSION['username'] = $row['username'];

header("Location: ../examiner/examiner.php");
} else {
header("Location: ../welcome.php?error=Incorrect Username or password");
}
} else {
header("Location: ../welcome.php?error=Incorrect User name or password");
}
}
}
} else {
Expand Down
Loading

0 comments on commit 1504c8d

Please sign in to comment.