I Was Here – PHP Student Attendance Management System

 

 

TABLE OF CONTENTS

Download & License Requirements & Installation What Is “I Was Here”?
How To Use For The Developers Common Problems

 

DOWNLOAD & LICENSE

Download I-Was-Here | GitHub | SourceForge

I-Was-Here is released under the MIT License. You are free to use it for your own personal and commercial projects, modify it as you see fit. On the condition that there the software is provided “as-is”. There are no warranties provided and “no strings attached”. Code Boxx and the authors are not liable for any claims, damages, or liabilities.

 

REQUIREMENTS & INSTALLATION

I-Was-Here has not been extensively tested, but it is developed and works on a WAMP8 (Windows Apache MySQL PHP 8) server. Requirements:

  • Apache Mod Rewrite
  • PHP PDO Extension
  • Best to have at least PHP 7

As for the “installation”… There is no installer, but this should be simple enough:

  1. Create a database and import the core/iwashere.sql file.
  2. In core/Core.php, change the database settings (A2), host (A4), and email (A5) to your own.

That’s all. The default user is “admin@iwh.com” and the password is “123456”. Remember to change it later.

 

 

WHAT IS “I WAS HERE”?

I Was Here is a simple, free, and open-source PHP Student Attendance Management System. It may not be the best in the world, but it is at least a complete basic system and should work “out-of-the-box”.

I Was Here is also built using pure HTML, CSS, Javascript, and PHP. It has no dependency on any third-party client-side frameworks such as jQuery, Angular, Bootstrap, or Symfony. This should also help developers to quickly build on – No need to learn any additional frameworks, no added script bloating.

 

HOW TO USE

STEP 1) REGISTER TEACHERS & STUDENTS

First, register the teachers and students under the “Users” tab.

You can add them one-by-one… But the faster way is to mass import a CSV file with the name, email, and password. For example:

Jon Doe jon@doe.com 123456
Jan Doe jan@doe.com 654321
Jay Doe jay@doe.com 2254567

 

STEP 2) REGISTER COURSES

Next, register the available courses under the “Courses” tab.

Same old story, you can do it manually one-by-one, but importing is faster. This time in the order of course code, course name, description. For example:

MATH Basic Math Basic Mathematics course.
ENG Basic English How to ABC.
SCI Basic Science For kids 5-55.

 

 

STEP 3) ASSIGN STUDENTS TO COURSES

With that, we can now assign students to their respective courses.

The painful way is to assign students one-by-one with their email… But you catch the drift, just importing a whole list of emails is faster. Example:

jon@doe.com
jan@doe.com
jay@doe.com

 

STEP 4) REGISTER CLASSES

Now that all the necessary data is in, register the classes.

 

STEP 5) TAKE ATTENDANCE

Lastly, Captain Obvious, take the attendance of the class.

 

 

FOR THE DEVELOPERS

As simple as it may be, going through the entire system is still going to take some time. So instead of “explaining line-by-line”, here is a condensed version of “how to quickly customize and upgrade I-Was-Here”.

 

FOLDER STRUCTURE

  • core/ Holds the libraries and API files.
  • pages/ The HTML pages
  • public/ Javascript, CSS, images, whatever public assets.

Yes, there are only 3 folders in the entire system.

 

DATABASE TABLES

users – The teachers and students.
Field Description
user_id The user ID, primary key, auto-increment.
user_name Name of the user.
user_email Email of the user, unique and does not allow duplicates.
user_role Teacher or Student.
user_password Account password.
courses – The available course.
Field Description
course_code The course code, primary key.
course_name Name of the course.
course_desc A short description of the course.
courses_students – Which student is enrolled in which courses.
Field Description
course_code The course code, primary key.
user_id The user ID, primary key.
classes – Classes conducted.
Field Description
class_id The class ID, primary key, auto-increment.
couse_code The course code.
class_date Date and time of the class.
class_desc Short description of the class.
attendance– Attendance records.
Field Description
class_id The class ID, primary key.
user_id The user ID, primary key.
sign_date Timestamp, when the attendance is taken.

 

 

DEVELOPING “I WAS HERE”

I-Was-Here is actually a variant of Core Boxx. If you want to modify or improve it, it’s a 4 steps process.

STEP 1) CREATE/MODIFY DATABASE TABLES

Add your new tables, modify the existing ones.

 

STEP 2) ADD/UPDATE SYSTEM MODULE

Create a core/LIB-Module.php, define class Module, add functions inside. For example, to add a new report module – Create core/LIB-Report.php.

core/LIB-Report.php
class Report {
  function getStudentAttend ($id) {
    return $this->core->fetchAll(
      "SELECT * FROM `attendence` WHERE `user_id`=? ORDER BY `sign_date` DESC",
      [$id]
    );
  }
}

That’s it. The new module can now be loaded via $_CORE->load("Report") and the new function can be accessed via $_CORE->Report->getStudentAttend().

 

STEP 3) ADD/UPDATE API ENDPOINT (OPTIONAL)

Create core/API-Module.php. For example, core/API-Report.php can be accessed at http://site.com/api/Report. How the API work is simple, we just send a $_POST['req'] OR $_POST['reqS'] OR $_POST['reqT] followed by the required parameters.

  • $_POST['req'] is for open requests, needs no user verification.
  • $_POST['reqS'] for student functions.
  • $_POST['reqT'] for teacher functions.
core/API-Report.php
// (A) TEACHER REQUESTS
$_CORE->load("Report");
if (isset($_POST['reqT'])) { switch ($_POST['reqT']) {
  // (A0) INVALID
  default:
    $_CORE->respond(0, "Invalid request");
    break;
 
  // (A1) GET STUDENT ATTENDANCE
  case "getAttend":
    $records = $_CORE->Report->getStudentAttend($_POST['id']);
    $_CORE->respond(1, "OK", $records);
    break;
}}

That’s all. We can now send $_POST['reqT']="getAttend" and $_POST['id']=123 to http://site.com/api/Report to fetch the report in a JSON-encoded string.

 

STEP 4) ADD/UPDATE HTML CSS JAVASCRIPT

  • Add new pages with pages/PAGE-name.php. For example, pages/PAGE-report.php will be accessed from http://site.com/report.
  • Add new admin pages with pages/ADMIN-name.php. For example, pages/ADMIN-report.php will be accessed from http://site.com/admin/report.
  • Take note – PAGE-name.php can only be accessed by users who are signed in, ADMIN-name.php can only be accessed by teachers.

That’s about it. Just reverse engineer and copy from the existing libraries, API, and pages… You will see the development pattern here.

 

COMMON PROBLEMS & FIXING THEM

I-Was-Here is “not working”? Here are a few of the common problems and how to “fix” them.

 

I FORGOT THE PASSWORD/DELETED ALL ADMIN ACCOUNTS

Create an “account recovery” script to create a new account, or update an existing one.

recover.php
require "core/Core.php";
$_CORE->load("User");
$_CORE->User->save("NAME", "EMAIL", "PASSWORD", "T", OPTIONAL-USER-ID);

Run and delete this afterward…

 

MIGRATED TO A NEW DOMAIN

  • Simply update URL_BASE in core/Core.php.
  • Delete .htaccess, let the system will regenerate a new one.
  • Clear the browser cache to prevent irritating cache redirects.

Done. If you have some extra URL rewrite to add – Go ahead and modify __construct() in core/LIB-Core.php.

 

NOT WORKING. DON’T KNOW WHY.

Update public/common.js section E1 – opt.debug = true. Reload the page and see the error message.

How To Debug Javascript – A Very Simple Guide

How to Debug PHP Code – A Very Simple Guide

4 thoughts on “I Was Here – PHP Student Attendance Management System”

  1. Hi, when I run Iwashere with php -S 127.0.0.1:8000 it works fine but as soon as I upload it redirects to localhost/login and I get a 404 message. I am using 18.04 php ver 7.2.24 Apache2 ver 2.4.29. I cleared the.htaccess file and it didn’t work.

Leave a Comment

Your email address will not be published. Required fields are marked *