I Was Here is a simple, free, and open-source PHP Student Attendance Management System. Not the best in the world, but it will help small schools to get started quickly without all the hassle.
TABLE OF CONTENTS
DOWNLOAD & NOTES
First, here are the download links and a quick “setup guide” for the impatient folks who don’t have the patience to read through everything.
REQUIREMENTS
- Apache Mod Rewrite
- PHP MYSQL PDO Extension
- Best to have at least PHP 8.0
- “Grade A” browser
I-Was-Here has not been extensively tested, but it is developed and works on a WAMP8 (Windows Apache MySQL PHP 8) server.
INSTALLATION
Just access index.php
in your browser and walk through the installer.
LICENSE & DOWNLOAD
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.
Download I-Was-Here | GitHub | SourceForge
HOW TO USE
So far so good? Let us now go through a quick crash course on how to use I Was Here.
STEP 1) REGISTER TEACHERS & STUDENTS
1A) ADDING USERS
Access the “Users” tab. Simply click on the “Add” or “Import” button to create new users.
1B) IMPORTING USERS
Of course, it will be a pain to do that for hundreds of teachers and students, so use the import feature to quickly add/update users. Just create a CSV file with 4 columns – Name, email, role, password. The role must be Admin, Teacher, Student, or Inactive.
STEP 2) REGISTER COURSES
Next, register your available courses under the “Courses” tab.
STEP 3) ASSIGN STUDENTS TO COURSES
3A) ADDING STUDENTS
Once again, you can either add students into a course one-by-one or import them.
3B) IMPORT CSV
The smarter way is to create a single-column CSV file with the email and import it.
STEP 4) REGISTER CLASSES
Now that all the necessary data is in, register the classes.
STEP 5) TAKE ATTENDANCE
Lastly, teachers only need to log in and select the appropriate class in the portal – Take the attendance.
QUICK REFERENCE
This section is for the developers, a quick walkthrough of the general system structures.
FOLDER STRUCTURE
api/
The API endpoint.assets/
Public images, Javascript, CSS, etc…lib/
Core engine and library files.pages/
HTML pages.
Yes, there are only 4 folders in the entire system.
DATABASE TABLES
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 | Admin, Teacher, Student, Inactive. |
user_password | Account password. |
Field | Description |
course_id | Cours ID, primary key and auto-increment. |
course_code | The course code, unique. |
course_name | Name of the course. |
course_desc | A short description of the course. |
course_start | Course start date. |
course_end | Course end date. |
Field | Description |
course_id | The course id, primary key. |
user_id | The user ID, primary key. |
Field | Description |
class_id | The class ID, primary key, auto-increment. |
user_id | User ID, teacher-in-charge. |
couse_id | Course ID. |
class_date | Date and time of the class. |
class_desc | Short description of the class. |
Field | Description |
class_id | The class ID, primary key. |
user_id | The user ID, primary key. |
couse_id | Course ID. |
sign_date | Timestamp, when the attendance is taken. |
Field | Description |
user_id | The user ID, primary and foreign key. |
reset_hash | Random security hash. |
reset_time | The time when the request is made. |
THE FRAMEWORKS
I Was Here is built with Bootstrap and Core Boxx. Believe it or not, the initial version is built within 48 man-hours using:
Go ahead and check those out if you want… The other “pre-developed” modules of Core Boxx should also snap right in.
DEVELOPING “I WAS HERE”
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”.
STEP 1) CREATE/MODIFY DATABASE TABLES
Add your new tables or views, modify the existing ones.
STEP 2) ADD/UPDATE SYSTEM MODULE
class Report extends Core {
function getStudentAttend ($id) {
return $this->DB->fetchAll(
"SELECT * FROM `attendence` WHERE `user_id`=? ORDER BY `sign_date` DESC",
[$id]
);
}
}
To add a new module, create lib/LIB-Module.php
. Define class Module extends Core
, and add functions inside. In this example, we add a new report module – lib/LIB-Report.php
and class Report extends Core
.
That’s all. This new module can now be loaded via $_CORE->load("Report")
and the function can be accessed via $_CORE->Report->getStudentAttend()
.
STEP 3) ADD/UPDATE API ENDPOINT (OPTIONAL)
// (A) ADMIN ONLY
if (!isset($_SESS["user"]) || $_SESS["user"]["user_role"]!="A") {
$_CORE->respond("E", "No permission or session expired", null, null, 403);
}
switch ($_REQ) {
// (B) INVALID REQUEST
default:
$_CORE->respond(0, "Invalid request", null, null, 400);
break;
// (B) GET STUDENT ATTENDANCE
case "getStudentAttend":
$_CORE->autoGETAPI("Reports", "getStudentAttend");
break;
}}
Create api/API-Module.php
. For this example, send $_POST["id"]=123
to http://site.com/Report/getStudentAttend/
to get the student report – The API will reply with a JSON encoded string.
STEP 4) ADD/UPDATE HTML CSS JAVASCRIPT
- Add your new pages in
pages/
.- For admin pages, add
pages/ADMIN-name.php
. - For teacher pages, add
pages/TEACHER-name.php
. - For student pages, add
pages/STUDENT-name.php
. - For example,
pages/ADMIN-report.php
can only be accessed by administrators fromhttp://site.com/report
.
- For admin pages, add
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 OR DELETED ALL ADMIN ACCOUNTS
require "lib/CORE-go.php";
$_CORE->load("Users");
$_CORE->Users->save("NAME", "EMAIL", "A", "PASSWORD", OPTIONAL-USER-ID);
Just create an “account recovery” script to create a new account (or update an existing one). Run and delete this afterward.
MIGRATED TO A NEW DOMAIN
- Simply update
HOST_BASE
inlib/CORE-config.php
. - Run
$_CORE->Route->init()
to regenerate the.htaccess
andapi/.htaccess
files. - Clear the browser cache to prevent irritating cache redirects.
UPGRADING
- If your existing copy has an
options
table – Just override all the files and accessindex.php
. The installer will take care of database updates (if any). - If not – Manually import the
options
table fromSQL-iwashere.sql
, create aIWN_VER
entry with a value of0
and group0
. Thereafter, just copy the new files and let the installer do the magic.
MANUAL INSTALLATION
- Create a database and import
lib/SQL-iwashere.sql
. - Open
lib/CORE-config.php
, update the settings to your own.- The host settings.
- Database settings.
- If you want to develop mobile apps, consider enabling CORS.
- Generate your own JWT secret key, set the issuer to your domain or company name.
- Set the email “sent from”.
- Run
$_CORE->Route->init()
to create.htaccess
andapi/.htaccess
. - Create your own admin user. See “forgot password” above.
- Rename
lib/INSTALL-index.foo
toindex.php
.
NOT WORKING. DON’T KNOW WHY.
Open the developer’s console, reload the page and see the error message.
can you help me to send sms or emails to the absents?
If we have the phone #, email, and status of the attendance, this shouldn’t be a problem, right?
Yes, you can send notifications to absentees.
https://code-boxx.com/faq/#help – “I don’t work for free”.
its really great work and a very good job
thanks a lot
but I face a problem
it show a massige
” Unable to create database – SQLSTATE[HY000]: General error: 1007 Can’t create database ‘iwashere’; database exists”
please guide me
thanks again
If it is a new installation, just delete the database and reinstall. Also, redownload the latest build. It should be easier for updates in the future.
Helllo , I have error 404 only on export attendance as csv. The remain function already works. Can yo have suggestions ? Thanks in advances.
Can provide me example api call for register attendance of a student ? Thanks in advances.
1) Not getting 404 on my test server. The export CSV points to
http://YOUR-SITE.COM/admin/export-attend
and resolves topages/ADMIN-export-attend.php
as intended.2) Page updated, see reference above.
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.
As above – Update setting, delete htaccess, clear browser cache.
iwashere.sql error excute
https://code-boxx.com/faq/#notwork
https://code-boxx.com/import-sql-file-in-mysql/