Learn By Example: PHP For Dynamic Websites
4.7 (6 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
197 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Learn By Example: PHP For Dynamic Websites to your Wishlist.

Add to Wishlist

Learn By Example: PHP For Dynamic Websites

Super-practical PHP: cookies, sessions, login authentication, MySQL integration, Object Oriented PHP and lots more!
4.7 (6 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
197 students enrolled
Created by Loony Corn
Last updated 1/2017
Current price: $10 Original price: $50 Discount: 80% off
9 hours left at this price!
30-Day Money-Back Guarantee
  • 13 hours on-demand video
  • 134 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Have a coupon?
What Will I 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
View Curriculum
  • 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!

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-3 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
Students Who Viewed This Course Also Viewed
Curriculum For This Course
Expand All 77 Lectures Collapse All 77 Lectures 12:58:31
You, This Course, and Us!
1 Lecture 02:19

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:-)

Preview 02:19
Installing and setting up PHP
3 Lectures 40:47

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!

Preview 19:07

If you have a Windows machine follow the instructions in this lecture to get up and running with Apache server and PHP!

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)
Basic Constructs In The PHP Language
10 Lectures 01:55:30

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

Example 1 : Ensure PHP is installed and running on your server

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 2 : PHP outputs HTML

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 3 : Variables - containers of data

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

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

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 5 : Decisions using If-Else and Switch Statements

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

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

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

Example 7 : Logical Operators

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

Preview 12:38

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 GET Request

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.

Example 8 : The POST Request and differences between GET and POST
Web Forms, Validating And Sanitizing User Input, Mitigating Security Risks
9 Lectures 01:36:00

Accessing and processing input data on the server

Example 8 : Web Form Processing

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 9 : Superglobals

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

Example 10 : The htmlspecialchars() function and XSS mitigation

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

Example 10 : Sanitizing 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 : Validating user input

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

Example 11 : Putting it all together

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 (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)

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

Preview 07:36
Intermediate Constructs In The PHP Language
10 Lectures 01:42:37

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

Example 13 : Associative arrays

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

Example 13 : Multidimensional arrays

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

Example 14 : For, While And Do-While Loops

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

Preview 08:05

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

Example 15 : Introduction to functions

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

All about local and global variables and where in code you can see and access variables.

Example 16 : Local Variables, Variable Hiding

Global variables need a special keyword to work and static variables remember their values across function calls.

Example 16 : Global and Static Variables
PHP and MySQL - A Well Oiled Integration
9 Lectures 01:19:58

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

Preview 03:38

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.

Enabling MySQL and using phpmyadmin (Windows)

Download and install MySQL for the MAC

Installing MySQL (Mac)

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

Using MySQL Workbench (Mac)

One last bit to do before PHP can talk to MySQL

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

Example 17 : Connecting, Running Queries, Closing a Connection

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

Example 18 : Creating a table, Inserting rows

Example 19 : Running select queries

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.

Example 20 : prepared statements
Cookies And Sessions - Stuff Which Makes PHP Cool
8 Lectures 01:14:52

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

Preview 07:42

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

Preview 12:35

Example 21 : Deleting a cookie

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 : Introduction to sessions

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

Example 22 : Creating and using sessions

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 : Passing session ids automatically without cookies

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

Example 23 : Working with sessions without cookies
Build A Login Authentication System From The Ground Up
8 Lectures 01:13:45
Steps to build a login authentication system

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.

Preview 09:16

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 : Add signed up users to the Users table

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.

Preview 13:48

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

Example 26 : Logging in and authenticating a user

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 26 : Redirecting to a login success page

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.

Example 27 : Checking whether a user is already logged in

Advanced Constructs in PHP: Object Oriented Programming
12 Lectures 02:08:59

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.

Preview 08:27

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

Example 29 : Meet your very first class

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 30 : The constructor and the destructor

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 31 : Public and private access types

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!

Example 32 : Inheritance and modeling is-a relationships

Example 32 : Working with base and derived classes

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 33 : The protected access type

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

Example 34 : An object can have multiple forms, polymorphism

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

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

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

Preview 07:56

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

Example 38 : Interfaces, the contract which a class adheres to
Some random useful stuff
2 Lectures 28:54

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

Example 39 : Filters are more powerful than you first imagined

A brief introduction to common headers and what they mean

Example 40 : Headers are metadata about browser content
1 More Section
About the Instructor
Loony Corn
4.3 Average rating
3,293 Reviews
26,189 Students
65 Courses
A 4-person team;ex-Google; Stanford, IIM Ahmedabad, IIT

Loonycorn is us, Janani Ravi, Vitthal Srinivasan, Swetha Kolalapudi and Navdeep Singh. Between the four of us, we have studied at Stanford, IIM Ahmedabad, the IITs and have spent years (decades, actually) working in tech, in the Bay Area, New York, Singapore and Bangalore.

Janani: 7 years at Google (New York, Singapore); Studied at Stanford; also worked at Flipkart and Microsoft

Vitthal: Also Google (Singapore) and studied at Stanford; Flipkart, Credit Suisse and INSEAD too

Swetha: Early Flipkart employee, IIM Ahmedabad and IIT Madras alum

Navdeep: longtime Flipkart employee too, and IIT Guwahati alum

We think we might have hit upon a neat way of teaching complicated tech courses in a funny, practical, engaging way, which is why we are so excited to be here on Udemy!

We hope you will try our offerings, and think you'll like them :-)