From the course: PHP: Object-Oriented Programming with Databases
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Admin validations - PHP Tutorial
From the course: PHP: Object-Oriented Programming with Databases
Admin validations
- [Instructor] In this movie, we'll talk about how to add validations to our admin class in an object-oriented way. You'll recall that in the last chapter, we gave our DatabaseObject class a method called validate and it just has a real skeleton of a method there, just sets errors equal to nothing, and then returns those errors. What we need to do is add custom validations to the admin class that inherits from DatabaseObject. So, in admin.class.php, we want to add a new method down here which is also going to be the same type of method, protected function called validate, and it's going to override that behavior with its own behavior. I've included that in the exercise files for you. Let's open that file up. You can take all of these lines from protected function validate down to the bottom, and make sure I get that final curly brace. Let's copy all of that and let's go into admin and let's paste it in. Now, these validations are the exact same validations that we talked about in the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Admin class7m 40s
-
Hashing passwords7m
-
(Locked)
Admin validations7m 16s
-
(Locked)
Find by username5m 55s
-
(Locked)
Verify password5m 5s
-
(Locked)
Define a session class8m 34s
-
(Locked)
Add page access control4m 52s
-
(Locked)
Improve the session class7m 39s
-
(Locked)
Session messages6m 40s
-
(Locked)
-
-