Your SlideShare is downloading. ×
0
WELCOME
MIDHUNSUDHAKAR
midhusudhakaran@gmail.com
Midhun.sudhakar.73@facebook.com
twitter.com/midhunopus
in.linkedin.com/pub/midhun...
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
docu...
content
•What are session and cookies
•How it works
•What are GET and POST methods
•examples
HTTP
•HTTP is a stateless protocol.
•Does not remember what happened between
two consecutive requests.
•Even two Requests ...
What is
cookie ?
•Cookies are small piece of data
•Stored in the users computer.
•it stores info about you and your
prefer...
For example.
It is not limited to remember just our languages.
•It can contain time you visited a web site.
•Or items in your shopping ...
Syntax and example
Syn:
Setcookie(name, value, expire, path, domain);
Ex:
setcookie("user", "Alex Porter", time()+3600);
c...
To Read Cookie Values
$_COOKIE['CookieName'];
$_REQUEST['CookieName'];
To Destroy a cookie
setcookie("user", "", time()-36...
•It is same like cookies
•But it stored in the server.
•Usually used for handle user info
about one session
•Default expir...
Syntax and example
Syn:
session_start();
$_SESSION[‘name']=value;
Ex:
$_SESSION[‘userid']=100;
Accessing session variable
$_SESSION['views'];
Destroying a Session
unset($_SESSION[‘userid']);
session_destroy();
click Me
Why GET and POST methods?
These are two ways the browser client can send
info to the web server.
GET method
•It sends only limited amount of data.
•Info send using GET method will appear in
browser URL
•PHP provides $_G...
example
<?php
if( $_GET["name"] || $_GET["age"] ) {
echo "Welcome ". $_GET['name']. "<br />";
echo "You are ". $_GET['age'...
POST method
• info sent by using POST method is not visible to
users.
•does not have any restriction on data size to be se...
example
<?php
if( $_POST["yourname"] || $_POST["yourage"] )
{
echo "Welcome ". $_POST['yourname']. "<br />";
echo "You age...
THANK YOU
Want to learn more about programming or Looking to become a good programmer?
Are you wasting time on searching so many con...
Follow us @ twitter.com/baabtra
Like us @ facebook.com/baabtra
Subscribe to us @ youtube.com/baabtra
Become a follower @ s...
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Sta...
Session,cookies  and get and post methods
Session,cookies  and get and post methods
Session,cookies  and get and post methods
Upcoming SlideShare
Loading in...5
×

Session,cookies and get and post methods

422

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
422
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
38
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Session,cookies and get and post methods"

  1. 1. WELCOME
  2. 2. MIDHUNSUDHAKAR midhusudhakaran@gmail.com Midhun.sudhakar.73@facebook.com twitter.com/midhunopus in.linkedin.com/pub/midhunsudhakar/86/a65/a9b/Phonenumber 9995586182 Session and cookies, GET and POST methods
  3. 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. 4. content •What are session and cookies •How it works •What are GET and POST methods •examples
  5. 5. HTTP •HTTP is a stateless protocol. •Does not remember what happened between two consecutive requests. •Even two Requests made by same user are different for HTTP. •HTTP just processes a client REQUEST and supplies the server RESPONSE.
  6. 6. What is cookie ? •Cookies are small piece of data •Stored in the users computer. •it stores info about you and your preferences.
  7. 7. For example.
  8. 8. It is not limited to remember just our languages. •It can contain time you visited a web site. •Or items in your shopping cart •Or even contain all the links your clicked.
  9. 9. Syntax and example Syn: Setcookie(name, value, expire, path, domain); Ex: setcookie("user", "Alex Porter", time()+3600); click ME
  10. 10. To Read Cookie Values $_COOKIE['CookieName']; $_REQUEST['CookieName']; To Destroy a cookie setcookie("user", "", time()-3600);
  11. 11. •It is same like cookies •But it stored in the server. •Usually used for handle user info about one session •Default expire time is 24mnts What is session ?
  12. 12. Syntax and example Syn: session_start(); $_SESSION[‘name']=value; Ex: $_SESSION[‘userid']=100;
  13. 13. Accessing session variable $_SESSION['views']; Destroying a Session unset($_SESSION[‘userid']); session_destroy(); click Me
  14. 14. Why GET and POST methods? These are two ways the browser client can send info to the web server.
  15. 15. GET method •It sends only limited amount of data. •Info send using GET method will appear in browser URL •PHP provides $_GET associative array to access info.
  16. 16. example <?php if( $_GET["name"] || $_GET["age"] ) { echo "Welcome ". $_GET['name']. "<br />"; echo "You are ". $_GET['age']. " years old."; } ?> <html> <body> <form action="<?php $_PHP_SELF ?>" method="GET"> Name: <input type="text" name="name" /> Age: <input type="text" name="age" /> <input type="submit" /> </form> </body> </html> clickME
  17. 17. POST method • info sent by using POST method is not visible to users. •does not have any restriction on data size to be sent. •PHP provides $_POST associative array to access
  18. 18. example <?php if( $_POST["yourname"] || $_POST["yourage"] ) { echo "Welcome ". $_POST['yourname']. "<br />"; echo "You age is ". $_POST['yourage']. " years."; exit(); } ?> <html> <body> <form action="<?php $_PHP_SELF ?>" method="POST"> Your Name: <input type="text" name="yourname" /> Your Age: <input type="text" name="yourage" /> <input type="submit" /> </form> </body> </html> click ME
  19. 19. THANK YOU
  20. 20. 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.
  21. 21. 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
  22. 22. 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
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×