get and post,session and cookie

19

Upload: baabtracom-first-coding-school-in-india

Post on 20-May-2015

298 views

Category:

Technology


2 download

DESCRIPTION

Ge tand post,session and cookie

TRANSCRIPT

Page 1: Get and post,session and cookie
Page 2: Get and post,session and cookie

Yasirmusthafa [email protected]

mwww.facebook.com/

yasirmusthafatwitter.com/yasirmusthafappin.linkedin.com/in/

yasirmusthafapp8891396749

GET and POST,session and cookie

Page 3: 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

Page 4: Get and post,session and cookie

GET & POST

• 2 methods• Form data sent from client to server

Page 5: Get and post,session and cookie

GET method

Page 6: Get and post,session and cookie

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

Page 7: Get and post,session and cookie

POST method

Page 8: Get and post,session and cookie

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

Page 9: Get and post,session and cookie

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

Page 10: Get and post,session and cookie

Session &Cookie

• Used to maintain the states of http request

Page 11: Get and post,session and cookie

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.

Page 12: Get and post,session and cookie

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()

Page 13: Get and post,session and cookie

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.

Page 14: Get and post,session and cookie

Cookie

Create cookiesetcookie("intUserId",$intValue,time()+600);//create cookie variable

Access cookie$intUserId=$_COOKIE['intUserId'];

Unset cookiesetcookie("intUserId", "", time()-600);//unset cookie

Page 15: Get and post,session and 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

Page 16: Get and post,session and cookie

THANK YOU

Page 17: Get and post,session and cookie

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.

Page 18: Get and post,session and cookie

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

Page 19: Get and post,session and cookie

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