www.aryansexport.com

Download Report

Transcript www.aryansexport.com

PRACTICAL TRAINING PRESENTATION
SUBMITTED IN PARTIAL FULFILLMENT FOR THE
AWARD OF
BACHELOR’S DEGREE
OF
RAJASTHAN TECHNICAL UNIVERSITY
TRAINING AT:MAXHEAP
TECHNOLOGIES PVT LTD.
BANGALORE
Submitted By:
Veenu Prajapat
Batch: B3 Sem: VII Year: IV
Computer Science and Engineering
Jodhpur Institute of Engineering and Technology
www.powerpointpresentationon.blogspot.com
OVERVIEW:
ABOUT COMPANY:
•
• At MaxHeap Technologies Pvt Ltd, the focus is to
create innovative web applications to empower
Indian consumers and businesses to leverage
advancements in technology to improve their day
to day living and business.
• Product: CommonFloor is a platform to provide a
private portal for people in residential communities
and tools for Residents' Committees for a hassle
free apartment administration and is a great
information sharing medium for residents.
INTRODUCTION TO PHP
• PHP stands for: HyperText Preprocessor.
• It is a server side scripting language for making
logic driven websites.
• It is available free of charge.
• PHP is different from HTML in 2 ways:
 It is invisible to Website visitors.
 HTML can also be written inside the PHP
section of the page.
• Significant websites are written in PHP like
Wikipedia (MediaWiki), YouTube and Tagged.
WHAT IS AMP?
• A is for Apache:
It acts as Web server. Its main job is to parse any file
requested by a browser and display the correct
results according to the code within that file. It is a
freely available Web server.
M is for MySQL:
It is the database construct that enables PHP and
Apache to work together to access and display data
in a readable format to a browser. It is a Structured
Query Language.
•
• P is for PHP.
FEATURES OF PHP
• Used to create dynamic web pages.
• Freedom to choose any operating system and a
web server.
• Not constrained to output only HTML. PHP's
abilities include outputting images, PDF files etc.
• Support for a wide range of databases. Eg: dBase,
MySQL, Oracle etc.
• Support for talking to other services using protocols
such as IMAP, POP3, HTTP.
• PHP includes free and open source libraries with
the core build.
WORKING OF PHP
• URL is typed in the browser.
• The browser sends a request to the web server.
• The web server then calls the PHP script on that
page.
• The PHP module executes the script, which then
sends out the result in the form of HTML back to
PHP BASICS
• SYNTAX:
<?php
s1; s2; ?>
PHP only parses code within its delimiters.
PHP Basics includes:
1) CONSTANTS:
o Named with capital letters.
o Must begin with a letter or underscore .
o Cannot begin with a number.
o Case-sensitive.
Eg: define (“FAVMOVIE”, “The Life of Brian”);
2) VARIABLES:
o Prefixed with a dollar symbol.
o Type not to be specified.
o Variable name should not have spaces, dot or dashes but
underscore can be there.
o They need to be declared before adding a value to it.
Example: $s = “SR”;
3) DATATYPES:
o String
o Integer
o Boolean
o Float
o Object
o Resources
4) OPERATORS and OPERANDS:
Operands are the entities that have some values in them. The
operators are used to compare the two conditions .
5) COMMENTS:
// A comment on a single line
# Another single line comment
/* Multi-line comment */
6) DISPLAY STATEMENTS:
<?php echo "I like About" ?>
<?php print "I like About" ?>
7) ARRAYS:
It holds a string of related data.
8) CONDITIONAL STATEMENTS:
It allows our program to make choices.
9) LOOPS:
When we want the same block of code to run over & over again
in a sequence.
• while - loops through a block of code while the 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
10) FUNCTIONS:
WAYS TO REFER A
VARIABLE:
It depends on how they are being sent.
• $_GET[‘varname’]
• $_POST[‘varname’]
• $_SESSION[‘varname’]
• $_COOKIE[‘varname’]
• $_REQUEST[‘varname’]
• $_SERVER[‘varname’]
• $_FILES[‘varname’]
• $_ENV[‘varname’]
PASSING VARIABLES BETWEEN
PAGES:
There are four ways to do it.
1) Passing Variables Through a URL:
Values are passed through query string.
echo “<a href=’http://localhost/2.php?favmovie=ddlj’>
Click here </a>”;
Disadvantages:
• ❑ Everyone can see the values of the variables.
• ❑ The user can change the variable value in the
URL, which can lead to inconsistency of data.
• ❑ Pull up inaccurate or old information using a
2) Passing Variables Through Session:
A Session is a temporary set of variables that exists
only until the browser has shut down.
Every session is assigned a unique session ID,
which keeps all the current information together.
To begin a session: session_start(). It must be
used at the beginning of every page.
•
•
3) Passing Variables Through Cookie:
Cookies are tiny bits of information stored on
Website’s visitor’s computer.
The advantage to storing information in a cookie
versus a session is longevity.
To set a cookie: setcookie(name, value, expire,
path, domain);
•
•
4) Passing Variables Through Forms:
• Forms allow Web site to be truly interactive.
• Forms are coded in HTML and stay in HTML.
• A form is made up of four parts:
o Opening tag line, indicated by <FORM> tag.
o Content of the form, including input fields.
 Text
 Checkbox
 Radio
 Options
 Password
o Action button(s) or images typically submit/clear
or user-defined button.
o Closing tag line, indicated with </FORM> tag.
ABOUT MYSQL
• MySQL is a relational database system.
• It can store bits of information in separate tables
•
and link those tables together.
Each table consists of separate fields, which
represent each bit of information.
Field-Types:
char
varchar
int
text
decimal
time
•
•
•
•
•
•
SOME PHP FUNCTIONS FOR
MYSQL:
• mysql_connect ("hostname", "user", "pass");
• mysql_create_db("database name");
• mysql_select_db("database name");
• mysql_query("query");
• mysql_fetch_rows("results variable from query");
• mysql_error();
Querying the Database
SELECT [fieldnames]
AS [alias]
FROM [tablename]
WHERE [criteria]
ORDER BY [fieldname to sort on] [DESC]
GUEST-BOOK APPLICATION
• About Wamp Server:
o WampServer is a Windows web development
environment.
o The WampServer act as temporary hosting before website
or project is uploaded to real hosting.
o Type http://localhost to view the website.
• Database: guestbook
• Table-Name:
guestbook_comments
Field
Type
Null
seq_id
int(10)
No
GuestName
varchar(20)
No
Comment
varchar(100)
No
Time
timestamp
No
IP
varchar(16)
No
MAIN-VIEW OF GUEST-BOOK
Login-Form
When username &
password matches
When Admin deletes a
comment
When Admin log-out
INTRODUCTION TO MVC:
• Why MVC ?
o User interface logic tends to change more
frequently than business logic
o In some cases, the application displays the
same data in different ways.
o User interface code tends to be more devicedependent than business logic that enhances
the testability of the application.
• MVC:
o Stands for MODEL-VIEW-CONTROLLER.
o It is a pattern that separates the modelling of the
domain, the presentation, and the actions based
WHAT IS MODEL-VIEWCONTROLLER ?
• Input --> Processing --> Output
(Controller) --> (Model) --> (View)
• A model is an object representing data or even activity,
•
•
e.g. a database table or even some plant-floor
production-machine process.
A view is some form of visualization of the state of the
model.
A controller offers facilities to change the state of the
model.
• Main GOAL: To isolate UI changes and prevent
them from requiring changes to the Domain Logic
of the application.
INTER-RELATION:
• View Controller Relationship
o A controller accepts input from the user and instructs the
model and view to perform actions based on that input.
• Model View Relationship
o View attaches to a model and renders its contents to the
display surface.
• Model Controller Relationship
o A controller accepts input from the user and instructs the
model and view to perform actions based on that input.
ADVANTAGES &
DISADVANTAGES:
• Advantage is :
o Substitutable user interface.
o Multiple simultaneous views of the same model.
o Syncronized views.
o Easier user interface changes.
o Easier testing
• Disadvantage is :
o Strict separation between all three is difficult if
not impossible.
o Increases complexity.
THANK YOU FOR
YOUR ATTENTION..
Any Queries ?