PHP CHAPTER 12
As a session progresses, the PHP application can store data in and retrieve data from the array for the session, which is named _______________________________.
$_SESSION
Which parameter of the session_set_cookie_params() function can be set so the cookie is only available on an HTTPS connection?
$secure
To get the value of a cookie, you can use the autoglobal ______________ variable. A. $_COOKIE B. $_SESSION C. $_GET D. $_EAT
A. $_COOKIE
Which PHP function is used to create a cookie? A. setcookie() B. $_COOKIE() C. create_cookie() D. make_cookie()
A. setcookie()
Once a session is started, which autoglobal can be used to get and set the user's data for a session A. $_COOKIE B. $_SESSION C. $_GET D. $_USER
B. $_SESSION
________________ provide a way for a web application to store information in the user's web browser and retrieve it every time the user requests a page. A. Bookmarks B. Cookies C. Favorites D. Status bars
B. Cookies
When you use session tracking, each HTTP request includes A. a URL that stores the session ID B. a cookie that stores the session ID C. a cookie that stores the session data D. a cookie that stores the session ID and the session data
B. a cookie that stores the session ID
The $_SESSION variable for a session A. is a regular array B. is an associative array C. is an object D. is a cookie
B. is an associative array
Which PHP function can be used to end a session? A. session_start() B. session_destroy() C. session_stop() D. session_remain()
B. session_destroy()
If a request is not sent, a session will end by default after ________________ have passed. A. 2 hours B. 5 minutes C. 24 minutes D. 30 seconds
C. 24 minutes
Which of the following is a parameter of the setcookie function? A. $name B. $value C. $expire D. all of these
D. all of these
To delete a cookie, you A. delete the $_COOKIE variable B. use the delete_cookie function C. use the remove_cookie function D. set the cookie's value to an empty string and its expiration date to a time in the past
D. set the cookie's value to an empty string and its expiration date to a time in the past
To create a persistent cookie, you set one of the __________________ of the setcookie function.
parameters
A cookie that does not expire when the user closes his or her browser is a(n) ________________ cookie.
persistent
A session ID lets PHP associate a user with the data that's stored in the related______________.
request (or session?)
A session starts when a browser makes its first request to a page that executes the ________________ function.
session_start()
Which PHP function is used to start a new session or resume a previous session?
session_start()
A cookie is a name/value pair that's stored in a __________________________.
browser
If necessary, you can use PHP functions to do all but one of the following. Which one is it? a. get the name of the session cookie b. get the session ID c. generate a new session ID d. get the data for a session ID
c. generate a new session ID
By default, PHP implements session tracking by using a __________________ to store a session ID in the user's browser.
cookie
What is the default name of a session cookie in PHP?
PHPSESSID
