SlideShare a Scribd company logo
13
Most read
14
Most read
15
Most read
Session and cookies ,get and post methods
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.
Session and cookies ,get and post methods
Session and cookies ,get and post methods
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

PPTX
History of Database
PPT
Data mining-primitives-languages-and-system-architectures2641
PPTX
Difference between File system And DBMS.pptx
PDF
Introduction to Data Stream Processing
PPTX
Data warehouse and data mining
PPTX
ARTIFICIAL INTELLIGENCE
PPTX
Big data architecture
PPSX
planning & project management for DWH
History of Database
Data mining-primitives-languages-and-system-architectures2641
Difference between File system And DBMS.pptx
Introduction to Data Stream Processing
Data warehouse and data mining
ARTIFICIAL INTELLIGENCE
Big data architecture
planning & project management for DWH

What's hot (20)

PPT
Data mining techniques unit 1
PDF
Data Streaming For Big Data
PPSX
Parallel Database
PPTX
Mining single dimensional boolean association rules from transactional
PDF
Big data unit i
PPTX
Dbscan algorithom
PPTX
What is Machine Learning
PPTX
Query processing
PPTX
Boolean,vector space retrieval Models
PPTX
Data warehouse architecture
PPT
Data preprocessing in Data Mining
PPTX
Data definition language
PPTX
Data mining primitives
PPTX
Decision tree, softmax regression and ensemble methods in machine learning
PPTX
OLAP v/s OLTP
PPT
ADO .Net
PPT
Codd's rules
PPTX
Data Wrangling
PPTX
Data base management system
PPT
Session Tracking in servlets
Data mining techniques unit 1
Data Streaming For Big Data
Parallel Database
Mining single dimensional boolean association rules from transactional
Big data unit i
Dbscan algorithom
What is Machine Learning
Query processing
Boolean,vector space retrieval Models
Data warehouse architecture
Data preprocessing in Data Mining
Data definition language
Data mining primitives
Decision tree, softmax regression and ensemble methods in machine learning
OLAP v/s OLTP
ADO .Net
Codd's rules
Data Wrangling
Data base management system
Session Tracking in servlets
Ad

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

PPTX
Get and post,session and cookie
PPTX
Session,cookies and get and post methods
PDF
PHP Making Web Forms
PPTX
PDF
Introduction to php web programming - sessions and cookies
PPT
php $_GET / $_POST / $_SESSION
PDF
Form handling in php
PPTX
Form Handling using PHP
PDF
Web app development_cookies_sessions_14
PDF
GET and POST in PHP
PPT
Session,cookies
ODP
PHP BASIC PRESENTATION
PPTX
Web Techniques like Cookies and Sessions
PPTX
PHP 2
PPT
Session and cookies,get and post methods
PPT
Lecture 11 - PHP - Part 5 - CookiesSessions.ppt
PPTX
PHP SESSIONS & COOKIE.pptx
PPT
Php ssession - cookies -introduction
Get and post,session and cookie
Session,cookies and get and post methods
PHP Making Web Forms
Introduction to php web programming - sessions and cookies
php $_GET / $_POST / $_SESSION
Form handling in php
Form Handling using PHP
Web app development_cookies_sessions_14
GET and POST in PHP
Session,cookies
PHP BASIC PRESENTATION
Web Techniques like Cookies and Sessions
PHP 2
Session and cookies,get and post methods
Lecture 11 - PHP - Part 5 - CookiesSessions.ppt
PHP SESSIONS & COOKIE.pptx
Php ssession - cookies -introduction
Ad

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

PPTX
Agile methodology and scrum development
PDF
Acquiring new skills what you should know
PDF
Baabtra.com programming at school
PDF
99LMS for Enterprises - LMS that you will love
PPTX
Chapter 6 database normalisation
PPTX
Chapter 5 transactions and dcl statements
PPTX
Chapter 4 functions, views, indexing
PPTX
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
PPTX
Chapter 1 introduction to sql server
PPTX
Chapter 1 introduction to sql server
Agile methodology and scrum development
Acquiring new skills what you should know
Baabtra.com programming at school
99LMS for Enterprises - LMS that you will love
Chapter 6 database normalisation
Chapter 5 transactions and dcl statements
Chapter 4 functions, views, indexing
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 1 introduction to sql server
Chapter 1 introduction to sql server

Session and cookies ,get and post methods

  • 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.
  • 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

  • #5: 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.
  • #12: 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 .
  • #15: The GET method is restricted to send upto 1024 characters only.