Attendance and Payroll System using PHP/MySQLi Source Code


This is a simple Attendance and Payroll System using PHP and MySQLi-OOP as DB driver. It has attendance on the client-side and payroll on the admin side. This system is written in pure PHP with no framework so it is understandable to beginners.

*Submitted: 02-2-18

*Last Updated: 12-01-20 (tested in PHP version 7.2.33)


  • CRUD - Employee Attendance
  • CRUD - Employee
  • Employee Cash Advance
  • Employee Overtime
  • Employee Schedule
  • Payroll on Date Range
  • Payslip on Date Range


  • AdminLTE
  • TCPDF library


  1. Download the source code using the Download button below.
  2. Extract the downloaded file to your localhost folder ex. htdocs for XAMMP.
  3. Import the included .sql file which is the database of the system. If you have no idea how to import, please refer to my tutorial on How import .sql file to restore MySQL database.
  4. After a successful import, open the extracted folder and open conn.php in both the root folder and in admin/includes folder. Edit the database name in the connection depending on the name of database you created in importing the included .sql file.

Accessing the Admin

You can access the admin side by adding /admin/. You should be able to navigate to the admin login page.

You can then use the below admin credential:

Username: nurhodelta

Password: password

That's it. You should now be able to run the simple system :)

Installation and System Feature Demo Video

If you have any suggestions, comments, or reactions, feel free to comment below or message me.

Happy Coding :)

*Updates: 05-21-18

  1. Fixed dynamic buttons (edit, delete, etc ) not functioning on page2 or more of the table.
  2. Fixed time in showing late even on time.

*Updates: 12-1-20

  1. Fixed dynamic buttons (edit, delete, etc ) on page2 or more of the table.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Submitted bybelal111 (not verified)on Mon, 05/14/2018 - 03:30

Field 'status' doesn't have a default value
Submitted byKul joseph (not verified)on Mon, 05/14/2018 - 20:59

Hi. I downloaded and wanted to explore this system but i cant login as admin..i used username and pswd in the database and even tried changing several times but it keeps saying incorrect pswd on the admin login page. Pls help
Submitted byCjkwani (not verified)on Sat, 05/19/2018 - 05:01

Hi there. After adding employees or positions and even the attendance..after going to the next page..the edit and delete buttons dont work from the second page. Kindly advise

Just change the button for edit and delete.. For edit: $(document).on('click', '.edit', function(e){ e.preventDefault(); ///the codes here }); For delete $(document).on('click', '.delete', function(e){ e.preventDefault(); ///the codes here }); Same goes for other dynamic buttons
Submitted byCjkwani (not verified)on Mon, 05/21/2018 - 02:51

Hey. Thanks so much, your earlier feedback worked perfectly for the edit and delete buttons. What should i do about the employee sign in..its now not working or submiting emp id. Ua help will be appreciated.
Submitted byCkmwani (not verified)on Tue, 05/22/2018 - 16:02

Hi. When i make changes say with the edit and delete buttons from page 2 onwards, the page always reloads to the first page. How can i make it to remain on the current page after changes. Thank u
Submitted byKul josephon Wed, 05/23/2018 - 04:23

Hi. The system doesnt record overtime unless i add it manually. Can it reflect automatically? Pls advise
Submitted byJames K (not verified)on Sat, 05/26/2018 - 22:03

How can i change the index/login page background color(currently grey-ish) to cover image and which file do i need to go to. Regards
Submitted byCjqwan (not verified)on Sun, 06/03/2018 - 18:08

Hello. I would like for the employee to be able to login using employee_id and passwd. Employee would be able to view his/her details e.g, attendance records of himself/herself,deductions, cash advance,schedule and position. How do i address this pls help
Submitted byShinsuke (not verified)on Wed, 06/13/2018 - 12:53

This system is useless without user mode, I suggest that when the user is login it will only see his/ her information.
Submitted byC.K. Patrick (not verified)on Sun, 06/24/2018 - 22:15

How would i change the background image of the index pages. Please help. Great system by the way.
Submitted byNorshami (not verified)on Wed, 09/05/2018 - 15:10

Fatal error: Call to undefined function password_verify() in C:\wamp\www\Downloaded Projects\apsystem_0\apsystem\admin\login.php on line 17 Call Stack # Time Memory Function Location 1 0.0000 147984 {main}( ) ..\login.php:0
Submitted byusman123 (not verified)on Tue, 10/30/2018 - 20:00

In reply to by Norshami (not verified)

Fatal error: Call to undefined function password_verify() in C:\wamp\www\Downloaded Projects\apsystem_0\apsystem\admin\login.php on line 17 I am also facing this error
Submitted byAbraham kibet (not verified)on Mon, 11/12/2018 - 15:17

hi,kindly help me with the full documentation of this project.
Submitted byGokila (not verified)on Fri, 02/15/2019 - 16:25

Hi, i ran the code in wamp server but the page it viewed is only the employee login asking only two fields time-in or time-out and employee id.when i clicked on the sign-in option it showed "Time - in: 'and the name'" nothing else happened .So what should i have to do to run this project........ pls reply me....
Submitted byBashir Babatun… (not verified)on Tue, 02/19/2019 - 17:29

This is the error i get wen logging in as an administrator pls help Fatal error: Call to undefined function password_verify() in C:\wamp\www\apsystem\admin\login.php on line 17
Submitted byenadrahc (not verified)on Wed, 03/13/2019 - 13:59

In reply to by Bashir Babatun… (not verified)

Use Php version 5.5.0 to avoid the problem

great information i received on this site.
Submitted byMonthon (not verified)on Mon, 04/15/2019 - 23:06

Thank you for the best source code. How to set width for modal?
Submitted bySaifuzaman (not verified)on Mon, 05/13/2019 - 13:28

How do I make the punch in and out details shown in same page as punch page? So, user can see their punch in and out details on the spot. It is like the punch section on the top of page and the details at the bottom of page.
Submitted byPath path (not verified)on Sun, 05/19/2019 - 23:03

Hi, how can i run this source code? where? can you help me?
Submitted byEliam (not verified)on Tue, 11/15/2022 - 19:28

In reply to by Path path (not verified)

Have xammp installed on your machine After you unzip the file, go to C drive Open xammp file, scroll down to htdc Pu the files you downloaded in that folder Open your browser. Type Create database and name it after the name given from the database provided. Import database from the folder located in htdocs. Thus it You can now simply point the browser to the url/path of the app
Submitted byManoj Perera (not verified)on Sat, 07/13/2019 - 10:43

Hi neovic, I was eager to learn PHP dashboard concept but all tutorials i followed were not this much elaborated. It's very rare to find very good hearts like you in this world and I am taking this opportunity to thank you and may triple gems bless you and your family. Please do send me your email to [email protected] With Best Regards, Manoj Perera

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in C:\xampp\htdocs\apsystem_0\apsystem\tcpdf\tcpdf.php on line 17778 TCPDF ERROR: Some data has already been output, can't send PDF file
Submitted byWebDesignCritic (not verified)on Mon, 08/26/2019 - 01:21

How can the system calculate the overtime
Submitted byAnonymous (not verified)on Tue, 05/19/2020 - 14:46

Hi, When I Customized the html modal form and the length of the script is to long. When I clicked the value button of modal it doesn't show but when removed temporarily the other includes php modals html script it show the modal form
Submitted byJames12333 (not verified)on Fri, 06/18/2021 - 22:17

Hi I encountered error when i tried to print Payslip, hoping for your positive feedback. Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in D:\SkyLeigH\htdocs\apsystem\tcpdf\tcpdf.php on line 17778 Warning: chr() expects parameter 1 to be int, string given in D:\SkyLeigH\htdocs\apsystem\tcpdf\include\tcpdf_fonts.php on line 1671 TCPDF ERROR: Some data has already been output, can't send PDF file
Submitted byMaihes (not verified)on Sun, 02/06/2022 - 03:38

Hello, i hope someone still watches the comments here. When i try to log in as admin using the credentials offered here i get "Connection failed: Connection timed out" all the time, what could be the issue?
Submitted byYash Dev (not verified)on Sat, 06/18/2022 - 13:28

Sir, I had uploaded this System on my server, everything is working good but the 2 things I am facing that, the system is taking check-in time Wrong, and automatically taking checkout time, please fix this asap, I want to use this system in my office for employees
Submitted byDen Den (not verified)on Wed, 10/19/2022 - 09:26

Hi can you help me how to fix on time and late not showing? thank you

<strong><h4>Manupilate the entire  document through this method</h4></strong>
<strong>1 </strong>Open the employee.php file using any text editor.
<strong>2</strong> Change the script inside the function

<strong>instead of getting one page</strong>
    var id = $(this).data('id');

<strong>Use the document query js.
</strong> $(document).on('click', '.edit', function(e){
    var id = $(this).data('id');

Add new comment