2. Page 2
Dominant Infotech
"Dominant InfoTech” provides a comprehensive
range of web and software development outsourcing services.
Listed below are the core areas that we provide our services
in:
Web Development
Web Design
Mobile App. Development
E-commerce Solution
CMS Websites
SEO
Logo & Graphics Design
Provide Training
5. Page 5
PHP :- Personal Home Page
What is PHP?
"PHP: Hypertext Pre-processor“ .
PHP is a widely-used, open source scripting language
PHP scripts are executed on the server
What Can PHP Do?
PHP can generate dynamic page content
PHP can create, open, read, write, delete, and close files on
the server
PHP can collect form data and can add, delete, modify data
in your database.
PHP can send and receive cookies
PHP can be used to control user-access and encrypt data.
6. Page 6
Server Are distinguish Based on Operating System You
Have :-
WAMP
MAMP
XAMP
LAMP
Web Server ???
7. Page 7
The phpinfo() function shows the php environment
Use this to read system and server variables, setting stored in
php.ini, versions, and modules
Notice that many of these data are in arrays
This is the first script you may write…
Phpinfo() :-
<BODY>
<P>
<?php $myvar = "Hello World!";
echo $myvar;
</BODY>
<?php
echo
"<html><head><title>Howdy
</title>
…?>
8. Page 8
PHP Conditional Statements
if statement - use this statement to execute some code only
if a specified condition is true
if...else statement - use this statement to execute some
code if a condition is true and another code if the condition is
false
if...else if....else statement - use this statement to select
one of several blocks of code to be executed
switch statement - use this statement to select one of many
blocks of code to be executed
9. Page 9
PHP Loops
while - loops through a block of code while a specified
condition is true
do...while - loops through a block of code once, and then
repeats the loop as long as a specified condition is true
for - loops through a block of code a specified number of
times
foreach - loops through a block of code for each element in
an array
11. Page 11
PHP Arrays
In PHP, there are three kind of arrays:
Numeric array - An array with a numeric index
Associative array - An array where each ID key is
associated with a value
Multidimensional array - An array containing one or
more arrays
12. Page 12
PHP Numeric Arrays
A numeric array stores each array element with a numeric
index.
There are two methods to create a numeric array.
In the following example the index is automatically assigned
(the index starts at 0):
In the following example we assign the index manually:
13. Page 13
PHP Numeric Arrays
In the following example you access the variable values by
referring to the array name and index:
The code above will output:
14. Page 14
PHP Associative Arrays
With an associative array, each ID key is associated with a
value.
When storing data about specific named values, a
numerical array is not always the best way to do it.
With associative arrays we can use the values as keys and
assign values to them.
16. Page 16
PHP Multidimensional Arrays
In a multidimensional array, each element in the main array can
also be an array. And each element in the sub-array can be an
array, and so on.
17. Page 17
Include Files
include “header.php”; and include (“footer.php”);
This inserts files; the code in files will be inserted into
current code.
require is identical to include except upon failure it will
also produce a fatal E_COMPILE_ERROR level error. In
other words, it will halt the script whereas include only
emits a warning (E_WARNING) which allows the script to
continue.
The include_once statement includes and evaluates the
specified file during the execution of the script.
This is a behavior similar to the include statement, with the
only difference being that if the code from a file has already
been included, it will not be included again.
The require_once statement is identical to require except
PHP will check if the file has already been included.
18. Page 18
MySQL Connectivity Commands
mysql_select_db()
o The mysql_select_db() function sets the active MySQL
database.
o This function returns TRUE on success, or FALSE on
failure.
Syntax:
o mysql_select_db(connection, database)
mysql_query()
o The mysql_query() function executes a query on a
MySQL database.
o This function returns the query handle for SELECT
queries, TRUE/FALSE for other queries, or FALSE on
failure.
19. Page 19
MySQL Connectivity Commands
Syntax:-
o mysql_query(connection ,query)
mysql_fetch_row()
o The mysql_fetch_row() function returns a row
from a recordset
Syntax:-
o mysql_fetch_row(data)
Mysql_Connect()
o The mysql_connect() function is used to open a
connection to a MySQL server.
Syntax:-
o mysql_connect (server, username, password,
client_flags)
20. Page 20
Cookies
The setcookie() function is used to create cookies. Should
be called before <html> tag.
setcookie(name, [value], [expire], [path], [domain],
[secure]);
<?php setcookie("uname", $name, time()+36000);
?>
This sets a cookie named "uname" - that expires after ten
hours.
Benefit of Cookies
• Cookies are used for authenticating, tracking, and
maintaining specific information about users.
• Personalised home pages and Electronic shopping carts.
22. Page 22
Sessions
The session_start() function is used to create a
session. Should be called before <html> tag.
<?php
session_start();
?>
Session_unregister(´varname´); unregisters a
session variable.
session_destroy() destroys a session
23. Page 23
Why use sessions
A normal HTML website will not pass data from one page to
another .
All information is forgotten when a new page is loaded
Many websites need to pass user data from one page to
another
o for tasks like a shopping cart, which requires data(the
user's selected product) to be remembered from one
page to the next
25. Page 25
PHP Forms - $_GET Function
The built-in $_GET function is used to collect values from a form
sent with method="get".
Information sent from a form with the GET method is visible to
everyone (it will be displayed in the browser's address bar) and
has limits on the amount of information to send (max. 3000
characters).
Notice how the URL carries the information after the file name.
26. Page 26
PHP Forms - $_POST Function
When to use method="post“
Information sent from a form with the POST method is invisible
to others and has no limits on the amount of information to
send. Note: However, there is an 8 MB max size for the POST
method, by default (can be changed by setting the
post_max_size in the php.ini file).
And here is what the code of action.php might look like:
27. Page 27
Framework - what is a PHP framework?
A framework gives you standard solutions to typical problems,
e.g. for an online shop that can cover the functionality for a
customer login (including session handling), a shopping cart,
placing orders...
The big advantage of using a framework is that
You don't need to reinvent the wheel, the code is already
there.
The code (usually) works, it is already tested.
Specifically for user authentication, you will most probably
have fewer security leaks as if you invented something
from scratch yourself
28. Page 28
The big disadvantage is that
If you want to extend the functionality, you have to
understand OPC (other peoples code).
If the framework contains a security hole and an exploit is
available, your site is immediately vulnerable, but you
may not have the knowledge to fix it yourself. So you
need to keep a constant lookout on security bulletins,
updates, fixes etc.
List of Popular PHP Frameworks:
1. Zend 4. Symfony
2. Laravel 5. Cake PHP
3. Phalcon 6. Code Igniter
Continue
29. Page 29
There are pretty good reasons to use the Frameworks:
Code and file organization is extremely easy
Countless numbers of tools and libraries that can help you
with:
Form validation
Database abstraction
Input / Output filtering
Session and Cookie handling
Email, Calendar and pagination and much more
MVC (Model View Controller) Architecture
Security - PHP has many input and output filtering functions
which can add extra security layer to protect your website
against certain attacks.
Why Framework ??
30. Page 30
CMS stands for Content Management System. It is a
application software which allows editing, publishing and
modifying content as well as website maintenance from a
central page.
CMS provides collections of methods and procedures which
are used to manage workflow in a collaborative
environment. These methods can be manual or in-build.
Using CMS, content can easily be managed, which include
audio and video files, computer files, and electronic
documents.
Content Management System is dynamic ,manages dynamic
contents such as shopping cart, bloggings etc.
Content Management System
31. Page 31
Advantages Of CMS Technology
Ease of use:
Creating a website without a CMS, no matter how trivial
requires some technical knowledge, which is hard to find
and expensive to buy.
Low cost:
Free is my favorite price! There are free versions of all CMS
application.
Collaborative :
CMS also incorporate a work flow engine and facilitate the
collaborative efforts of your staff in creating, editing, and
approving content before it gets published.
Security:
Many CMS store your information in a database system
where access control mechanisms can more easily restrict
access to your content..
32. Page 32
More than 68 million websites
utilize WordPress and is one of
the most popular blogging
platforms in the world. It hosts
multiple authors and includes a
huge plugin library. WordPress’
UI is easy to use where any user
can drop a theme, add plugins,
and start blogging within some
minutes. It also boasts of strong
SEO capabilities. It is highly
flexible and easy to use too. One
of its cons is its security since it
is often a target of hackers.
WordPress
33. Page 33
Joomla is an open-source
content management software
which incepted from Mambo. It
includes components, plugins,
templates, modules and
languages through which
developers can add several
capabilities like dynamic
content and search functions to
a web page. It was originally
designed as an enterprise-
grade CMS and hence can
handle a huge number of
articles than WordPress. It has
some learning curve and also
lacks SEO capabilities.
Joomla
34. Page 34
cPanel is a web based hosting control panel provided by many
hosting providers to website owners allowing them to manage
their websites from a web based interface. This program gives
users a graphical interface from which they can control their
portion of the Unix server. The tools provided are designed to
simplify running and controlling a website. It uses a tiered
structure that allows different levels of access. Administrators
and end users can control the different aspects of the server
and the website directly through their browser. cPanel is
generally accessed using https on port 2083 or simply by
adding “/cPanel” to the end of the host name.
Web Hosting