SlideShare a Scribd company logo
Sreyachandran.v
Sreta.chandran31@gmail.com
www.facebook.com/sreya
twitter.com/username
in.linkedin.com/in/profilename
Session, Cookies, GET and POST
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
HTTP
 HTTP is an TCP/IP based communication protocol, which is
used to deliver data (HTML files, image files, query results
etc) on the World Wide Web.
 It provides a standardized way for computers to communicate
with each other.
 HTTP is stateless. The server and client are aware of each
other only during a current request.
Cookies
• Cookie are small text files that website can leave on visitors
hard disk.
• Common use of cookies are:
• Remembering user name.
• Maintaining shopping cart.
• Keeping track of previously viewed content.
Creating Cookie
setcookie(“UserId” , ”1008” , ”time()+3600”);
Cookie variable Name
Cookie variable value
Expiration time
Accessing cookie
<?php
// Print a cookie
echo $_COOKIE[“UserId"];
// A way to view all cookies
print_r($_COOKIE);
?>
• The PHP $_COOKIE variable is used to retrieve a cookie
value.
Destroying cookie
• There is no special method to destroy a cookie, we can achieve
it by setting the cookie time into a past time so that it destroy
it.
setcookie(“UserId” , ”1008” , ”time()-100”);
Sessions
• A PHP session variable is used to store information about, or
change settings for a user session.
• The session values by default expire when the browser is
closed.
• Technically , session are just a form of cookies with out an
expiration date.
Session
• Session can be started in two ways in php.
• By calling the session.auto_start configuration setting in “php.in”.
• Calling session_start() on beginning of each pages whenever you
use session.
• Creating and accessing session.
• Once the session is started you can create and access session variables like any
other array variables.
$_SESSION[‘UserId']=1008;
GET and POST
• There are two methods that we can send form data from client
to server.
• GET allows you to send data as part of the query string.That
means data will be appended with the url.
• POST method transfers information via HTTP message body
The information is encoded and put into message body called
QUERY_STRING.
GET
• The PHP provides $_GET associative array to access all the
sent information using GET method.
• GET can't be used to send binary data, like images or word
documents, to the server.
http://www.test.com/index.htm?name1=value1&name2=value2
POST
• The POST method can be used to send ASCII as well as binary
data.
• The PHP provides $_POST associative array to access all the
sent information using POST method.
<form method="post" action="registration.php">
THANKYOU
Want to learn more about programming or Looking to become a good programmer?
Are you wasting time on searching so many contents online?
Do you want to learn things quickly?
Tired of spending huge amount of money to become a Software professional?
Do an online course
@ baabtra.com
We put industry standards to practice. Our structured, activity based courses are so designed
to make a quick, good software professional out of anybody who holds a passion for coding.
Follow us @ twitter.com/baabtra
Like us @ facebook.com/baabtra
Subscribe to us @ youtube.com/baabtra
Become a follower @ slideshare.net/BaabtraMentoringPartner
Connect to us @ in.linkedin.com/in/baabtra
Give a feedback @ massbaab.com/baabtra
Thanks in advance
www.baabtra.com | www.massbaab.com |www.baabte.com
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Cafit Square,
Hilite Business Park,
Near Pantheerankavu,
Kozhikode
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com
Contact Us

More Related Content

What's hot

Data types in php
Data types in phpData types in php
Data types in php
ilakkiya
 
Hypertext transfer protocol (http)
Hypertext transfer protocol (http)Hypertext transfer protocol (http)
Hypertext transfer protocol (http)
Shimona Agarwal
 
Introduction to JSON
Introduction to JSONIntroduction to JSON
Introduction to JSON
Kanda Runapongsa Saikaew
 
Database Connectivity in PHP
Database Connectivity in PHPDatabase Connectivity in PHP
Database Connectivity in PHP
Taha Malampatti
 
Dhcp
DhcpDhcp
Simple object access protocol(soap )
Simple object access protocol(soap )Simple object access protocol(soap )
Simple object access protocol(soap )
balamurugan.k Kalibalamurugan
 
Short notes of oop with java
Short notes of oop with javaShort notes of oop with java
Short notes of oop with java
Mohamed Fathy
 
SOAP - Simple Object Access Protocol
SOAP - Simple Object Access ProtocolSOAP - Simple Object Access Protocol
SOAP - Simple Object Access Protocol
Anushka Patil
 
Html formatting
Html formattingHtml formatting
Html formatting
Webtech Learning
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
Sahil Agarwal
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
WordPress Memphis
 
Array of objects.pptx
Array of objects.pptxArray of objects.pptx
Array of objects.pptx
RAGAVIC2
 
Get and post methods
Get and post methodsGet and post methods
Cookies and sessions
Cookies and sessionsCookies and sessions
Cookies and sessions
Sukrit Gupta
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state management
priya Nithya
 
HTTP Protocol Basic
HTTP Protocol BasicHTTP Protocol Basic
HTTP Protocol Basic
Chuong Mai
 
Form validation client side
Form validation client side Form validation client side
Form validation client side
Mudasir Syed
 
Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
Return on Intelligence
 
Ajax ppt
Ajax pptAjax ppt
Http protocol
Http protocolHttp protocol
Http protocol
Arpita Naik
 

What's hot (20)

Data types in php
Data types in phpData types in php
Data types in php
 
Hypertext transfer protocol (http)
Hypertext transfer protocol (http)Hypertext transfer protocol (http)
Hypertext transfer protocol (http)
 
Introduction to JSON
Introduction to JSONIntroduction to JSON
Introduction to JSON
 
Database Connectivity in PHP
Database Connectivity in PHPDatabase Connectivity in PHP
Database Connectivity in PHP
 
Dhcp
DhcpDhcp
Dhcp
 
Simple object access protocol(soap )
Simple object access protocol(soap )Simple object access protocol(soap )
Simple object access protocol(soap )
 
Short notes of oop with java
Short notes of oop with javaShort notes of oop with java
Short notes of oop with java
 
SOAP - Simple Object Access Protocol
SOAP - Simple Object Access ProtocolSOAP - Simple Object Access Protocol
SOAP - Simple Object Access Protocol
 
Html formatting
Html formattingHtml formatting
Html formatting
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Array of objects.pptx
Array of objects.pptxArray of objects.pptx
Array of objects.pptx
 
Get and post methods
Get and post methodsGet and post methods
Get and post methods
 
Cookies and sessions
Cookies and sessionsCookies and sessions
Cookies and sessions
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state management
 
HTTP Protocol Basic
HTTP Protocol BasicHTTP Protocol Basic
HTTP Protocol Basic
 
Form validation client side
Form validation client side Form validation client side
Form validation client side
 
Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
Http protocol
Http protocolHttp protocol
Http protocol
 

Similar to Session and cookies ,get and post methods

Php file upload, cookies & session
Php file upload, cookies & sessionPhp file upload, cookies & session
Php file upload, cookies & session
Jamshid Hashimi
 
Cookies & Session
Cookies & SessionCookies & Session
Cookie
CookieCookie
Session and cookies,get and post methods
Session and cookies,get and post methodsSession and cookies,get and post methods
Session and cookies,get and post methods
baabtra.com - No. 1 supplier of quality freshers
 
Sessions n cookies
Sessions n cookiesSessions n cookies
0_Leksion_Web_Servers (1).pdf
0_Leksion_Web_Servers (1).pdf0_Leksion_Web_Servers (1).pdf
0_Leksion_Web_Servers (1).pdf
Zani10
 
Hyper_Text_Transfer_Protocol_Presentation_
Hyper_Text_Transfer_Protocol_Presentation_Hyper_Text_Transfer_Protocol_Presentation_
Hyper_Text_Transfer_Protocol_Presentation_
RajaJain35
 
SCWCD : The web client model
SCWCD : The web client modelSCWCD : The web client model
SCWCD : The web client model
Ben Abdallah Helmi
 
Common Gateway Interface
Common Gateway InterfaceCommon Gateway Interface
Common Gateway Interface
Balu Masulkar
 
gdsc-html-ppt.pptx
gdsc-html-ppt.pptxgdsc-html-ppt.pptx
gdsc-html-ppt.pptx
yuvakiran15
 
SCWCD : The web client model : CHAP : 1
SCWCD  : The web client model : CHAP : 1SCWCD  : The web client model : CHAP : 1
SCWCD : The web client model : CHAP : 1
Ben Abdallah Helmi
 
446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)
446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)
446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)
nrvalluri
 
Fundamentals of Web for Non-Developers
Fundamentals of Web for Non-DevelopersFundamentals of Web for Non-Developers
Fundamentals of Web for Non-Developers
Lemi Orhan Ergin
 
Intro webapps
Intro webappsIntro webapps
Intro webapps
Howard Mao
 
Authentication methods
Authentication methodsAuthentication methods
Authentication methods
sana mateen
 
GET and POST in PHP
GET and POST in PHPGET and POST in PHP
GET and POST in PHP
Vineet Kumar Saini
 
HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
sanjoysanyal
 
Session,cookies and get and post methods
Session,cookies  and get and post methodsSession,cookies  and get and post methods
Session,cookies and get and post methods
baabtra.com - No. 1 supplier of quality freshers
 
HTML, CSS and XML
HTML, CSS and XMLHTML, CSS and XML
HTML, CSS and XML
Aashish Jain
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 

Similar to Session and cookies ,get and post methods (20)

Php file upload, cookies & session
Php file upload, cookies & sessionPhp file upload, cookies & session
Php file upload, cookies & session
 
Cookies & Session
Cookies & SessionCookies & Session
Cookies & Session
 
Cookie
CookieCookie
Cookie
 
Session and cookies,get and post methods
Session and cookies,get and post methodsSession and cookies,get and post methods
Session and cookies,get and post methods
 
Sessions n cookies
Sessions n cookiesSessions n cookies
Sessions n cookies
 
0_Leksion_Web_Servers (1).pdf
0_Leksion_Web_Servers (1).pdf0_Leksion_Web_Servers (1).pdf
0_Leksion_Web_Servers (1).pdf
 
Hyper_Text_Transfer_Protocol_Presentation_
Hyper_Text_Transfer_Protocol_Presentation_Hyper_Text_Transfer_Protocol_Presentation_
Hyper_Text_Transfer_Protocol_Presentation_
 
SCWCD : The web client model
SCWCD : The web client modelSCWCD : The web client model
SCWCD : The web client model
 
Common Gateway Interface
Common Gateway InterfaceCommon Gateway Interface
Common Gateway Interface
 
gdsc-html-ppt.pptx
gdsc-html-ppt.pptxgdsc-html-ppt.pptx
gdsc-html-ppt.pptx
 
SCWCD : The web client model : CHAP : 1
SCWCD  : The web client model : CHAP : 1SCWCD  : The web client model : CHAP : 1
SCWCD : The web client model : CHAP : 1
 
446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)
446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)
446-FUNDAMENTALS OF WEB FOR NON DEVELOPERS (Useful-Knowledge)
 
Fundamentals of Web for Non-Developers
Fundamentals of Web for Non-DevelopersFundamentals of Web for Non-Developers
Fundamentals of Web for Non-Developers
 
Intro webapps
Intro webappsIntro webapps
Intro webapps
 
Authentication methods
Authentication methodsAuthentication methods
Authentication methods
 
GET and POST in PHP
GET and POST in PHPGET and POST in PHP
GET and POST in PHP
 
HTTP Basics
HTTP BasicsHTTP Basics
HTTP Basics
 
Session,cookies and get and post methods
Session,cookies  and get and post methodsSession,cookies  and get and post methods
Session,cookies and get and post methods
 
HTML, CSS and XML
HTML, CSS and XMLHTML, CSS and XML
HTML, CSS and XML
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
 

More from baabtra.com - No. 1 supplier of quality freshers

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
baabtra.com - No. 1 supplier of quality freshers
 
Best coding practices
Best coding practicesBest coding practices
Core java - baabtra
Core java - baabtraCore java - baabtra
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php database connectivity
Php database connectivityPhp database connectivity
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Blue brain
Blue brainBlue brain
5g
5g5g
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Gd baabtra
Gd baabtraGd baabtra

More from baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Session and cookies ,get and post methods

  • 1.
  • 3. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 4. HTTP  HTTP is an TCP/IP based communication protocol, which is used to deliver data (HTML files, image files, query results etc) on the World Wide Web.  It provides a standardized way for computers to communicate with each other.  HTTP is stateless. The server and client are aware of each other only during a current request.
  • 5. Cookies • Cookie are small text files that website can leave on visitors hard disk. • Common use of cookies are: • Remembering user name. • Maintaining shopping cart. • Keeping track of previously viewed content.
  • 6.
  • 7.
  • 8. Creating Cookie setcookie(“UserId” , ”1008” , ”time()+3600”); Cookie variable Name Cookie variable value Expiration time
  • 9. Accessing cookie <?php // Print a cookie echo $_COOKIE[“UserId"]; // A way to view all cookies print_r($_COOKIE); ?> • The PHP $_COOKIE variable is used to retrieve a cookie value.
  • 10. Destroying cookie • There is no special method to destroy a cookie, we can achieve it by setting the cookie time into a past time so that it destroy it. setcookie(“UserId” , ”1008” , ”time()-100”);
  • 11. Sessions • A PHP session variable is used to store information about, or change settings for a user session. • The session values by default expire when the browser is closed. • Technically , session are just a form of cookies with out an expiration date.
  • 12. Session • Session can be started in two ways in php. • By calling the session.auto_start configuration setting in “php.in”. • Calling session_start() on beginning of each pages whenever you use session. • Creating and accessing session. • Once the session is started you can create and access session variables like any other array variables. $_SESSION[‘UserId']=1008;
  • 13. GET and POST • There are two methods that we can send form data from client to server. • GET allows you to send data as part of the query string.That means data will be appended with the url. • POST method transfers information via HTTP message body The information is encoded and put into message body called QUERY_STRING.
  • 14. GET • The PHP provides $_GET associative array to access all the sent information using GET method. • GET can't be used to send binary data, like images or word documents, to the server. http://www.test.com/index.htm?name1=value1&name2=value2
  • 15. POST • The POST method can be used to send ASCII as well as binary data. • The PHP provides $_POST associative array to access all the sent information using POST method. <form method="post" action="registration.php">
  • 17. Want to learn more about programming or Looking to become a good programmer? Are you wasting time on searching so many contents online? Do you want to learn things quickly? Tired of spending huge amount of money to become a Software professional? Do an online course @ baabtra.com We put industry standards to practice. Our structured, activity based courses are so designed to make a quick, good software professional out of anybody who holds a passion for coding.
  • 18. Follow us @ twitter.com/baabtra Like us @ facebook.com/baabtra Subscribe to us @ youtube.com/baabtra Become a follower @ slideshare.net/BaabtraMentoringPartner Connect to us @ in.linkedin.com/in/baabtra Give a feedback @ massbaab.com/baabtra Thanks in advance www.baabtra.com | www.massbaab.com |www.baabte.com
  • 19. Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Cafit Square, Hilite Business Park, Near Pantheerankavu, Kozhikode Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com Contact Us

Editor's Notes

  1. As mentioned above, HTTP is a connectionless and this is a direct result that HTTP is a stateless protocol. The server and client are aware of each other only during a current request. Afterwards, both of them forget about each other. Due to this nature of the protocol, neither the client nor the browser can retain information between different request across the web pages.
  2. A PHP session variable is used to store information about, or change settings for a user session A PHP session store user information on the server for later use . session information is temporary and will be deleted after the user has left the website. Sessions work by creating a unique id (UID) for each visitor and store variables based on this UID. Session is available as long as the browser is opened .
  3. The GET method is restricted to send upto 1024 characters only.