Library

Course: Learn By Example: PHP For Dynamic Websites

Learn By Example: PHP For Dynamic Websites

  • Life Time Access
  • Certificate on Completion
  • Access on Android and iOS App
About this Course

Super-practical PHP: Learn, by example, how to build a smart website with cookies, sessions, login authentication, MySQL integration, Object Oriented PHP and lots more!

Let's parse that.

  • This course is super-practical: packed with knowledge you can put to use right away, while still giving you a good foundational understanding of web programming, not just PHP.
  • Its about building smart websites: these days, its not OK for a website just to look snappy - login, cookies and sessions are considered necessities, not luxuries anymore
  • In this course, we will learn by example. Each example is self-contained, has its source code attached, and gets across a specific PHP use-case. Each example is simple by itself, but they come together as building blocks to build complex use cases.

What's included in this course:

  • Installing and setting up a basic web server with PHP
  • Web security basics: validating and sanitizing user input data. Web forms, mitigating XSS and XSRF attacks
  • MySQL Integration and Installation: Connecting to a database, running queries, processing results, prepared statements. Easy integration with MySQL so it's dead simple to work with databases for permanent data storage
  • Cookies, Sessions and the differences between them, using sessions without cookies
  • End to end login authentication
  • Object oriented PHP, classes, inheritance, polymorphism
  • GET, POST and other superglobals

Using discussion forums

Please use the discussion forums on this course to engage with other students and to help each other out. Unfortunately, much as we would like to, it is not possible for us at Loonycorn to respond to individual questions from students:-(

We're super small and self-funded with only 2 people developing technical video content. Our mission is to make high-quality courses available at super low prices.

The only way to keep our prices this low is to *NOT offer additional technical support over email or in-person*. The truth is, direct support is hugely expensive and just does not scale.

We understand that this is not ideal and that a lot of students might benefit from this additional support. Hiring resources for additional support would make our offering much more expensive, thus defeating our original purpose.

It is a hard trade-off.

Thank you for your patience and understanding!

Who is the target audience?

  • YEP! Students who are looking to use the power of programming to build dynamic web sites
  • YEP! Students who are looking to get into the nitty gritty of advanced PHP constructs such as cookies, sessions and object oriented programming
Basic knowledge
  • No prior programming experience needed, this course starts at zero
  • A little basic HTML, CSS and SQL will be helpful for some of the examples - not really required though!
What you will learn
  • Apply advanced constructs such as cookies, sessions and object oriented programming correctly
  • Mitigate basic web security risks by sanitizing and validating user input
  • Build a robust login authentication system using MySQL to allow users to sign up and log into your site
  • Harness the power of programming to build intelligent, interactive and personalized web sites
Curriculum
Lectures quantity: 77
Common duration: 13:00:54
You, This Course, and Us!
  • You, This Course, and Us!  

    What is this course? How will it help you? What will you learn if you take this course and finally who can take this course. All these answered:-)


Installing and setting up PHP
  • What is PHP?  

    PHP is a programming language which runs on the server, makes decisions, edits HTML to reflect those decisions and transmits pure HTML to the user. PHP has powerful constructs to work with web sites and abstracts away a lot of the nitty gritty!

  • Installing PHP (Windows)  

    If you have a MAC machine follow instructions in this class to get started with PHP. Apache comes pre-installed on a MAC you just have to enable PHP and you're ready to go!

  • Installing PHP (Mac  

    If you have a MAC machine follow instructions in this class to get started with PHP. Apache comes pre-installed on a MAC you just have to enable PHP and you're ready to go!

Basic Constructs In The PHP Language
  • Example 1 : Ensure PHP is installed and running on your server  

    The PHP equivalent of "Hello World", more like "Yay, PHP you work!"

  • Example 2 : PHP outputs HTML  

    The output of a PHP program is pure HTML and CSS which is sent down to the client browser. PHP is a server side language which means all the intelligence lies on the server.

  • Example 3 : Variables - containers of data  

    Variables are containers which hold values, the values in a variable can change during the course of the program i.e. the values "vary".

  • Example 4 : Data Types - strings, integers, booleans, doubles  

    Variables can be strings, integers, doubles, booleans - these are the primitive types which form the building blocks of any language

  • Example 5 : Decisions using If-Else and Switch Statements  

    Making decisions is a key to an intelligent site. The if-else and the switch statements are core decision making constructs present in all modern programming languages.

  • Example 6 : Strings - single quotes, double quotes, what's the difference?  

    Strings are just a sequence of characters, learn the details of how to work with strings so you don't get tripped up

  • Example 7 : Logical Operators  

    Combine conditions using "and", "or" and "not".

  • Example 8 : Introduction to Web Forms  

    Web forms are used to get user input which can be processed and stored on a site. Forms integrate seamlessly with PHP.


  • Example 8 : The GET Request  

    There are 2 ways to send requests to the server. The GET uses visible URL parameters and gives rise to bookmarkable and cacheable pages.

  • Example 8 : The POST Request and differences between GET and POST  

    The POST on the other hand uses the request body to send user data. It accepts more data types and is the preferred way to send user input data to the server.

Web Forms, Validating And Sanitizing User Input, Mitigating Security Risks
  • Example 8 : Web Form Processing  

    Accessing and processing input data on the server

  • Example 9 : Superglobals  

    Superglobals are predefined variables which can be accessed everywhere in PHP. They're very useful because they abstract away all the details of how the data was made available and they're super easy to use!

  • Example 10 : The htmlspecialchars() function and XSS mitigation  

    Submitting a form can open a tiny door to cross site scripting attacks. The htmlspecialchars() function helps you mitigate such risks.

  • Example 10 : Sanitizing user input  

    User input is always malicious. Sanitize user input data to ensure that it does not mess with your website! Sanitizing data involves removingall potentially scary stuff from the input.

  • Example 11 : Validating user input  

    User input is always malicious. Validate user input data to ensure that it looks like how you want it to! Validating input data involves rejecting all input which has potentially scary stuff in it.

  • Example 11 : Putting it all together  

    Accept input in a web form, sanitize it, validate it, show errors and then finally accept it!

  • Configure sending email using a Gmail account (Windows)  

    Getting your local machine to act as a mail server requires some set up. Configure your machine to send email using a Gmail account.

  • Configure sending email using a Gmail account (Mac)  

    Getting your local machine to act as a mail server requires some set up. Configure your machine to send email using a Gmail account.

  • Example 12 : Write code to send mail  

    After all the set up writing code to send email is extremely straightforward!

Intermediate Constructs In The PHP Language
  • Introduction to arrays  

    Example 13 : Introduction to arrays

  • Example 13 : Associative arrays  

    Associative arrays in PHP are also called Maps or Dictionaries in other programming languages

  • Example 13 : Multidimensional arrays  

    Arrays can have any number of dimensions and each dimension can be a normal array or an associative array.


  • Example 14 : For, While And Do-While Loops  

    Loops are a way to do things over and over and over again till you ask it to stop!

  • Example 14 : Break And Continue - P2  

    Break allows you to break out a loop early and continue allows you to skip certain iterations.

  • Example 15 : Introduction to functions  

    Functions are a way to name a logical unit of code and call it to do stuff for you.


  • Pass by Value, Pass By Reference, Default Values  


    Example 15 : Pass by Value, Pass By Reference, Default Values

  • Local Variables, Variable Hiding  


    Example 16 : Local Variables, Variable Hiding


  • Global and Static Variables  

    Example 16 : Global and Static Variables

PHP and MySQL - A Well Oiled Integration
  • MySQL Introduction  

    MySQL is a great database to use with your websites. And it's free

  • Enabling MySQL and using phpmyadmin (Windows)  

    Enabling MySQL for Windows is so simple it takes all of 23 seconds:-) Set up a new user and password to access the database, create tables etc from your PHP script.


  • Installing MySQL (Mac)  

    Download and install MySQL for the MAC

  • Using MySQL Workbench (Mac)  

    Set up a user name and password to connect to MySQL and use the MySQL Workbench, a user interface, to manage the database

  • Getting PHP and MySQL to talk to each other (Mac)  

    One last bit to do before PHP can talk to MySQL

  • Connecting, Running Queries, Closing a Connection  


    Example 17 : Connecting, Running Queries, Closing a Connection

  • Example 18 : Creating a table, Inserting rows  

    Make your database useful. Create a table and insert stuff into that you can use later.

  • Running select queries  


    Example 19 : Running select queries

  • Example 20 : prepared statements  

    Prepared statements allow you to specify a framework for your SQL query and then plug in specific values - very useful when data comes in via user input.

Cookies And Sessions - Stuff Which Makes PHP Cool
  • Example 21 : Introduction to cookies  

    Cookies are little bits of information stored on your machine which allow web sites to remember you even when you're not logged in.

  • Example 21 : Setting and accessing cookies  

    Working with cookies in PHP is dead easy - use superglobals and simple functions to set, access and delete cookies. 

  • Deleting a cookie  


    Example 21 : Deleting a cookie

  • Example 22 : Introduction to sessions  

    Sessions remember stuff about a user for a predetermined period of time and store information on the server! This means it can also be used to store potentially sensitive information.

  • Example 22 : Creating and using sessions  

    PHP makes using sessions very easy indeed, once again with superglobals and built in functions.

  • Destroying sessions  

    Example 22 : Destroying sessions

  • Example 23 : Passing session ids automatically without cookies  

    All pages of your website use the same session. Session id is generally communicated to the client via a cookie which is sent to the server on every request but sessions can work even when cookies are turned off! Learn about the session.use_trans_sid flag which makes this easier.

    This is a common interview question for PHP developers.

  • Example 23 : Working with sessions without cookies  

    Write code which can use sessions even when cookies are turned off.

Build A Login Authentication System From The Ground Up
  • Steps to build a login authentication system  

    Steps to build a login authentication system


  • Example 24 : Including files for code reuse  

    All source code need not sit in one file. Break up your code into logical components in different files and include those files when you want to use that code.

    Ohh and while you learn this set up a Users table which will hold all users that sign up for your site.

  • Example 25 : Add signed up users to the Users table  

    When users sign up they should be added to the Users table so you have a permanent record. While storing passwords in a database make sure you encrypt them, otherwise it's a huge security risk.

  • Example 25 : The sign up form and protection against Cross Site Request Forgery  

    While sending data from the client in the sign up form we need a way to ensure that only our trusted site is allowed to sign up new users. Use session variables to make sure this is the case.

  • Example 26 : Logging in and authenticating a user  

    Once a user signs up he can login, compare the logged in user against the list of users in your database.

  • Example 26 : Redirecting to a login success page  

    Redirecting the user to a login success page involves emitting a special header. Unfortunately there are a lot of details to work around to get this working.

  • Example 27 : Checking whether a user is already logged in  

    Once a user logs in the web site should remember the user till as long as the session lasts. Also if the user originally requested a certain web page she should be redirected to that page one she logs in. This lectures puts together all these fine touches.

  • Logout  


    Example 28 : Logout

Advanced Constructs in PHP: Object Oriented Programming
  • What's the big deal about classes?  

    Classes and objects allow us to model the real world in programming. This helps bring the basic data types together as building blocks into more meaningful and logical units.

  • Example 29 : Meet your very first class  

    Get introduced to your first PHP class. Lot's of terms here but these are all the lingo of object oriented programming so it's helpful to understand what they all mean

  • continued: Blueprints and houses, classes and objects  

    Example 29 continued: Blueprints and houses, classes and objects

  • Example 30 : The constructor and the destructor  

    The constructor and destructor are special member functions of a class that are called automatically while creating an object and when destroying and object. 

  • Example 31 : Public and private access types  

    These access types determine which code can access members of a class. Some class internals you might want to keep private and others are meant for outside code to access. These allow you to make these restrictions explicit.

  • Example 32 : Inheritance and modeling is-a relationships  

    A dog is an animal but a pug is very different from a doberman. The use of inheritance with classes allow such relationships to be modeled as well!

  • Working with base and derived classes  

    Example 32 : Working with base and derived classes

  • Example 33 : The protected access type  

    Inheritance gives rise to a new category of code - the code in derived classes. This gives rise to a new access type which allows code in derived classes to access certain base class members.

  • Example 34 : An object can have multiple forms, polymorphism  

    An object knows itself and knows what members to access within itself. This complicated concept will seem much simpler when you watch this lecture!

  • Final and abstract  

    Example 35 : Final and abstract

  • Example 36 : Trust static variables to be strange even in classes!  

    Static variables are shared across all objects of a class - a complete about face from how other member variables behave.

  • Example 37 : Constants, as opposed to variables  

    pi is a constant, don't hardcode it's value or use variables to represent it!

  • Example 38 : Interfaces, the contract which a class adheres to  

    Interfaces are constructs which are used to specify the behavior of a class but not how that behavior is achieved.

Some random useful stuff
  • Example 39 : Filters are more powerful than you first imagined  

    Filters can both sanitize and validate data - they're capable of some pretty cool stuff


  • Example 40 : Headers are metadata about browser content  

    A brief introduction to common headers and what they mean

Working with files
  • Read and file and display it's contents  

    Example 41 : Read and file and display it's contents

  • Example 42 : Common file functions  

    Get the name of the file, file size etc

  • More flexibility with files fopen(), fread() and fclose()  


    Example 43 : More flexibility with files fopen(), fread() and fclose()

  • Example 44 : Writing to a file using fwrite()  

    You can completely overwrite the contents of an existing file or append to it. Make sure you know the difference.

  • Example 45 : Uploading a file to the server  

    Upload a file to the server, check for errors, check whether it's the correct type and then finally save it on your server.

reviews (0)
Average rating
0
0 voices
Detailed rating
5 stars
0%
4 stars
0%
3 stars
0%
2 stars
0%
1 stars
0%