Documente Academic
Documente Profesional
Documente Cultură
Alexandria University
Faculty of Engineering
Specialized Scientific Programs
Fall 2015
Lab 5
Objectives:
Create basic registration and login form using PHP and HTML.
Validate forms using JavaScript.
First: Database
Notes:
1. Necessary primary and foreign key constraints must be added for all tables.
2. Department and course tables must be filled with data (using DML statements).
Registration Just like Lab3 but validate if username already exists (Php validation) ,Storing
password encrypted is required and After successful registration, you should redirect the user to another
page called chooseDepartment.php.
Login after successful login (valid user_name and password), you have two options:
1. If the user has already chosen his department. So you have to redirect him to courses.php.
2. If the user hasnt chosen his department yet, you have to redirect him to
chooseDepartment.php.
Page 1 of 2
1. Welcome {UserName}.
2. Displaying list of departments to let the student selects his department. After selecting
1. Welcome {UserName}.
chooseDepartment.php.
Hints:
1. You should use session to store logged user_id and user_name across pages.
2. DML (Data Manipulation Language) Statements are the insert statements as you made in lab 4.
3. You can check if username already exists using SELECT * FROM user WHERE user_name=
$username" and check that num of records = 0.
4. You can update department_id value in user table using UPDATE user set department_id =
$departmentId WHERE user_id= $userId.
Bonus
Policies
Lab submission and discussion will be during the lab session of each section, please take the
time to prepare for this assignment before you attend, so you can make the best use of the lab's
limited time to ask your questions. You should deliver DDL script for database creation and
DML script containing data of departments and courses.
You should work individually.
If 2 or more copies are discovered, all copies will lose all the marks of year work. Hence, it is
better to deliver nothing than delivering a copy.
Late submission is allowed for one week with 80% of the total mark. No late submission is
allowed after that.
Page 2 of 2