Learn By Example: PHP For Dynamic Websites

Super-practical PHP: cookies, sessions, login authentication, MySQL integration, Object Oriented PHP and lots more!
4.8 (2 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.
91 students enrolled
$19
$50
62% off
Take This Course
  • Lectures 76
  • Length 13 hours
  • Skill Level Beginner Level
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works

Discover

Find online courses made by experts from around the world.

Learn

Take your courses with you and learn anywhere, anytime.

Master

Learn and practice real-world skills and achieve your goals.

About This Course

Published 4/2016 English

Course Description

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

Talk to us!

  • Mail us about anything - anything! - and we will always reply :-)

















What are the requirements?

  • 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 am I going to get from this course?

  • 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

What 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

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.

Curriculum

Section 1: You, This Course, and Us!
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:-)

Section 2: Installing and setting up PHP
19:07

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!

09:45

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

11:55

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!

Section 3: Basic Constructs In The PHP Language
05:05

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

08:43

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.

07:52

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

09:32

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

18:29

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.

11:45

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

16:43

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

12:38

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

14:55

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

09:48

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.

Section 4: Web Forms, Validating And Sanitizing User Input, Mitigating Security Risks
05:26

Accessing and processing input data on the server

16:33

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!

14:05

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

05:28

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.

15:16

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.

09:16

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

12:52

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

09:28

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

07:36

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

Section 5: Intermediate Constructs In The PHP Language
Example 13 : Introduction to arrays
Preview
16:22
07:44

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

07:16

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

15:33

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

08:05

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

11:05

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

Example 15 : Pass by Value, Pass By Reference, Default Values
12:55
10:05

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

07:08

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

Section 6: PHP and MySQL - A Well Oiled Integration
03:38

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

03:04

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.

07:03

Download and install MySQL for the MAC

12:47

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

01:06

One last bit to do before PHP can talk to MySQL

Example 17 : Connecting, Running Queries, Closing a Connection
12:01
14:23

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

Example 19 : Running select queries
14:04
11:52

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.

Section 7: Cookies And Sessions - Stuff Which Makes PHP Cool
07:42

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

12:35

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

Example 21 : Deleting a cookie
02:57
12:22

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.

14:17

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

Example 22 : Destroying sessions
Preview
06:40
10:28

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.

07:51

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

Section 8: Build A Login Authentication System From The Ground Up
Steps to build a login authentication system
03:12
09:16

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.

11:55

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.

13:48

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.

11:19

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

09:05

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.

09:35

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 28 : Logout
Preview
05:35
Section 9: Advanced Constructs in PHP: Object Oriented Programming
08:27

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.

14:11

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

10:39

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

09:01

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.

09:59

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 : Working with base and derived classes
15:06
10:12

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.

10:55

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 35 : Final and abstract
Preview
10:44
10:29

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

07:56

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

11:20

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

Section 10: Some random useful stuff
17:12

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

11:42

A brief introduction to common headers and what they mean

Section 11: Working with files
Example 41 : Read and file and display it's contents
Preview
03:07
02:45

Get the name of the file, file size etc

Example 43 : More flexibility with files fopen(), fread() and fclose()
08:05
03:50

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

17:03

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

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Loony Corn, 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 :-)

Ready to start learning?
Take This Course