+ All Categories
Home > Documents > NFC_graduated _book_2016.PDF

NFC_graduated _book_2016.PDF

Date post: 12-Feb-2017
Category:
Upload: asmaa-ramadan
View: 28 times
Download: 2 times
Share this document with a friend
79
FACULTY OF ENGINEERING ALEXANDRIA UNIVERSITY COMMUNICATION AND ELECTRONICS DEPARTMENT NEAR FIELD COMMUNICATION APPLICATIONS -NFC- Supervisor Prof.Dr. M.Amr Mokhtar
Transcript
Page 1: NFC_graduated _book_2016.PDF

FACULTY OF ENGINEERING

ALEXANDRIA UNIVERSITY

COMMUNICATION AND ELECTRONICS DEPARTMENT

NEAR FIELD COMMUNICATION APPLICATIONS

-NFC-

Supervisor Prof.Dr. M.Amr Mokhtar

Page 2: NFC_graduated _book_2016.PDF

Team Members

1- Asmaa El-Sayed Ibrahim Ramadan.

2- Asmaa Ramadan Sayed.

3- Radwa Alaa Salah El-Sawy.

4- Ghada Khamis Mohamed Masoud Tailon.

5- Maisa Mohamed El-Sayed Taher.

6- Maha Mohamed Ghanem.

7- Mai Mohamed El-Sayed Mohamed Osman.

8- Neamat Abdollah Morsi Mohamed.

9- Hebatullah Ahmed Abd El-lattif Ahmed Akel.

10- Heba Mamdouh Ali Shehata.

Page 3: NFC_graduated _book_2016.PDF

3 Chapter Three-PHP Forms and Codes

Contents

1- Chapter 1- Near Field Communication Overview ………………………… page (3) 2- Chapter 2- Overview on NFC System ………………………….…………..page (3) i.

ii.

3- Chapter 3- PHP Forms and Codes …………..………………………….… page (4) i.

4 – Chapter 4- Android Applications………………………………………… page (4) i.

ii.

iii.

5- Chapter 5- NFC Hardware……………………………………………… page (5)

i.

ii.

6- References …………………… ……………………………………… page (8) i.

ii.

Page 4: NFC_graduated _book_2016.PDF

4 Chapter Three-PHP Forms and Codes

1 Near Field Communication Overview

WHAT’S IN THIS CHAPTER?

Student android application. How student can record his/her attendance using app. Features included in students’ app. Professor android application. Why there is app for professors. Features included in professors’ application.

In this chapter, we can connect the previous chapters together and see how we can make a full system of attendance and with other features we talk about before in only one application included in student smart phone which support NFC technology. To use our application, make sure that your mobile phone support NFC technology, Google Play Services and is connected to internet. We have two types of mobile applications

Scan NFC Tag

Page 5: NFC_graduated _book_2016.PDF

5 Chapter Three-PHP Forms and Codes

2 Overview on NFC System WHAT’S IN THIS CHAPTER?

NFC system components. Block-Diagram for the whole system. Attendance system components. Other systems component.

In this chapter, it describes a complete NFC system in detail which can be implemented in many universities. For this project, we shall take our own university, Faculty of Engineering – Alexandria University as the subject. We will let you have an overview about the whole system and what should do and we will provide a map to let you know how android will connect to server.

Scan NFC Tag

Page 6: NFC_graduated _book_2016.PDF

6 Chapter Three-PHP Forms and Codes

2.1- Target

The main target of our project is creating a complete system for any university to record the attendance and absence of their students using NFC technology and without the usage of traditional method such as written students names in papers then calling their names to be sure they really attend and so on. We abbreviated all these steps by using NFC technology to record students’ attendance.

2.2- Methodology

There are several ideas in how NFC technology used, some can use it to support a watch by including dummy NFC tag or using an NFC tag as shown in figure 2.2.1 in both cases data is written on NFC tag; with this tag an NFC module or NFC reader is used to be used to send data to server. This method may be sufficient but still has a problem which is that you should hold with you several cards or tags to deal with different applications where each one needs different data. So we decided to have the most benefit of our phones by using them in right way by making an android app include all previous mentioned NFC applications all in one android application and with the something which we daily use. Thus our system requires availability of mobile phone support NFC and Wi-Fi network or 3G to let the student connect to server and hence to database. Android applications will be responsible to connect to server and send data to PHP. The students will be equipped with an NFC enabled smart-phone. The mobile application development will be done using the Google Android platform.

FIGURE 2.2.1, NFC watch.

Figure 2.2.2 shows a pictorial summary of our system. As shown in figure 2.2.2 we have four main applications based on NFC technology attendance, library and department news and finally Grades. Whole system has the same concept we can summarize it in the following steps :

1- NFC phone should read a specific tag. 2- Tag has three different cases

Blank tag: contains dummy data. Action: read data from tag then display.

URL Tag: contains URL Action: Open URL using web-browser.

Key-word tag: contains a specific word. Action: when this word is read, let android connect to server.

Page 7: NFC_graduated _book_2016.PDF

7 Chapter Three-PHP Forms and Codes

3-In case of key-word tag android should connect to server.

Send data to PHP file which includes the procedures should done with sent data.

Connect PHP file to server which involves databases using Wi-Fi or 3G.

Get the data from databases if required.

Send results to android.

As shown from previous points PHP works as a link between android and database. Figure 2.2.2 shows an overview of the automated attendance system and the steps should be taken to record attendance or use any NFC-based application using android app.

FIGURE 2.2.2, a pictorial summary of our system.

FIGURE 2.2.2, Overview of the automated attendance system.

Page 8: NFC_graduated _book_2016.PDF

8 Chapter Three-PHP Forms and Codes

Other features are included in app to support the attendance system such as reserve appointment with the instructors, display the schedule, display the days of attendance and more which will be discussed in next chapters. Also an app for instructor is created with several features and application support NFC technology. For students who have not mobile phones support NFC technology we go to the original solution by using NFC or RFID card for more details you can follow chapter four.

3 PHP Forms and Codes WHAT’S IN THIS CHAPTER?

PHP forms and codes for attendance system. Illustrating PHP code for recording attendance. PHP forms and codes for library system. PHP forms and codes for department news system. PHP forms and codes for student degrees system. PHP forms and codes for office-hours system.

In this chapter, we will focus on PHP part to achieve attendance systems and other systems we have. We will give you in details what the aim of each PHP form or code, how it works, some steps to achieve it and so on. We also will provide you with little details from some codes to illustrate some points in case it needs. So, let us take the round now.

Scan NFC Tag

Page 9: NFC_graduated _book_2016.PDF

9 Chapter Three-PHP Forms and Codes

1 - ATTENDANCE SYSTEM If you want to record students’ attendance, you have several steps to follow, thus you can record the attendance successfully. You should have the students’ data at least their IDs, departments and academic years. You also should have their lectures’ schedule, their selective subjects (in case of optional one) and so on. At first of all, a database for all academic year in each department will be created manually with a password. The colleague or the university will be responsible for all this databases. We used a Free Web Hosting with PHP, MySQL and cPanel thus we can create databases and upload the PHP codes. Figure 3.1.1 shows one of the databases created for fourth year in Communications and Electronics department. A number is assigned to database name then underscore then the first three letters of department name and finally the first two letters of academic year name. This number is constant for each MySQL user.

FIGURE 3.1.1, Communications and Electronics department database.

FIGURE 3.1.2, tables included in u643857445_comfo database.

The databases for each academic year have a constant tables inserted in. They are created in database using PHP forms which we will explain later . The data inside some table differs from academic year to another. These tables are important to complete recording attendance as we said before. These tables are the following:

1- Student date with table name in database (student_data)

Table includes the whole information for each student such as student name, student ID, mobile number, email, address, department, academic year and selective subjects. Figure 3.1.3 shows the content of “student_data”

table. You can notice that, there is a “Reg_id” column which refers to Registration ID. We will talk about it later in

chapter 4.

Page 10: NFC_graduated _book_2016.PDF

10 Chapter Three-PHP Forms and Codes

FIGURE 3.1.3, table for students’ information.

2 - Day intervals with table name in database (intervals)

Table includes intervals for each day and when they commerce and finish.

FIGURE 3.1.4, daily intervals in faculty of Engineering.

3 - Lectures schedule with table name in database (schedule)

Table includes the lectures, sections and labs for each section.

FIGURE 3.1.5, lectures schedule.

4 - Lecture hall with table name in database (lecture_hall)

Page 11: NFC_graduated _book_2016.PDF

11 Chapter Three-PHP Forms and Codes

Table includes the places where lectures, sections and labs will be hold.

FIGURE 3.1.5, lecture halls.

3.1.1 - Students Data

The first step is inserting the students’ data for each academic year in each department. By opening the link for students data form, you can get four different options as shown in figure 3.2.1.

FIGURE 3.2.1, students’ data form.

1- Enter student information:

By pressing this button, you will direct to the page as shown in figure 3.2.2. Through this page you can insert the whole information for each student.

Page 12: NFC_graduated _book_2016.PDF

12 Chapter Three-PHP Forms and Codes

FIGURE 3.2.2, insert students’ information.

After inserting all required fields and press submit, data will be saved in database and all inserted data will be printed out on screen to let user check the data he/she inserted. Figure 3.2.3 shows the printed out date where figure 3.2.4 shows the saved information in database.

FIGURE 3.2.3, the printed out date.

FIGURE 3.2.4, the saved information in database.

Page 13: NFC_graduated _book_2016.PDF

13 Chapter Three-PHP Forms and Codes

Department and academic year is used to connect to database as mentioned before. For the first time to insert the first student into database a “student_data” table will be created. In case of user insert ID was inserted before,

user will get this message “This ID already exists.” or “an e-mail already exists” in case of e-mail inserted for two student , thus inserted data will not be saved in student data table . As we know student ID and e-mail is unique.

2 – Display Information of all students

In this section, user can display all students’ data by selecting the department and academic year and then press submit as shown in figure 3.2.5. User will connect to database whose name is related to the inserted department and academic year. As shown in figure 3.2.6 printed out the students information saved in database.

FIGURE 3.2.5, display students information.

Page 14: NFC_graduated _book_2016.PDF

14 Chapter Three-PHP Forms and Codes

FIGURE 3.2.6, printed out the students’ information saved in database.

3 - Information for one student

By pressing this button, you can insert ID you want and then get all the information related to this ID as shown in figure 3.2.7.

FIGURE 3.2.7, display information of only one student.

Page 15: NFC_graduated _book_2016.PDF

15 Chapter Three-PHP Forms and Codes

4 - Update Student's Data

By pressing this button and select the department and academic year then pressing submit following by next , user will get a menu like shown below which contain all students names existed in “students_data” table . User can

select any name to update her/his information. The old data will display in the text boxes of form as shown in figure 3.2.8b , thus user can easily update what he/she want and let the other data same as before . By pressing update, the user will get this message “Data Updated Successfully”.

FIGURE 3.2.8a, update student information.

FIGURE 3.2.8b, update student information.

The last name was chosen and the data successfully updated as shown in figure 3.2.9.

FIGURE 3.2.8b, information is updated in database.

Page 16: NFC_graduated _book_2016.PDF

16 Chapter Three-PHP Forms and Codes

3.1.2 - Subjects for Each Department

Now, user should insert elective and non-elective subjects for each department. Later, we will know the benefit of this part in lectures’ schedule, recording attendance and inserting students’ degrees. At first, user should select department, academic year and semester. Because number of elective subjects differ from department and academic year to another, number of subjects (non- elective one) and number of elective subjects are also required to insert as shown in figure 3.3.1. Depending on the inserted number of elective subjects, user will be asked to insert number of included subjects in each elective subject as shown in figure 3.3.2. By pressing “Submit” followed by “Next”, a form to insert subjects’ names will appear.

FIGURE 3.3.1, elective and non-elective subjects insertion.

FIGURE 3.3.2, inserting number of options in each elective subject.

As shown in figure 3.3.3, the dynamic form appeared and user should now insert the subjects for this department and academic year. In database, a table will be created which includes the department, academic year, semester and its subjects separated by “/”.

FIGURE 3.3.3, dynamic form.

Page 17: NFC_graduated _book_2016.PDF

17 Chapter Three-PHP Forms and Codes

Due to each department and academic year has not the same number of elective subjects, the created table is also dynamic. For example third year of Communication and Electronics department has only one elective subject in second semester, where the first semester has no any elective subjects.

3.1.3 - Elective subjects For Each Student

Now , we will register the elective subjects for each student included in database, the original step is selecting department and academic year , here we need also to select semester thus we can determine the elective subjects related to that department and academic year. Figure 3.4.1 shows that.

FIGURE 3.4.1, registering students for elective subjects form.

If one of these fields is empty, user will get the following message "You must enter all required

information ". Through code, we check if there are elective subjects for selected department, academic year and

semester or not, by using the table created in previous section “Subjects for Each Department”. Here, we have three cases after pressing “Enter” button:

1. In case of department does not exist, user will get the following message “There is no elective

subject for this department”.

2. In case of academic year does not exist in, user will get the following message “There is no

elective subject for this academic year”.

3. In case of semester does not exist, user will get the following message “There is no elective

subject for this term”.

Now the page shown below in figure 3.4.2 will appear to register the elective subjects for any student by inserting ID. Number of spinners or subjects depends on number of elective subjects retrieved from table in database.

FIGURE 3.4.2, registering students for elective subjects.

Page 18: NFC_graduated _book_2016.PDF

18 Chapter Three-PHP Forms and Codes

By pressing “save” button, we check if inserted ID exists or not. If it does not exist, this message will display “Your

ID is not correct”. When inserted ID exists, user selections will be saved into “student_data” table - we have

referred to before - , to a column called “Optional_subjects”.

3.1.4 - Lectures Schedule

The second step after inserting the students’ data is inserting the schedule for each department. When you open the form of schedule, you will get four different options Intervals Time, Insert Schedule, Display Schedule and Update Schedule as shown in figure 3.5.1.

FIGURE 3.5.1, lectures schedule form. 1- Intervals Time

This tap is used to insert the number of intervals during scholar day and specify the start and the end time of each interval and also the duration of each interval. It should be inserted for a once at least at the beginning of semester. The benefit of this part will be appeared later when we reach record attendance part. By pressing this button, user will be asked to insert the number of intervals then pressing submit followed by next as shown in figure 3.5.2. This number will be saved in a “session” of PHP then will be used in creating a form with number of intervals inserted, thus user can select the start and the end of each interval.

FIGURE 3.5.2, intervals time.

Page 19: NFC_graduated _book_2016.PDF

19 Chapter Three-PHP Forms and Codes

After inserting all fields and pressing “submit” button, a table called “intervals” will be created in each database for later usages in recording attendance part. Figure 3.5.3 shows how the interval times inserted.

FIGURE 3.5.3, inserting of intervals time.

2 - Insert Schedule

By pressing this button, user will be asked to insert department, academic year and number of sections as shown in figure 3.5.4. The usage of department and academic year is connecting to the database as mentioned before. Two tables “schedule” and “lecture_hall” will be created by pressing “Submit” button which consist of eight columns

with the name of sections e.g. “Section1 , Section2 and so on” .

FIGURE 3.5.4, inserting number of sections.

By pressing “Next” button a form of 8 sections will appears as shown in figure 3.5.5. You can select interval, insert

lecture, section or lab and specify if they are taken every week or not, the place where they will be hold in. From the previous tap “Intervals Time”, we can get the number of inserted intervals, thus a spinner is created with all days and intervals as shown in figure 3.5.6.

Page 20: NFC_graduated _book_2016.PDF

20 Chapter Three-PHP Forms and Codes

FIGURE 3.5.5, inserting contents of schedule.

FIGURE 3.5.6, days and intervals.

You have the option to insert two or more sections, lectures or labs which are hold at the same interval .In sample way, you can insert number of added sections, lectures or labs which will be hold on the same intervals and press its corresponding button – in this example is Insert 1 –, a new added text boxes will be insert instead of the notified statement .To make changes in the same form without reload , you just need to use AJAX in PHP. Figures 3.5.7 and 3.5.8 show the previous steps.

FIGURE 3.5.7 shows the inserted text boxes instead of the notified statement.

Page 21: NFC_graduated _book_2016.PDF

21 Chapter Three-PHP Forms and Codes

FIGURE 3.5.8 shows the notified statement before inserting.

Then user can press “submit” button , then all what he/she inserts will be saved successfully in database in

“schedule” table in case of inserting the name of Lectures, sections or labs, where their places will be saved in another table called “lecture_hall” . These two tables are created for only one time in each database. Figures

3.5.9 and 3.5.10 show the schedule and lectures halls tables in database respectively. You can notice that, the user does not write the name of subject it text box Section 1 or Section 2 and so on. To make sure all insertions by users are the same and then there will not be any error in overall system, we prevent user from inserting the subjects’ names manually such as “Subjects for Each Department”. Note in case of “Subjects for Each Department” was the first time to insert the subjects’ names. By using department and academic year inserted in figure 3.5.4, we can retrieve all subjects for this academic year (elective and non-elective one) from previous part “Subjects for Each Department” and display them in a spinner. From here, user can not insert schedule before inserting subjects for each department.

FIGURE 3.5.9 shows schedule table in database.

FIGURE 3.5.10 shows lectures hall table in database.

Page 22: NFC_graduated _book_2016.PDF

22 Chapter Three-PHP Forms and Codes

In more details, we will have a look on how data will be inserted in tables of database. Figure 3.5.11 shows the main three spinners, the user should select a choice from each one.

FIGURE 3.5.11 shows the main three spinners.

Although the user selects a specific choice, in database another thing will be record. Table 3.5.1 shows what would be recorded in database. Figures 3.5.12a and 3.5.12b illustrate the inputs by user and the inserted data in database.

Form Database

Lecture lec

Section sec

Laboratory lab

Non Optional --

Optional optional

Every Week EW

Every two week * TABLE 3.5.1 shows the key in PHP form and its corresponding word inserted in database.

Note : „--‟ means nothing in database .

FIGURE 3.5.12a shows the inputs by user.

FIGURE 3.5.12b shows saved data in database.

There are some restrictions on user during inserting the schedule as it is considered non-logical cases.

If interval does not selected, a notified message will be display “Please Select an Interval”.

Two optional subjects at the same place every week cannot be inserted.

Two non-optional subjects at the same place every week cannot be inserted.

Two subjects at the same place every week cannot be inserted.

Page 23: NFC_graduated _book_2016.PDF

23 Chapter Three-PHP Forms and Codes

3- Show Schedule

The same as before your first step is selecting the department and academic year as shown in figure 3.5.13.

Thus user can connect to database which we want to display its schedule in details and then press “Submit”

button to display the schedule on screen. Figure 3.5.14 shows a part of displayed schedule.

FIGURE 3.5.13, selecting department and academic year.

FIGURE 3.5.14 shows a part of displayed schedule.

4- Update Schedule

To facilitate on user while dealing with inserting schedule, we add a feature for update. In case of user want to

update an interval for a specific section, user can use this tap. After selecting department and academic year

and pressing “Submit” similar to figure 3.5.13, user can get a notified message indicate that his/her selections

successfully submitted, the user can press Next to continue. Now user can find new collections to select from;

the interval needed for updating and the section number as well.

FIGURE 3.5.15, interval and section needed to update.

Page 24: NFC_graduated _book_2016.PDF

24 Chapter Three-PHP Forms and Codes

In a while after pressing “Submit” then “Continue”, user could find one of the following message which is

related to the updated interval empty or not. In the case of not empty, user will get the following message

shown in figure 3.5.16a; where if empty interval, user will get the message in figure 3.5.16b.

FIGURE 3.5.16a, message appears in case of non-empty interval.

FIGURE 3.5.16b, message appears in case of empty interval.

Then user could continue inserting the new updates easily. Same as previous, user could insert multiple of

choices at the same interval for any selected section as shown in figure 3.5.17. After inserting all needed

updates and by pressing “Submit”, all new updates will be saved successfully.

FIGURE 3.5.17; update a specific interval for a specific section.

3.1.5 - Record Attendance

Now, we reach to the main part of our system “Recording Students Attendance”, after we finished all

previous parts, we can record attendance easily now. Any academic year for any department has a database

contain tables for students’ data, schedule, lectures halls and lecture intervals, as we mentioned before. Now

we are going to illustrate the record attendance system. In order to take attendance of students to a specific

lecture, we should determine the time that students enter the lecture hall or in another word the time they

access to database. We should also determine which lecture, section or lab that students have to attend at this

time, finally we record in database the attendance of students. This process is done individually for each

student scan a tag with his/her smart phone supported with NFC technology, we will talk more on this point

later. PHP code receives student’s information (ID, department and academic year) from his/her students’

android application installed on their smart phones. This information saved in PHP code as variables for later

usages. To record student attendance, student should scan a tag by his/her android application. Tag is existed

in the lecture hall where his/her lecture should be hold, which contains the name of lecture hall. The PHP will

receive the name of lecture hall and define it as a variable to check if student attend at the correct lecture hall

or not. Figure 3.1.5.1 shows the received data from android app.

Page 25: NFC_graduated _book_2016.PDF

25 Chapter Three-PHP Forms and Codes

FIGURE 3.1.5.1 shows the received data from android app.

After receiving this data, we first connect to server then connect to student’s database related to the name of

his/her academic year and department. In case of connection to database or server failed we can’t record

student’s attendance in database as shown below in figure 3.1.5.2.

FIGURE 3.1.5.2 shows connecting to database.

After connecting to database, we should check if student exist in database or not by selecting student’s id from

“students_data” table existed in database. If this query done successfully this means that student can access

to database, but if this query failed, this means that student can’t access to database and the following

message will be received in android app “Student not in database” as shown in figure 3.1.5.3. There are

some cautions we talk in order to human mistakes , if any student try to access to database on collage holiday

(Friday) by scanning any tag in any lecture hall , he/she will get the following message “Invalid day” and

cannot record his/her attendance in database. Another caution, the checked time when student scan tag is not

the his/her smart phone time, it is the Greenwich time plus two hours (to reach Egypt time) .

FIGURE 3.1.5.3

After that, we will define the day that student access to database, the day of the next week, the date that

student access to database e.g. “sat,26/12/2015” and finally define the student’s section number, figure 2.46

for more details. Each day student accesses the database we create two tables in database to record the

attendance of students, the name of the first table related to the date that student access to database and the

name of the second table is related to the date of the next week. But if one of these tables already exist in

database, we don’t create it again. Figure 3.1.5.5 shows the creation of two tables.

Page 26: NFC_graduated _book_2016.PDF

26 Chapter Three-PHP Forms and Codes

FIGURE 3.1.5.4

FIGURE 3.1.5.5 shows the creation of two tables.

We store the names of all created tables in database in a table called “table_names” for later use in check

attendance system as shown in figure 3.1.5.6.

FIGURE 3.1.5.6 shows the creation of “table_names”.

For all students that already exist in “students_data” table we insert in tables created before ID, section and

the lecture intervals which we get them from “intervals” table .

FIGURE 3.1.5.7

Then we update these tables with a default value to facility recording the student’s attendance .This value may

be refer to that student absent for a specific lecture, section or lab or refer to that there is no lecture, section or

lab this week and if there is lecture, section or lab is not the elective subject for a specific student, the updated

default value will be “invalid” which indicates that student not allows to record his/her attendance or absence for

this subject. To perform this process, first we need to determine optional subjects for each student which

he/she registered on and that can easily done using “students_data” table existed in database through the

Page 27: NFC_graduated _book_2016.PDF

27 Chapter Three-PHP Forms and Codes

query below in figure 3.1.5.8, which select from “students_data” table the “Optional_subjects” column

which we referred to it before in “Elective subjects for Each Student” part.

FIGURE 3.1.5.8

As shown in figure 3.1.5.9 , we select from “schedule” table the lectures, sections and labs which will be held

on a day and interval (e.g. sun-FirstInterval) that student access to database to record his/her attendance

and places where lectures , sections and labs will be held on it from “lecture_hall” table . We do that for

later usage in specifying which default value we update in recording attendance tables

FIGURE 3.1.5.9

Depending on the data selected from schedule table we determine the default value that updated on recording

attendance tables so there are many possibilities for specifying default values.

First one: if selected subject from schedule table is a non optional subject and include “EW” that refers to that

lecture, section or lab is held every week, the updated value for both created table will be like that “absent

lec Digital Communication EW at lecture hall m3”. But if the selected subject from schedule table is

an optional subject we should first check for each student if he/she register on this subject or not. If this check

success, the updated default value for both created table shown in figure 3.1.5.10 will be like that “absent lec

optics optional EW at lecture hall k4”.

FIGURE 3.1.5.10

Second possibility is if selected subject from schedule table is a non optional subject and include “*” which

refers to lecture, section or lab is held every two week e.g. “lec Digital Communication *”, the updated

default value for the first week created table will be “absent lec Digital Communication * at lecture

hall m3”, where the updated default value for the next week will be “no lec Digital Communication *

this week at lecture hall m3” as shown below in figure 3.1.5.11. In case of selected subject from

schedule table is an optional subject, the updated default value will be similar to case of non optional subject

but only for students register on this subject.

Page 28: NFC_graduated _book_2016.PDF

28 Chapter Three-PHP Forms and Codes

FIGURE 3.1.5.11

The two previous possibilities depend on only one lecture, section or lab will be held in an interval. But if more

than one should be held on the same interval, we first check if the selected subject from schedule table include

“/” which refers to that there are more than one lecture, section or lab will be held on the same interval

whatever these subjects are all non optional subjects like that “sec Measure EW/sec Digital

Communication EW” or these subjects one of them is non optional subject and the another one is optional

subject like that “ sec Optics optional */sec Digital Communication * ”. Thus if the selected subject

from schedule table includes “/” and all subjects that will be held on the same interval are non optional subjects

and are held on the same lecture hall, this means that the subject before back-slash “/” will held on the first

week at a specific lecture hall but the subject after back-slash “/” will be held on the next week at the same

previous lecture hall. Depending on that the updated default value for the first week table will be like that

“absent sec Measure* at lecture hall K4” but the updated default value for the next week table will be

like that “absent sec Digital Communication * at lecture hall K4” as shown below in figure

3.1.5.12 .

FIGURE 3.1.5.12

Another possibility is that if the selected subjects from schedule table same as before “sec measure

EW/sec Digital Communication EW” but the subjects which are held on same interval are held at different

lecture hall. Since The selected place from “lecture_hall” table will be like that “K4/K6”. This mean that the

subject before slash will held on the first week at lecture hall “K4” and the updated default value for the first

week created table will be like that “absent sec measure EW at lecture hall K4” but the subject after

slash will held on the next week at different lecture hall and the updated default value for the next week created

table will be like that “absent sec digitalcomm EW at lecture hall K6” as shown in figure 3.1.5.13.

In the two previous possibility, all subjects which are held on the same interval are non optional subjects but

in case of these subjects include optional subject with non optional ones such as “sec Digital

Communication * / sec Optics optional *”, and the selected value from “lecture_hall” table include

different places such as “K1/K2”. In case of optional subject locates before back-slash, this means the updated

default value for the first week table will be “absent sec Optics optional * at lecture hall K1” for

only students register on this optional subject as shown in figure 3.5.14.

Page 29: NFC_graduated _book_2016.PDF

29 Chapter Three-PHP Forms and Codes

FIGURE 3.1.5.13

FIGURE 3.1.5.14

But for students that not register on this optional subject the updated default value for the first week table will

be “invalid”. Where the updated default value for the next week table will be “absent sec Digital

Communication * at lecture hall K2” as shown in figures 3.1.5.15a and 3.1.5.15b.

FIGURE 3.1.5.15a

FIGURE 3.1.5.15b

In case of optional subject locates after back-slash, this means the updated default value for the first week

table will be “absent sec Digital Communication * at lecture hall K1” , where the updated default

value for the next week table will be “absent sec Optics optional * at lecture hall K2” for only

students register on this optional subject. For students who not register on this optional subject, the updated

default value for the next week table will be “invalid”. Similar to previous cases, if the selected value from

“lecture_hall” table include one place this means one subject will be held on first week in a specific lecture

hall, where the second will be held on the next week at the same lecture hall. Where if the subject is optional,

the updated default value for students register on this subject will be “absent sec Optics optional * at

lecture hall K2” and for students that not register on that subject the updated default value will be

“invalid” . Unlike previous possibilities, if the selected subject from schedule table includes “or” that refers

to more than one optional subject will be held on the same interval, in this case we have more than one

possibility.

Page 30: NFC_graduated _book_2016.PDF

30 Chapter Three-PHP Forms and Codes

1- If the optional subject will be held every week this means these subjects will be held at different lecture halls

and for only students register on these subjects the updated default value for both created tables will be

“absent sec Optics optional EW at lecture hall K2 ” as shown in figure 3.1.5.16 .

FIGURE 3.1.5.16

2- If the optional subjects will be held every two weeks and the selected value from “lecture_hall” table

includes different places such as “K1/K2”, this means each optional subject will be held on different lecture

halls so for students register on a specific optional subject , the updated default value for the first week created

table will be “absent sec DSP optional *at lecture hall K4”, where the updated default value for the

next week created table will be “no sec DSP optional * this week at lecture hall K4” as shown in

figure 3.1.5.17.

FIGURE 3.1.5.17

Similar to previous cases, but in case of the selected value from “lecture_hall” table includes one specific

place this means each optional subject will be held every two weeks on same lecture hall. If the selected

subject from schedule table such as “sec DSP optional * or sec antenna optional *” and the

corresponding lecture hall such as “k6” , so if the optional subject which student register on it exist before “or” ,

the updated default value for the first week created table will be like that “absent sec dsp optional *at

lecture hall k6”.the updated default value for the next week created table will be like that “no sec dsp

optional * this week at lecture hall k6”. But if the optional subject which student register on it

exist after “or”, then the updated default value for the first week created table will be like that “no sec

antenna optional * this week at lecture hall k6”.the updated default value for the next week

created table will be like that “absent sec antenna optional *at lecture hall k6” as shown in figure

3.1.5.18.

FIGURE 3.1.5.18

Page 31: NFC_graduated _book_2016.PDF

31 Chapter Three-PHP Forms and Codes

The third probability is if one of optional subjects which held on the same interval will held every week and the

other will held every two week like that “sec dsp optional * or sec antenna optional EW ” so the

corresponding selected value from “lecture_hall” table include different lecture hall. If one of these optional

subject which student register on it include “EW” indicate that this optional subject held every week .the updated

default value in this case for the both created tables will be like that “absent sec antenna optional EW

at lecture hall k6” as shown in figure 3.1.5.19.

FIGURE 3.1.5.19

But if optional subject which student register on it include “*” indicate that this optional subject held every two

week .the updated default value in this case for the first created table will be like that “absent sec dsp

optional * at lecture hall k5”.the updated default value for the next week created table will be like that

“no sec dsp optional * this week at lecture hall k5” as shown in figure 3.1.5.20.

FIGURE 3.1.5.20

If there is no one of the all previous cases for specifying the updated default value achieved, the updated

default value for both created tables will be like that “invalid” as shown in figure 3.1.5.21.

FIGURE 3.1.5.21

Finally for each student we update the created tables for recording students’ attendance with correct default

values which facility when recording students’ attendance as shown in figure 3.1.5.22. After that we call two

functions the first is called “lecture_cancelled” and the second is called “Attendance”. The function

“lecture_cancelled” is used when instructor want to cancel specific lecture, lab or section, he/she will send

the name of lecture, lab or section which want to cancel it and the interval that lecture, lab or section will held

Page 32: NFC_graduated _book_2016.PDF

32 Chapter Three-PHP Forms and Codes

on it. This information will send from instructor’s android app to PHP; PHP save these date on variables as

shown in figure 3.1.5.23.

FIGURE 3.1.5.22

FIGURE 3.1.5.23

When calling the function “lecture_cancelled” we select from database the number of students that

supposed to attend that lecture, section or lab which is cancelled and specify their IDs as shown in figure

3.1.5.24.

FIGURE 3.1.5.24

Then update the default value that exist in table of recording attendance to “cancelled” not for all students but

for students only that are supposed to attend that lecture, section or lab which is cancelled as shown in figure

3.1.5.25.

FIGURE 3.1.5.25

The function “Attendance” is used to record the students’ attendance. First define the time that student access

to database shown figure 3.1.5.26a.

Page 33: NFC_graduated _book_2016.PDF

33 Chapter Three-PHP Forms and Codes

FIGURE 3.1.5.26a

Depending on this time we determine which lecture interval student access to the database; by selecting all

lecture intervals from “intervals” table in database as shown in figure 3.1.5.26b.

FIGURE 3.1.5.26b

Then check for each one of them if time that student attend lecture, section or lab is between the start and the

end of this interval then student attend in this lecture interval if not; we do the same check for other intervals.

Once specify the lecture interval we check first if student attend this lecture interval in time at first 15 minutes

from lecture, lab or section were started as shown in figure 3.1.5.26c. if student attend lately this lecture interval

(after the first 15 minutes from lecture ,lab or section were started) as shown in figure 3.1.5.26d; If student

attend access to database at break time interval the following message will appear “break” as shown in figure

3.1.5.26e; or if student access to database at invalid time after all lecture intervals were finished the following

message will appear “invalid time” as shown in figure 3.1.5.26g

FIGURE 3.1.5.26c

FIGURE 3.1.5.26d

FIGURE 3.1.5.26e

Page 34: NFC_graduated _book_2016.PDF

34 Chapter Three-PHP Forms and Codes

FIGURE 3.1.5.26g

After that we easily determine which lecture, section or lab the student will attend and then take her or his

attendance by calling the function “check_attendance” which take four parameters are the name of lecture

hall corresponding to the lecture interval that student will attend lecture ,section or lab; the name of lecture

interval that student access to database to take his/her attendance, the next parameter take only two values (in

time or late) to indicate if student attend lecture, section or lab in time or attend it late and the last parameter is

the duration of lecture, section or lab for later usage in android to make students’ mobile in silent mode during

lecture duration. This function does the following:

1st

check if the student attend at the correct lecture hall and by selecting the updated default value from

recording attendance table; Make sure it is not equal 'cancelled' or 'invalid' and not start with 'no' to be able to

record students’ attendance as shown in figure 3.1.5.27.

FIGURE 3.1.5.27

2nd

check if student attend lecture ,section or lab before or not .if the updated default value contain the word

“attend” or “late” this mean that student take his /her attendance before and the following message will

appear “student already attend lecture, section or lab ” as shown in figure 3.1.5.28.

FIGURE 3.1.5.28

3rd check if student attend lecture for the first time , then check the parameter which determine if student

attend lecture in time or attend lecture lately .if this parameter equal “in time” this mean that student attend

lecture at the first 15 minutes from lecture was started. replacing the word “absent” that exist in the updated

default value in recording attendance table with word “attend” and updated it again in recording attendance

table to indicate that student will record her/his attendance successfully in database as shown in figure

3.1.5.29a. Then the message shown in figure 3.1.5.29b will be sent to android.

Page 35: NFC_graduated _book_2016.PDF

35 Chapter Three-PHP Forms and Codes

FIGURE 3.1.5.29a

FIGURE 3.1.5.29b

In case of the parameter “$intime_or_late” not equal “intime” this mean that student attend lecture lately

after the first 15 minutes. student record her /his attendance but the default value in the table of recording

attendance in database will update to late instead of “attend” in previous case as shown in figure 3.1.5.30a.

Then the message shown in figure 3.1.5.30b will be sent to android.

FIGURE 3.1.5.30a

FIGURE 3.1.5.30b

if student attend lecture ,section or lab at incorrect lecture hall ,the following message will appear “invalid

lecture place” , if student attend lecture ,section or lab has been already cancelled the following message

will appear “lecture , section or lab already cancelled ”,if student attend at lecture interval that no

lecture ,section or lab will held this week the following message will appear “no lecture,section or lab

this week”. and finally if student attend at lecture interval that there is no lecture ,section or lab held on this

lecture interval the following message will appear “empty interval” as shown in figure 3.1.5.31.

FIGURE 3.1.5.31

And now we record students’ attendance for all students successfully and save their attendance in database for

later usage in check attendance system.

Page 36: NFC_graduated _book_2016.PDF

36 Chapter Three-PHP Forms and Codes

3.1.6 - Check Students Attendance

After recording students’ attendance in previous part, the number of attendance days, absence days or of days

of delay can be determined easily for all students. By opening the link for “Attendance Days” form. The page

shown in figure 3.1.6.1 will appear, user will be asked to select the department and academic year which

required in connecting to desired database as we mentioned before.

FIGURE 3.1.6.1, students’ attendance days.

After selecting the department and academic year required and pressing the “Next” button the page shown in

figure 3.1.6.2 will open, user should select the subject which he/she want to determine the number of

attendance, absence or postponement days for all students. User has three choices in displaying the

attendance for students:

“Attend”, in case of user wants to determine the number for attendance days.

“Absent”, in case of user wants to determine the number for absence days.

“Late” , in case of user wants to determine of days of delay.

FIGURE 3.1.6.2, select subject to know days of its attendance.

After pressing “Enter” button two tables will be printed out , one to display the selected data from previous

pages such as department , academic year , subject and type. The other table to show the number attendance

for student, depending on the type selected before. Figure 2.1.4 shows the attendance table in case of non-

elective subject with type “attend” . In all previous cases, students who register on selected subject (in case of

elective subject), their attendance will appear; on the other hand not registered students, the word “Invalid”

will appear next to their names. Figure 3.1.6.3 shows the attendance table in case of optional subject with type

absent.

Page 37: NFC_graduated _book_2016.PDF

37 Chapter Three-PHP Forms and Codes

FIGURE 3.1.6.2, shows the attendance table in case of optional subject with type absent.

So, what are the steps to reach this part? First, we select from “student _data” table the all students’ ID,

sections and names. Then we checked the elective subjects for each student as mentioned above and insert

“Invalid” in case of not the elective subject of any student. To determine the number of days whatever for

attendance, absence or postponement for each student we should search in all attendance tables exist in

database. Finally, we insert all this data in a table as shown in figure 2.1.3.By pressing “Print Table” button;

user can import all data in PDF format. Figures 3.1.6.3a, 3.1.6.3b and 3.1.6.3c show an example for a

compulsory subject with “attend”, “absent” and “late” type.

FIGURE 3.1.6.3a

FIGURE 3.1.6.3b

Page 38: NFC_graduated _book_2016.PDF

38 Chapter Three-PHP Forms and Codes

FIGURE 3.1.6.3c

3.1.7 - Students Grades

In this system, we make an efficient form using PHP form to easy insert students’ degrees instead of traditional

way. Professor has ability to insert degrees of all students in any department or academic year in a simple and

security way, edit the degrees of any student individually and finally show and print all degrees of his/her

students in organized way. For the first time the professor opens the form shown in figure 3.1.7.1, is asked to

select department and academic year to insert the students’ degrees corresponding to his/her selection. After

pressing “Submit”, the selected department and academic year is sent to PHP file to connect to desired

database as mentioned before. Figure 3.1.7.2 shows the message appeared after submitting.

FIGURE 3.1.7.1, students’ degrees form.

FIGURE 3.1.7.2, a message appear after submitting.

Page 39: NFC_graduated _book_2016.PDF

39 Chapter Three-PHP Forms and Codes

Then user should select type of inserted mark (oral, final, attend, lab .... and so on) and its corresponding

subject as shown in figure 3.1.7.3. Subjects names are retrieved from tables created in “Subjects for Each

Department” part.

FIGURE 3.1.7.3

To make sure students’ degrees are inserted only by subject’s instructor. A password is required to insert for

each subject. This password is entered for the first time by students’ affairs, and then professor can use this

password always to insert the degrees of each student. If all fields successfully inserted and students’ affairs

insert the subject and password for the first time, the massage in figure 3.1.7.4 will appear by pressing

“Submit”.

FIGURE 3.1.7.4

As shown in figures 3.17.5a and 3.1.7.5b all degrees can take “x” value which indicates that no degree is

inserted until now (in case of students’ affairs insert subjects password), when professors start in inserting

degrees, value "x" will be updated to the new inserted value.

FIGURE 3.1.7.5a

FIGURE 3.1.7.5b

Page 40: NFC_graduated _book_2016.PDF

40 Chapter Three-PHP Forms and Codes

FIGURE 3.1.7.6 shows the selection of subject, type of mark and inserting password.

By pressing “Insert student mark”, user will go to the third page which displays all student names

registered in the selected subject in case of elective subject as shown in figure 3.1.7.7, where for mandatory

ones, all students names will display. Professor can insert all mark for students in simple way. By pressing on

“Register Mark”, all inserted mark will be inserted in database as shown in previous figure 3.1.7.5b.

FIGURE 3.1.7.7

By pressing “show All Degrees Inserted” button, all degrees will appear in table for all students with

column called total which contains the summation of all degrees as shown in figure 3.1.7.8.

FIGURE 3.1.7.8

Page 41: NFC_graduated _book_2016.PDF

41 Chapter Three-PHP Forms and Codes

By pressing “Print” in figure 3.1.7.9a, we can get the table in PDF format. For more options; instructor can edit

a degree of only one student, by inserting the name of student then press “Enter”.

FIGURE 3.1.7.9a

After pressing “Edit”, the inserted student name will be highlighted will by a different color, thus instructor can

edit degrees as shown in figure 3.1.7.9a and 3.1.7.9b.

FIGURE 3.1.7.9b

2 - LIBRARY SYSTEM In this system, we aim to facilitate on students recording their attendance in library using NFC technology

instead of conditional methods, then saving their info directly into database. We also add a feature to help

students in finding needed books where we suppose the ability of accessing the database of library books.

More details will be explained in next lines.

3.2.1 - Library Login

Through PHP code and students’ android app, library attendance can be easily recorded similar to record

students’ attendance explained in previous parts. By scanning a tag using NFC smart-phone a connection will

be established to PHP file for login in library. PHP file will receive the student ID, name, department and

academic year. The accessed date and time in library will be got using PHP code using standard Greenwich

Page 42: NFC_graduated _book_2016.PDF

42 Chapter Three-PHP Forms and Codes

date shown in figure 3.2.1.1.Then all received student’s contacts and library accessed date and time will be

saved in database as shown in figure 3.2.1.1 .

FIGURE 3.2.1.1

FIGURE 3.2.1.2 Student should access the library-login tag twice. First time in case he/she enter library, second time in case of

he/she leaves library. Through PHP code, we can collect the available free seats in library by this twice access

as the overall seats in library are saved in the code. In case of library is full; student will receive “No places

available”. So, how we know if student leaving or entering the library? There is a “Check” column is inserted

next to every student name. Thus we have two cases:

If the check number is even, this student is leaving the library. So number of available seats will

be increased by one.

If the check number is odd, this student is entering library. So number of available seats will be

decreased by one and student information will be inserted again with the new accessed time.

Librarian or the responsible for the library have a feature to know number of student login library in a specific

date. He/she also should insert “Dewey Decimal Number” for each department to let students search library

books. Through form in figure 3.2.1.3, previous features can be done.

FIGURE 3.2.1.3

Page 43: NFC_graduated _book_2016.PDF

43 Chapter Three-PHP Forms and Codes

3.2.2 - Dewey Number and Departments

Dewey number is required in searching book part, thus a simple form is made to insert it and then saved in

database as shown in figure 3.2.2.1.

FIGURE 3.2.2.1

3.2.3 - Number of Student in Library during a day

By pressing this tap, number of students who login library in a specific day can be done in an easy way by

selecting day, month and year as shown in figure 3.2.3.1.

FIGURE 3.2.3.1

Page 44: NFC_graduated _book_2016.PDF

44 Chapter Three-PHP Forms and Codes

3.2.4 - Search for a book

For more flexibility and organized way in finding your desired books and also to save your efforts and time in

finding the book through conditional ways, a feature is added to student android app to search for a specific

book. This code provides searching using several options such as book name, author name, department or

book name with author name. The request is done by sending the type of search and the word want to be

searched. Through PHP code all book information will be retrieved from database and send to android app in

form of JSON array. Using Dewey decimal classification number which is inserted in the previous part, book

location can be determined in library. Thus this number will be also sent to android app. We will discuss this

part in more details in chapter 4.

3 - EVENTS SYSTEM Organization, instructors in university or industrial companies announces their events on social media or in

college using posters. The bad thing in all this announcements or advertisements, it may be not reach all target

persons or the target persons themselves may be does not recognize that these events will be related to them.

Thus, through following lines, we will discuss event system and its features, how students in a specific

department and academic year can get the news and events which target them.

3.3.1 - Event Registration Form

Through this form all events’ information will be inserted and saved into two tables “events” and

“organizer_names” in database. First table as shown in figure 3.3.1.1 will contain all events information such

as organizer, description, target department and academic year and so on. Second table as shown in figure

3.3.1.2 contains all organizers who register on this form as we will see later.

FIGURE 3.3.1.1

FIGURE 3.3.1.2 For the first time of using this form shown in figure 3.3.1.3 , user should go to second tap and choose

“Register new user” shown in figure 3.3.1.4 and then insert the organization or organizer name who

responsible for events or news and submit it . In case of organization or organizer have been inserted before,

Page 45: NFC_graduated _book_2016.PDF

45 Chapter Three-PHP Forms and Codes

user will get a message with “This user”EED2016” already exists” and it is not saved again. Therefore

user can return back again and use “New Event Registration” where his/her inserted organization will

appear in organizers spanner as shown in figures 3.3.1.5a and 3.3.1.5b.

FIGURE 3.3.1.2

FIGURE 3.3.1.5b

Page 46: NFC_graduated _book_2016.PDF

46 Chapter Three-PHP Forms and Codes

User has the ability to insert more than department and academic year, he/she also can insert URL, News or

both depending on the type of events should be announced. Finally user can submit the new event and it will

be saved successfully in database as shown in figure 3.3.1.1.

3.3.2 - Department News (Smart Poster)

Here we can let any student to know the news and events related only to his/her department, thus he/ she will

be interested in. After filling the events form, we should retrieve the data from database by android, this can

done by connecting android to a PHP file. By connecting to file through android app, any old event will be

deleted to make sure that only latest news reach students. First of all we can get the date of the day by using

this line $date = date("Y-n-j") and by a simple comparison we can delete old events as shown in figure

3.3.2.1.

FIGURE 3.3.1.1

After that we can select the data related to department and academic year of each student which are received

from android app through the following lines.

$department = $_POST ['department'];

$academic_year = $_POST ['academic_year'];

Using department and academic year, we can select the events target this department and academic year from

table in figure 3.3.1.1, then send the results in JSON array to android app to start to display to students.

4 - OFFICE HOURS SYSTEM Several students want to meet their professors to ask them about questions or may be discuss some topics

and so on. To make it easy on students, we make a system to let professors record their office hours and let

students register on these times. We have 2 sub-systems; the first is recording office hours for professors, the

other one for students to register on these office hours. Here we will deal with new database related only for

office hours. This database differ from previous one, it has a constant name which use for all departments and

academic year of college. Figure 3.4.1 shows the database, user and host name. Figure 3.4.2 shows some of

tables included in “u939034702_offic” database.

FIGURE 3.4.1.1 shows the database, user and host name.

Page 47: NFC_graduated _book_2016.PDF

47 Chapter Three-PHP Forms and Codes

FIGURE 3.4.1.2

In this database, we have almost constant tables’ names, but they may have some updates in their content and

the date beside some tables as we will see later. So, let us take our round in this new system.

3.4.1 - Office Hours Form For University Professor

This system enables professors to register their information and office hours whether for one subject or valid for

any student and stored them in database. In this form, we deals with a seven tables, first one is “doctors” to

save information, six tables to save office hours, each table named by a name of week days except Friday.

With the start of form, user will get three options as shown in figure 3.4.1.1.

FIGURE 3.4.1.1, office-hours form.

1-Registration for first time

For the first time, each professor should register on this form to have his/her own account, thus the professor

could insert the office hours for his/her own subjects as shown in figure 3.4.1.2. Professors are also asked to

insert his/her name and password thus he/she can login using these contacts in other parts of this form. There

are some contacts are also needed which may be important for some students such as professor’s office place

and e-mail.

Page 48: NFC_graduated _book_2016.PDF

48 Chapter Three-PHP Forms and Codes

FIGURE 3.4.1.2

After inserting all requirements and pressing “OK” button a message will appear say “This information is

saved in table. If you need update turn back and click on ‘select office hours or

update’ ”. Where in database, a table with name “doctors” will be created if it does not exist and data will be

inserted inside. In case it exists, data will be saved directly into it. Before saving data, a simple check on

inserted e-mail will be done, to make sure that inserted e-mail has not been used before for registering by any

professor, as we know the e-mail is unique. In case of it is inserted before a notified message will appear “This

e-mail is used before. You can’t save your information with this e-mail”.

2- Select office hours or update

By pressing this icon, user should login at first by inserting his name, password and finally department. If

inserted data is correct, user can access to one of three options as shown in figure 3.4.1.3.

FIGURE 3.4.1.3

1 - Office hours for one material

In this section, professor could select the day and interval he/she available and also the subject he/she want to

insert its office-hours as shown n figure 3.4.1.4.

Page 49: NFC_graduated _book_2016.PDF

49 Chapter Three-PHP Forms and Codes

FIGURE 3.4.1.4

By pressing “Select office hours” button, a table will be created - if it does not exist - called by the

selected day name. The selected interval will be updated by the selected subject next to the professor’s name

as shown n figure 3.4.1.5.

FIGURE 3.4.1.5

In case an interval (e.g. Second Interval) is selected before for another subject, the user will get a notified

message as shown in figure 3.4.1.6.

FIGURE 3.4.1.6

2-Valid for all students

In this section, professor can insert in database “Valid”, which means that any student from any department or

academic year can reserve in this interval regardless the professor’s subjects. The steps same as previous

section but the difference in updating tables in database with “Valid” instead of subject name. Figure 3.4.1.7

illustrates this section.

Page 50: NFC_graduated _book_2016.PDF

50 Chapter Three-PHP Forms and Codes

FIGURE 3.4.1.7

3-Update

The last section in this tap is “update”; professor has several options in updating as shown in figure 3.4.1.8.

Professor can select some of his/her information to delete.

Professor can change his/her own contacts.

Professor can delete his/her own office hours for a specific subject.

FIGURE 3.4.1.8

Page 51: NFC_graduated _book_2016.PDF

51 Chapter Three-PHP Forms and Codes

In case of professor select a specific subject to delete where a student already registered on it, he/she will get a

notified message as shown below in figure 3.4.1.9.

FIGURE 3.4.1.9

After finishing all updates and pressing “OK”, professor can easily display his/her own new information.

3- Show Information

Similar to the “Select office hours” or “Update” sections, professor should insert name, password and

department to login; by pressing “OK”, all his/her saved contacts will appear as shown in figure 3.4.1.10.

FIGURE 3.4.1.10

3.4.2 - Reserve a Time with a professor

Now we interested in students to let them able to register in professors’ office-hours. There are two ways:

Using their android application by connecting android app with a PHP file, it will be discussed later.

Design a PHP form to let students able to reserve a time with a professor in case of android app is not

available for some students.

For the first time, a table as shown in figure 3.4.2.1 will be created to save the students who register on a

specific interval. As shown, every interval is divided into sub small intervals which consists of 15 minutes, thus

every student can have a specific part to meet his/her own professor. The table's name consists of the day

name and the date of the next week. These tables are updated automatically every week by the new dates.

FIGURE 3.4.1.1

Page 52: NFC_graduated _book_2016.PDF

52 Chapter Three-PHP Forms and Codes

Every time any student connects to the PHP form or PHP file through android app, a simple check will be done

on the date of tables. In case of any table’s date is smaller than the accessed day date, this means that these

meeting have been already held. Thus the information inside table will be deleted and table date will be

updated to the next week date of the same accessed day. On other hand if any table’s date is greater than the

accessed day date, this means that these meeting does not held. Thus nothing changes in tables.

1 - In case of android app

Through student android app, professor’s name and the subject name will be sent to the PHP file, thus student

can reserve a time with his/her own professor in subject office hours. The professor name will be checked if it

exists in database or not. If it does not exist a message will be sent to android app with “Invalid Doctor

Name”. If it exists, the app will continue successfully. Then through code, a JSON array will be sent to android

app included the days, intervals and sub-intervals available for the selected professor and subject. Figure

3.4.2.2 illustrates one of JSON arrays sent to android app.

FIGURE 3.4.2.2

After sending all required data from android, student name and e-mail will be saved in the selected interval, in

case of this interval is empty.

2 - In case of PHP form

PHP form is similar to PHP code connecting to android app except in the way of retrieving data. Data will be

submitted directly through form and no need for android app. By opining the form, you can write the name of

desired professor. Using AJAX in PHP, the professors name related to inserted data in search box will be

retrieved immediately from database and appear below the search box as shown in figure 3.4.2.3, the same

idea of Google search.

FIGURE 3.4.2.3

After selecting the professor name and pressing “Enter”, professor’s subject will be retrieved from database

and populate a spinner .Student should select the subject to get its office hours and press “Enter” as shown in

figure 3.4.2.4.

Page 53: NFC_graduated _book_2016.PDF

53 Chapter Three-PHP Forms and Codes

FIGURE 3.4.2.4

As shown in figure 3.4.2.5, tables with empty and busy intervals and sub-intervals will display, thus student can

select the suitable time for him/her and register on it by pressing on Empty.

FIGURE 3.4.2.5

After that , student should insert his/her name and e-mail then press “Register”, as shown in figures 3.4.2.6a

and 3.4.2.6b . Student will get a notified message with the registered day and interval. Figure 3.4.2.7 shows

data saved in database.

FIGURE 3.4.2.7 shows data saved in database.

Page 54: NFC_graduated _book_2016.PDF

54 Chapter Three-PHP Forms and Codes

4 Android Applications WHAT’S IN THIS CHAPTER?

Student android application. How student can record his/her attendance using app. Features included in students’ app. Professor android application. Why there is app for professors. Features included in professors’ application.

In this chapter, we can connect the previous chapters together and see how we can make a full system of attendance and with other features we talk about before in only one application included in student smart phone which support NFC technology. To use our application, make sure that your mobile phone support NFC technology, Google Play Services and is connected to internet.

Scan NFC Tag

Page 55: NFC_graduated _book_2016.PDF

55 Chapter Three-PHP Forms and Codes

3.0 - Applications Types

Mobile apps are move away from the integrated software systems generally found on PCs. Instead, each app provides limited and isolated functionality such as game, calculator or mobile web browsing. There are different types of Apps Native app, Hybrid app and Web-based app; third type which our android app based on.

1 - Native App

Native apps are mobile OS/platform based applications, which can be downloaded from the relevant mobile store and there after installed on the device. A native App is coded in a specific programming language, such as Objective C for iOS and Java for Android operating systems. Native mobile apps provide and a high degree of reliability and fast performance, Because the code that runs the app is stored locally on the phone. They also have access to a phone’s various devices, such as its camera and address book. Native App run directly on a mobile device, just as conventional software application runs directly on a desktop computer, without a web browser (users can use some apps without an Internet connection) and it also can connect the internet via Wi-Fi or a wireless carrier network.

2 - Web App

A Web application refers to any program that is accessed over a network connection using HTTP, rather than existing within a device’s memory. Web-based applications often run inside a Web browser. However, Web-based applications also may be client-based, where a small part of the program is downloaded to a user’s desktop, but processing is done over the Internet on an external server. As Web App stored on a remote server and delivered over the internet through a browser. In contrast, a mobile web app is software that uses technologies such as JavaScript or HTML5 to provide interaction, navigation or customization capabilities. Users first access them as they would access any web page; they navigate to a special URL and then have the option of “installing” them on their home screen by creating a bookmark to that page. Some examples of popular web applications are popular social networks, email and chatting applications, online mobile games, and cloud-based office applications. Our app based on this type of applications which use the internet connection to work.

3 - Hybrid App

Hybrid Apps are like native apps, run on the device, and are written with web technologies (HTML5, CSS and JavaScript). Hybrid apps run inside a native container on a mobile device. It is the marriage of web technology and native execution. A web-to-native abstraction layer enables access to device capabilities that are not accessible in Mobile Web applications, such as the accelerometer, camera, local storage and Phone Gap which is an example of the most popular container for creating hybrid mobile apps.

.

Page 56: NFC_graduated _book_2016.PDF

56 Chapter Three-PHP Forms and Codes

STUDENT ANDROID APPLICATION We will show at first the student android applications; installation, features and steps to achieve it. So, Let us get start.

3.1- Getting Started

For the first time student installs the app, he will get a page to insert his ID or seat number. We make insertion ID only done by students’ affairs so we can make sure that student does not change the ID inserted in app. The process is done in very simple way; an NFC tag contains a password is located at students affairs, this password is inserted in student application during programming. Student should at the begin of semester goes to students affairs with his/her phone where app should be installed and insert his/her ID in the edit box as shown in figure 3.1.1 . Hence student should read the NFC tag for password and ID will be saved in app using “Shared Preference” and he/she will be directed to next page. In case of student read wrong tag ,the inserted data would not saved and he/she will get a message with that.

FIGURE 3.1.1, Insert student ID.

The next page is to insert his/ her contacts such as department, academic year , name and so on as shown in figure 3.1.2. If student insert all contacts and press “Insert Information”, his/her contacts will be saved successfully and this page will not be appeared in next times user open the app. In case some requirements does not inserted, user will get a message with “Insert all required information”. In case of user does

not insert his/her contacts, unfortunately he/she could not use the app and the page in figure 3.1.2 will appear in every time he/she opens the app.

FIGURE 3.1.2, Insert student contacts.

Page 57: NFC_graduated _book_2016.PDF

57 Chapter Three-PHP Forms and Codes

You may ask yourself why these inserted contacts are important, as we will see later; these contacts will be used in recording lectures, sections or labs attendance, recording attendance in library or reserve an appointment with the professor and so on. As shown in figure 3.1.3; inserted contacts are saved in android by “Shared Preference”, thus these contacts can be used in any part of app.

FIGURE 3.1.3, Inserted contacts is saved in android using Shared Preferences.

As we mentioned at the introduction of this chapter Google Play services is required, so if you run this app on mobile phone does not support these services or on an emulator you will get a message shown in figure 3.1.4 , and app will not provide features which depends on Google Play services.

FIGURE 3.1.4, a message informs that this phone does not support Google Play services.

3.2- Home

Every time you open the app, you will be directed to “Home” page shown in figure 3.2.1. As we said before the

main system is recording students’ attendance, thus we located the icon responsible for attendance or in another way responsible for reading in tag “Read NFC Tag” in the main page. You also can find social media

logo such as Facebook, Instgram and so on; by press on any logo, you will be directed to our page and can follow us. Now, we can have more details on attendance part or reading tags in general; by pressing “Read

NFC Tag” button, student will be directed to a blank page. Using this button, student can read any tag; with

changing the tag content he/she will get different responses. As shown in figure 3.2.2; it is a part of “TagRead.java” class which is responsible for reading NFC tags. We have multiple of possible cases should

be covered such as “Department News”, “Student Attendance”, “Library Attendance”, “URL” and finally

Page 58: NFC_graduated _book_2016.PDF

58 Chapter Three-PHP Forms and Codes

“Dummy or Blank Data”. Student should open this button and tap NFC phone to the NFC to read its content and get the suitable response.

FIGURE 3.2.1, Home page of the application and the sub-list.

FIGURE 3.2.2, possible conditions in case of NFC tag is read by phone.

In case of tag contains “Engineering-Department-News”; this means that student reads a tag located in a

smart poster which is responsible for any news related to his/her department. In case of tag contains “ALEX-

ENG-LIBRARY”; this means that student at this time at library and he/she should record his/her attendance at

library. Third case and most important one is “#LECTUREHALLNAME#”, if any tag start with this statement, it

means that student at lecture hall and he/she is going to attend a lecture, section or lab. In our system; to make sure student reads the correct tag, we concatenate the lecture hall name such as “M2 or K1” with the previous statement; so we can make a check if tag content start with this statement or not and hence student read tag

Page 59: NFC_graduated _book_2016.PDF

59 Chapter Three-PHP Forms and Codes

located in lecture hall or read another tag such as mentioned previously. For more details about how record attendance and how check is done, you can check chapter 2- attendance system. In case of there are any previously statements found in tag content, this means we deal with an ordinary tag located in any locations, hence it has only two possibilities; first it may be contains URL and we can know that by check if tag content start with “www.”, “http://” or “https://” . Thus if it starts with something of them the

android will be direct the user to this link and open it. Intent browserIntent1 = new Intent(Intent.ACTION_VIEW, Uri.parse(tag_url));

startActivity(browserIntent1);

Second possibility, if tag contains dummy or blank data just a text; so the tag contents will be displayed on mobile monitor. These are the all possible cases we have; so now what is the next step. The next step is the most important step; it is the connection between PHP and Android.

3.2.1 - Connection between PHP and Android The most important part in android app is the connection between android and PHP files which one of them is the PHP file of record attendance which we talk about it in details in chapter 2 – attendance system. After reading any tag involved in the first three cases mentioned above, the next step is connecting android to its corresponding PHP file to perform the correct process and retrieve right data from database. Notice that PHP acts as a link between android and database; through PHP we can send and get data to and from database. The following lines show the connection code in list 3.2.1. As you see, the code is surrounded by “runnable”

object of class “Runnable”; it is used run the code inside on another “thread”, so while buffering or retrieving

data the app does not crushed. The connection code is divided into several parts; Specify the data should be sent and encode it in “UTF-8” format, define URL where data should be sent or retrieved, send “POST” or “GET”

data request and that depends on how the data encoded; in our case we used “POST” request and finally we

should start connection and send the output stream data to server or PHP file and get the response. Input stream data from server is buffered then several processes are done on it and finally we can get the results from server whether string or JSON; this is related to programming in PHP files. Through this code we can make a connection from android to PHP files with the same steps, just change the data sent and URL where data should be sent or retrieved.

3.2.2 – Recording Attendance In case of tag contents start with “#LECTUREHALLNAME#”, this will make android to connect main PHP file

responsible for recording attendance. Android will send to PHP Student ID, Department, academic year and remain contents of tag after “#LECTUREHALLNAME#”. For example if tag contents are “#LECTUREHALLNAME#K7”,

android will send to PHP file “K7”; figure 3.2.3 shows the encoded data to be sent. Hence the PHP file can

record attendance in database and will send results to android. The results are consists of two parts separated by “%#%”; first part before “%#%” is used to be displayed to student to notified him/her if recording attendance is

done successfully or not. The other part after “%#%” is the duration of lecture, section or lab; it is calculated by

PHP file. This duration is used to run a service in android to make it change its mode to silent mode and after that duration (lecture duration), it will return back to its oldest mode. Figure 3.2.4 shows the separation of results and calling service to start silent mode. The important of these features to be sure that the lecture is quiet and there is no any distribution.

FIGURE 3.2.3, data sent to PHP file in attendance part.

Page 60: NFC_graduated _book_2016.PDF

60 Chapter Three-PHP Forms and Codes

FIGURE 3.2.4, separation results of recording attendance and start silent mode.

3.2.3 – Department News As we mentioned before if tag contains “Engineering-Department-News”, the android will send the

department name and academic year to PHP file mentioned in chapter 2 – Department News section; hence retrieve from database all events related to this department and academic year and finally display the some hints on events in list-view as shown in figure 3.2.5; by pressing on any event the app will open the browser and direct you to the main event with its details.

FIGURE 3.2.5, department news.

3.2.4 – Library Here tag content should be “ALEX-ENG-LIBRARY”; thus the android will send name, student ID, department and

academic year to PHP file we referred to before in chapter 2 – Library Login section. The PHP file will connect

to library database and save the student details in table in database. For more about recording student details

in database, you can check chapter 2 – Library Login section.

Page 61: NFC_graduated _book_2016.PDF

61 Chapter Three-PHP Forms and Codes

Runnable runnable = new Runnable() {

public void run() {

String data = null;

try {

//get shared preferences

SharedPreferences sharedPref2 = getSharedPreferences("MyData",

Context.MODE_PRIVATE);

String department = sharedPref2.getString("department","");

SharedPreferences sharedPref3 = getSharedPreferences("MyData",

Context.MODE_PRIVATE);

String academic_year = sharedPref3.getString("Academic_year","");

data = URLEncoder.encode("department", "UTF-8")

+ "=" + URLEncoder.encode(department, "UTF-8");

data += "&" + URLEncoder.encode("academic_year", "UTF-8")

+ "=" + URLEncoder.encode(academic_year, "UTF-8");

} catch (UnsupportedEncodingException e) {

e.printStackTrace();

}

// Making HTTP request

BufferedReader reader = null;

// Send data

try {

// Defined URL where to send data

URL url = new URL("http://nfc2016.esy.es/events/smartPoster.php");

// Send POST data request

HttpURLConnection conn = (HttpURLConnection) url.openConnection();

conn.setRequestMethod("POST");

conn.setDoOutput(true);

wr = new OutputStreamWriter(conn.getOutputStream());

wr.write(data);

wr.flush();

// Get the server response

reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));

StringBuilder sb = new StringBuilder();

String line = null;

// Read Server Response

while ((line = reader.readLine()) != null) {

// Append server response in string

sb.append(line + "\n");

}

result = sb.toString();

jsonObject = new JSONObject(result);

} catch (Exception ex) {

} finally {

try {

wr.close();

reader.close();

} catch (Exception ex) {}

}

LIST 3.2.1, Connection code with the data sent in department news section.

Page 62: NFC_graduated _book_2016.PDF

62 Chapter Three-PHP Forms and Codes

3.3- Hi Student

If you are using our app for the first time, it may be hard on you to deal with app and its features; so we avoid this problem by inserting in options menu an item called “Hi Student”, by selecting this item you can find

more details about app and its features as shown in figure 3.3.1.

FIGURE 3.3.1, Hi Student contents.

3.4- Time Table

One of important features we added to our app is “Time Table”; students every scholar day need to know

what should they attend, thus we facilitate on student this issue. He/she does not need lots of papers to have with him/her, just open the app and select “Time Table” item. As shown in figure 3.4.1 the schedule can be

scrolled so easy to view all its contents. By pressing “Time Table”, android will directly connected to a PHP

file and send the department and academic year which saved at starting of app as we refer to in section 1 of this chapter – Getting Started. Using this data in connection code and a different URL inserted in app while building it we can get the schedule from database through PHP file.

FIGURE 3.4.1, lectures schedule.

Page 63: NFC_graduated _book_2016.PDF

63 Chapter Three-PHP Forms and Codes

3.5- Check Your Attendance

The main goal of our app is recording students’ attendance using NFC technique; thus it is original to add a feature in this app to calculate attendance, absence or late days of each student. This is simply done through “Check Your Attendance” item. By pressing on “Check Your Attendance” shown in figure 3.5.1, a

connection is made between android application and a PHP file which is responsible for retrieving students’ subjects (lecture, section or lab) from schedule located in database and sends them to android app to display them in a spinner as shown in figure 3.5.2. Student should select the subject he/she wants to know his/her attendance, absence or late; hence he/she should select what he/she want to display by selecting choice of radio buttons shown in figure 3.5.3. Then you can press on “CHECK ATTENDANCE”; by pressing, the app will

send the selected radio button value (attend, late or absent) and the selected subject from spinner and the ID which is saved before at the beginning of app. The results will be shown in text box at the same page. Figure 3.5.4 a, b and c shows the three different cases attend, late and absent with their results.

FIGURE 3.5.1, check student attendance.

FIGURE 3.5.2, spinner contains student subjects.

Page 64: NFC_graduated _book_2016.PDF

64 Chapter Three-PHP Forms and Codes

FIGURE 3.5.3, attend, absent and late options.

In case of the selected subject is not one of his/her elective subjects, he will be notified by this as shown in figure 3.5.5 and of course there will not be any attendance or absence days; student can know the attendance days if he/she choose this elective subject before.

FIGURE 3.5.5, in case of elective subject.

3.6- Reserve a Time

In this section, student can reserve an appointment with a professor in his/her office hours which is inserted before as we described its PHP form in chapter 2 – office hours’ system. By pressing this item, student will get a dialog shown in figure 3.6.1 with the name of all departments in college. Student can select the department he/she wants to load professors names related to this department. Hence a list of professor name will be appears with their subjects names shown in sub title as in figure 3.6.2. Here we provide a search bar to easy reach professor name. Notice that database related to professor names and their details are not real ones and it is created by us for trial. Now by selecting professor name and subject; app will be connected to PHP file

Page 65: NFC_graduated _book_2016.PDF

65 Chapter Three-PHP Forms and Codes

which mentioned in chapter 2 – office hours system and send the selected data (professor and subject name) and then retrieve the office hours related to this subject as shown in figure 3.6.3. By selecting any interval, a dialog will be appeared with the sub intervals you want to register in. You can select any sub interval and hence you will get a notified message as shown in figure 3.6.4 indicates that you are successfully registered in. If you try to press on this sub-interval again before refreshing app, you will get another message indicates that it is a busy period; you will also get this message in case of you press on any busy period. Figures from 3.6.1 to 3.6.4 shows the steps of reservation a time with a specific professor.

FIGURE 3.6.1, reserve a time with a professor.

FIGURE 3.6.2, reserve a time with a professor.

Page 66: NFC_graduated _book_2016.PDF

66 Chapter Three-PHP Forms and Codes

FIGURE 3.6.3, reserve a time with a professor.

FIGURE 3.6.4, reserve a time with a professor.

3.7- Library

It is suppose that student entries library and now he/she wants to find a specific book at library; but searching several parts of libraries will be very hard and will take a lot of time. So by accessing to library database and apply a connection between it and our android app through PHP code, we can make a search for any wanted book. As we mentioned before in chapter two – library system, we have a PHP file responsible for retrieving data from database with several cases of search but how we can do this in android. The page responsible for searching for books is shown in figure 3.7.1; we have a text box to insert the name wanted to be searched and

Page 67: NFC_graduated _book_2016.PDF

67 Chapter Three-PHP Forms and Codes

have three different selections to search by; book name, author or department. Note that the databases used in all next examples are created by us to try a system and its contents are not real.

FIGURE 3.7.1, library section to search for a book.

By inserting the part of book name you want to search for and select the “BookName” option; you will get a

message as shown in figure 3.7.2; thus student will have two options to search only by book name or insert a specific author . In case of selecting only book name; you will get all books have in its name the searched word in this example is “communication”. For facility we add a search bar to search the results. By selecting any item; you will get more details on book as shown in figure 3.7.3. Student can find more details about book such as author name, version and so on. In case of any of these details are empty in database, he/she will get nothing.

FIGURE 3.7.2, search books by selecting book name button.

Page 68: NFC_graduated _book_2016.PDF

68 Chapter Three-PHP Forms and Codes

FIGURE 3.7.3, all information about selected book.

Second case if student decide to search with book and author name or in another way decided to press “OK” in dialog shown in figure 3.7.2, he/she will get another dialog shown in figure 3.7.3 ask to insert the author name. By inserting it and pressing “OK”, you will get part of previous results which you get in figure 3.7.2 as all books with another author name are denied. Figure 3.7.4 shows the new results for search by book and author name. By show more details about both books we get we will find the author name is similar which is “Amel”. Similar to previous steps, student can also search by department and author name by inserting the searched word in the text box but now without any extra options.

FIGURE 3.7.4, case of searching by book and author name.

Page 69: NFC_graduated _book_2016.PDF

69 Chapter Three-PHP Forms and Codes

FIGURE 3.7.5, details of resultant books.

3.8- Your Contacts

If student want to check on his/her inserted contacts, he/she should use “Your Contacts” option. The

contacts which were inserted at the starting of the app in section 3.1 will display as shown in figure 3.8.1. In case of there are any updates on students contacts in name, department, academic year and so on; he/she should press on the “pin” beside the contact he/she want to update. By pressing it a dialog will appear involved a text box to insert the update. As shown in figure 3.8.2 the academic year and the telephone number of student is updated. We can notice that; in case of academic year and department, we do not let the student to hand write them instead we let him/her select the choice from a spinner. The reason for that is the two these contacts are used in connections to database responsible for attendance, get department news and schedule through sending the department and academic year to PHP files. Thus we should make sure they have no any change in spelling or unknown department and so on. If so it will have a problem in connection to database and app will not work normally; so it is one of cautious to make sure app works normally.

FIGURE 3.8.1, student contacts.

Page 70: NFC_graduated _book_2016.PDF

70 Chapter Three-PHP Forms and Codes

FIGURE 3.8.2, updates on student contacts.

3.9- Next Interval

Now, you are a student and you want to know what should you have in next interval; and you do not want to search all parts of schedule, thus we facilitate this on you by selecting “Next Interval”. In easily way, you

can know what you have next interval and its place whatever lecture, section or even lab.

3.10- Login

If you press on “Login”, you will get the same page as shown in figure 3.1.1. Do not worry; it was not a

mistake. Because any students will move from academic year to another and off-course his/her seat number or ID may be change; we insert this tap in case of his seat number changes, thus he/she should follow the same steps as in section 3.1 by read an NFC tag contains a password from students affairs hence the new ID will be saved successfully.

2- INSTRUCTOR ANDROID APPLICATION Instructor should have an android application such as students; thus instructor can also have the benefit of NFC technology to facilitate on him the daily life in university. In the following part we will illustrate instructor app with its features.

4.2.1 - Getting Started

The main page of instructor app is shown in figure 4.2.1.1; it is similar to student app in design. There is a menu has several options such as “Hi Instructor”, “Read/Write Tag” and so on. Instructor also can

Page 71: NFC_graduated _book_2016.PDF

71 Chapter Three-PHP Forms and Codes

follow our pages on social media such as Facebook by pressing on the logo of social media he will be directed to our page. Here we have not any restrictions like student app as we do not need any information to be used in app during its work.

FIGURE 4.2.1.1, main page of instructor app.

4.2.2 – Hi Instructor

Through this item instructor can know more details on app and how to deal with it; where all menu options are illustrated in this tap. Figure 4.2.2.1 shows the contents of “Hi Instructor”.

FIGURE 4.2.2.1, Hi Instructor contents.

Page 72: NFC_graduated _book_2016.PDF

72 Chapter Three-PHP Forms and Codes

4.2.3 – Read/Write Tag

Here we provide instructor with two options “Read/Write Tags”; by opening this tap instructor will have the

option to select if he/she wants to read tag or write tag. In case of read tag he only needs to tap the tag to read its contents and then it will display on his mobile phone. In case of write tag he will directed to another page to insert the text he/she wants to write to tag. Figure 4.2.3.1 shows the two options read and write tags.

FIGURE 4.2.3.1, read or write tag.

4.2.4 – Students Attendance

In case of instructor wants to know the attendance of his/her students; he/she do not have to open database or open website responsible for that. We facilitate this issue on him/her using “Students Attendance”.

Instructor should select the department and academic year of his/her students then press “Next” as shown in

figure 4.2.4.1. Department and academic year is used to connect to database related to this department and academic year. By pressing “Next” a dialog will be appear contains the subjects (lectures, sections and lab)

and also the type instructor want to display in table (attend, absent or late) then press “Next”. These selections

are sent to PHP file and now web-browser will be opened and a table with students’ attendance will be displayed as shown in figure 4.2.4.2.

FIGURE 4.2.4.1, Students Attendance.

Page 73: NFC_graduated _book_2016.PDF

73 Chapter Three-PHP Forms and Codes

FIGURE 4.2.4.2, table contains the students absence in a specific subject.

4.2.5 – Record Student Mark

To record students’ marks directly during lecture, section or oral exam, instructor can use this tap and has the

benefit of NFC technology in recording students’ marks in easy way. When opening this tap instructor will have

three options as shown in figure 4.2.5.1. We have three options “Manual”, “Tag” or “Peer to Peer”

FIGURE 4.2.5.1, three options to record mark.

In case of “Manual”; a dialog is opened to set department and academic year of student wanted to record

his/her mark. Hence another dialog will appear to record the contacts of student, mark, type of mark such as

oral, bonus ,midterm and so on and finally the subject as shown in figure 4.2.5.2 . By pressing “OK” all this

inputs will be sent to PHP file to record the mark in database in subject table. Tables are already created before

in student degrees form – chapter 3.

FIGURE 4.2.5.2, three options to record mark.

Page 74: NFC_graduated _book_2016.PDF

74 Chapter Three-PHP Forms and Codes

In case of “Peer to Peer” we depends on there is app for student; thus we let the instructor receives student

ID, department and academic year through student application using “Peer to Peer” technique. Instructor

only needs to insert mark, type of mark and subject. Similar to “manual” android will send these data to PHP

and follow same steps.

In case of student does not have NFC phone, we have its replacement which we refer before “RFID Card”.

Thus we put this option “Tag” to let instructor read the students information and separate it then send it with

student mark, its type and subject.

4.2.6 – Cancel Lecture

In case of instructor wants to cancel a specific lecture should be held later; he/she can use this tap. As usual

instructor should select the academic year and department and pressing “NEXT”; then he/she will directed to a

dialog to select the subject and its corresponding interval to cancel. Pressing on “OK” means that a connection

will be start between android and PHP file of “record_attendance” to cancel this lecture. Hence a

notification will be sent to all students who selected this subject (in case of elective subject) telling them that

lecture is canceled.

FIGURE 4.2.6.1, cancel lecture by instructor.

FIGURE 4.2.6.2, subject and interval of the canceled lecture.

Page 75: NFC_graduated _book_2016.PDF

75 Chapter Three-PHP Forms and Codes

4.2.7 – Students Grades

As we refer in the beginning of chapter we have different types of applications software one of them is Web-based applications. In computing, a web application or web app is a client–server software application which the client (or user interface) runs in a web browser. Based on previous definition, we direct the app to open the form of “Students Degrees” which we refer to in chapter 3 - Students Degrees section. Figure 4.2.7.1 shows

the form opened from web-browser and URL of form appears at the top of page.

FIGURE 4.2.7.1, students degrees tap direct instructor to PHP form.

4.2.8 – Students Meeting

As shown in figure 4.2.8.1 by pressing on “Students Meeting”, instructor will be asked to select his/her

department as it is used to get all names of instructors in this department thus he/she can select his/her name as shown in figure 4.2.8.2 . Instructor should also insert the day and the date to show its related table which includes the students he/she should meet at the selected day. By pressing “Get Table” instructor will directed

to a PHP form to display the meetings table.

FIGURE 4.2.8.1, Students meeting by instructor.

Page 76: NFC_graduated _book_2016.PDF

76 Chapter Three-PHP Forms and Codes

FIGURE 4.2.8.2, selecting instructor name, day and date to display the meeting table.

4.2.9 – Office-Hours

Similar to the previous concept mentioned in section 4.2.7; we direct instructor to the main form of office hours as shown in figure 4.2.9.1.

FIGURE 4.2.9.1, office hours.

Page 77: NFC_graduated _book_2016.PDF

77 Chapter Three-PHP Forms and Codes

5 NFC Hardware

WHAT’S IN THIS CHAPTER?

Main NFC hardware components of. NFC module. How student can record his/her attendance using NFC card.

In this chapter, we will have a look on NFC hardware and how we can use NFC technology without NFC-enabled phone; only using NFC cards.

Scan NFC Tag

Page 78: NFC_graduated _book_2016.PDF

78 Chapter Three-PHP Forms and Codes

As we introduced in chapter 2; in case of student does not own an NFC enabled mobile phone, he/she can use RFID card which can save the main student info to let him/her record his/her attendance. As we referred before the main reason to use this method also mobile phone is easier in using and more efficient is that building a complete system should involve all possibilities to serve all clients using this system. The main component we used to build this system is arduino, NFC module, Wi-Fi module and finally LCD. Figures 5.1a, 5.1b, 5.1c and 5.1d show the previous components. So in what each component is used. For arduino; it is considered the brain of the system it is used to control all components through the code which it is programmed by. To let all components work together, we need to connect them to arduino. For NFC module or we can say NFC reader/writer; from its name it is used to read and write on NFC cards or NFC tags. We used two different types of NFC module first one works on 13.56 MHz where the other one works on 13.5 KHz.

FIGURE 5.1 NFC module 13.5 KHz, NFC card and NFC tag.

FIGURE 5.1b, NFC module 13.56 MHz and NFC card.

FIGURE 5.1c, Arduino UNO.

FIGURE 5.1d, Wi-Fi module-CC300.

Page 79: NFC_graduated _book_2016.PDF

79 Chapter Three-PHP Forms and Codes

We have two hardware one for recording lectures attendance and the other one for recording attendance at library; both have the same concept.

5.1 - Recording Attendance Using NFC Module

First of all students should have NFC card or RFID card as shown in figure 5.1.1 which contains their information which is department, academic year, name and ID. Students should put his/her NFC card near to NFC module which will read all data included in NFC card then using code uploaded on arduino we can separate read information into department , academic year and ID; each on in different variable. Then using Wi-Fi module, we can connect to Wi-Fi network and hence send to PHP code the required data to record attendance similar to android app. We should send department and academic year to connect to database which is read from student NFC card; ID is also should be sent and the time is sent automatically when student access NFC module. The notified message previously sent to android; now is displayed on LCD to let student know that he successfully record his/her attendance or not. Figure 5.1.1 shows the whole system.

5.2 - Recording Attendance at Library

Similar to section 5.1 in recording attendance but the difference is only in the data send using Wi-Fi module. We need to send ID and name of student and the other required are achieved using the code such as date or day and so on.

FIGURE 5.1.1


Recommended