Html Forms Handling - Study Mode

[#1] Which function is used to erase all session variables stored in the current session?
Correct Answer

(D) session_unset()

Explanation

Solution: This will not completely remove the session from the storage mechanism. If you want to completely destroy the session, you need to use the function session_destroy().

[#2] What will the function session_id() return is no parameter is passed?
Correct Answer

(A) Current Session Identification Number

[#3] An attacker somehow obtains an unsuspecting user’s SID and then using it to impersonate the user inorder to gain potentially sensitive information. This attack is known as.
Correct Answer

(A) session-fixation

Explanation

Solution: You can minimize this risk by regenerating the session ID on each request while maintaining the session-specified data. PHP offers a convenient function named session_regenerate_id() that will replace the existing ID with a new one.

[#4] Which parameter determines whether the old session file will also be deleted when the session ID is regenerated?
Correct Answer

(B) delete_old_session

Explanation

Solution: By default, this behavior is disabled.

[#5] Which function effectively deletes all sessions that have expired?
Correct Answer

(C) session_garbage_collect()