Skip to content

Commit

Permalink
Merge branch 'main' into contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
mahek0620 authored Jun 6, 2024
2 parents 11f33d9 + 120a3bf commit 4db7c65
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 76 deletions.
37 changes: 35 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ git push -u origin <your_branch_name>
Congratulations🎉, you have made a pull request to the Faculty Evaluation System. Wait for your submission to be accepted and merged.


## 💻How to run on your local system
## 💻How to run on your local system and setup database

![record](record.mp4)

![record](record.mp4)

<h2 align = "center">Our Contributors ❤️</h2>
<div align = "center">
Expand All @@ -166,3 +166,36 @@ Thank you for contributing to our project! We appreciate your help in Faculty_Ev
### Show some ❤️ by starring this awesome repository!

</div>

## Database Initialization

1. Firstly, open the folder database

![image](https://github.com/meenakshiiyer2531/Faculty_Evaluation_System/assets/74537549/a3df1ac8-a145-44f8-b095-0b879db60379)

To set up the database, you can download the `evaluation_db.zip` file, which contains the `evaluation_db.sql` file.

[Download evaluation_db.zip](database/evaluation_db.zip)

2. After downloading the SQL file, setup XAMPP

![image](https://github.com/meenakshiiyer2531/Faculty_Evaluation_System/assets/74537549/d3c428ec-2ba9-474f-9e78-4e5a75e0ff4b)

3. Click on `ADMIN` in the MYSQL, then MyPhpAdmin would open up

![image](https://github.com/meenakshiiyer2531/Faculty_Evaluation_System/assets/74537549/a378ffe9-3cbd-4bd1-9f33-91db89d2a8f5)

4. Click on new to create a database with the name `evaluation_db`

![image](https://github.com/meenakshiiyer2531/Faculty_Evaluation_System/assets/74537549/807e3908-ab4e-42e1-9475-b8637fa7717b)

5. Now click on import, where you need to upload the file previously downloaded to setup the database and get all the tables in the database

![image](https://github.com/meenakshiiyer2531/Faculty_Evaluation_System/assets/74537549/e166dbf5-63cf-40a7-aa0d-e39715905e5f)

6. Finally, you could see the tables in the database

![image](https://github.com/meenakshiiyer2531/Faculty_Evaluation_System/assets/74537549/6d57fde5-7c72-43e2-9d08-1a7f39428820)

For more information refer to the video documentation:
[Video](https://drive.google.com/file/d/10mM0y7YKW3bdqq_ltcBM38YxIAF4iP-u/view?usp=sharing)
32 changes: 31 additions & 1 deletion admin_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function __destruct() {
ob_end_flush();
}

function login(){
/*function login(){
extract($_POST);
$type = array("","users","faculty_list","student_list");
$type2 = array("","admin","faculty","student");
Expand All @@ -38,6 +38,36 @@ function login(){
}else{
return 2;
}
}*/

function login()
{
extract($_POST);
$type = array("", "users", "faculty_list", "student_list");
$type2 = array("", "admin", "faculty", "student");
$qry = $this->db->query("SELECT *,concat(firstname,' ',lastname) as name FROM student_list where email = '$email'");
if ($qry->num_rows == 1) {
$row = $qry->fetch_array();
if (password_verify($_POST['password'], $row['password'])) {
foreach ($row as $key => $value) {
if ($key != 'password' && !is_numeric($key))
$_SESSION['login_' . $key] = $value;
}

$_SESSION['login_type'] = $login;
$_SESSION['login_view_folder'] = $type2[$login] . '/';
$academic = $this->db->query("SELECT * FROM academic_list where is_default = 1 ");
if ($academic->num_rows > 0) {
foreach ($academic->fetch_array() as $k => $v) {
if (!is_numeric($k))
$_SESSION['academic'][$k] = $v;
}
}
return 1;
} else
return 'Invalid password';
} else
echo "Invalid email";
}
function logout(){
session_destroy();
Expand Down
Binary file added database/evaluation_db.zip
Binary file not shown.
2 changes: 0 additions & 2 deletions db_connect.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!-- $conn= new mysqli('localhost','root','','evaluation_db')or die("Could not connect to mysql".mysqli_error($con)); -->


<?php
$host = "localhost";
Expand Down
11 changes: 5 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,23 @@
<?php session_start() ?>
<?php
if(!isset($_SESSION['login_id']))

header('location:login.php');
header('location:login.php');
include 'db_connect.php';
ob_start();
ob_start();
if(!isset($_SESSION['system'])){

$system = $conn->query("SELECT * FROM system_settings")->fetch_array();
foreach($system as $k => $v){
$_SESSION['system'][$k] = $v;
}
}
ob_end_flush();

include 'header.php'
?>
<body class="hold-transition sidebar-mini layout-fixed layout-navbar-fixed layout-footer-fixed">
<div class="wrapper">
<?php include 'topbar.php' ?>
<?php include $_SESSION['login_view_folder'].'sidebar.php' ?>
<?php include $_SESSION['login_view_folder'].'sidebar.php' ;
?>

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
Expand Down Expand Up @@ -131,6 +129,7 @@

<!-- Main Footer -->


<b><?php echo $_SESSION['system']['name'] ?></b>
</div>

Expand Down
37 changes: 34 additions & 3 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}
}
$_SESSION['msg']['success'] = "You have logged in successfully.";
header('location: ./');
header("location:index.php?page=home");
exit;
} else {
$error = "Incorrect Email or Password";
Expand Down Expand Up @@ -85,15 +85,15 @@
<?php endif; ?>
<form action="" method="POST" id="login-form">
<div class="input-group mb-3">
<input type="email" class="form-control" name="email" required placeholder="Email">
<input type="email" class="form-control" value="[email protected]" name="email" required placeholder="Email">
<div class="input-group-append">
<div class="input-group-text">
<i class="fa-regular fa-envelope"></i>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="password" class="form-control" name="password" required placeholder="Password">
<input type="password" class="form-control" name="password" value="Pranav@123" required placeholder="Password">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-lock" onclick="togglePasswordVisibility()"></span>
Expand Down Expand Up @@ -128,6 +128,37 @@
</div>
</div>




<script>
$(document).ready(function () {
$('#login-form').submit(function (e) {
e.preventDefault()
start_load()
if ($(this).find('.alert-danger').length > 0)
$(this).find('.alert-danger').remove();
$.ajax({
url: 'ajax.php?action=login',
method: 'POST',
data: $(this).serialize(),
error: err => {
console.log(err)
end_load();
},
success: function (resp) {
if (resp == 1) {
location.href = 'index.php?page=home';
} else {
$('#login-form').prepend('<div class="alert alert-danger">' + resp + '.</div>')
end_load();
}
}
})
})
})
</script>

<script>
function togglePasswordVisibility() {
var passwordInput = document.querySelector('[name="password"]');
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4db7c65

Please sign in to comment.