get and post,session and cookie
DESCRIPTION
Ge tand post,session and cookieTRANSCRIPT
Yasirmusthafa [email protected]
mwww.facebook.com/
yasirmusthafatwitter.com/yasirmusthafappin.linkedin.com/in/
yasirmusthafapp8891396749
GET and POST,session and cookie
Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
GET & POST
• 2 methods• Form data sent from client to server
GET method
GET method• The data send along the query string<form action=“registration.php” method=“get”>• $_GET function is used to collect values in a
form with method=“get".• Can seen in the url• Can be bookmarked• Not suitable for sending password or sensitive
data• Cant send values exceeding 2000 characters
POST method
POST method
• $_POST function is used to collect values in a form with method="post".
<form action=“registration” method=“post”>• Invisible in url• Cant be bookmarked• Suitable for sending sensitive data• 8 mb size by default
GET & POST
GET
• Seen in url• Can be bookmarked• Not suitable for sending
sensitive data• Max size=2000 characters
POST
• Invisible in url• Cant bookmarked
• Suitable for sending sensitive data
• Max size=8 mb
Session &Cookie
• Used to maintain the states of http request
Session
• A PHP session variable is used to store information about, or change settings for a user session.
• Session variables hold information about one single user, and are available to all pages in one application.
Session
Starting php sessionSession_start()
Storing a session variable$_SESSION['intUserId']=$arrUser['pk_int_user_id'];//set session variable
Accessing a session variable$user_id=$_SESSION['intUserId'];
Destroying a session variable1. Unset($_SESSION[‘intUserId’])2. Session_destroy()
Cookie
• A cookie is often used to identify a user. • A cookie is a small file that the server embeds
on the user's computer. • Each time the same computer requests a page
with a browser, it will send the cookie too.
Cookie
Create cookiesetcookie("intUserId",$intValue,time()+600);//create cookie variable
Access cookie$intUserId=$_COOKIE['intUserId'];
Unset cookiesetcookie("intUserId", "", time()-600);//unset cookie
Session &Cookie
Session
• Stored in server• Lost when browser close
• Store string and object• Use future reference
cookie
• Stored in browser• Don’t lose when browser
close• Only store string
• Cant use
THANK YOU
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 StandMukkam, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550
Cafit Square,Hilite Business Park,Near Pantheerankavu,Kozhikode
Start up VillageEranakulam,Kerala, India.Email: [email protected]
Contact Us