Skip to content

Latest commit

 

History

History
73 lines (64 loc) · 4 KB

n6ba.md

File metadata and controls

73 lines (64 loc) · 4 KB

Stars Badge Forks Badge Pull Requests Badge Issues Badge GitHub contributors Visitors

Don't forget to hit the ⭐ if you like this repo.

PHP: Form & Session & Cookies

Set B

  1. a) $_POST
  2. b) By checking if $_SERVER['REQUEST_METHOD'] is equal to 'POST'
  3. a) session_start()
  4. a) By assigning a value to $_SESSION['variable']
  5. a) To destroy all session data
  6. a) By accessing $_SESSION['variable']
  7. a) setcookie()
  8. a) By accessing $_COOKIE['cookieName']
  9. a) By setting the cookie with an empty value and an expired timestamp
  10. a) To convert special characters to HTML entities
  11. a) isset()
  12. a) By using htmlspecialchars() to encode the output
  13. a) isset()
  14. a) By setting the cookie with an expiration timestamp in the future
  15. a) To regenerate the session ID to prevent session fixation attacks
  16. a) By assigning the array to $_SESSION['variable']
  17. c) is_null()
  18. a) By accessing $_POST['fieldname']
  19. a) To close the session and write session data
  20. a) By regenerating the session ID after successful login
  21. a) session_id()
  22. a) By using the unset() function on $_SESSION['variable']
  23. a) To remove all session variables
  24. a) By setting the cookie with an expiration timestamp in the past
  25. a) To retrieve the current session ID
  26. a) By using empty($_SESSION['variable'])
  27. d) ini_set('session.gc_maxlifetime')
  28. a) By using empty($_COOKIE['cookieName'])
  29. a) To encode a string for safe use in a URL
  30. a) By using the count() function on $_SESSION['array']
  31. a) session_is_active()
  32. a) By using isset($_POST['checkboxName'])
  33. a) To perform garbage collection on expired session data
  34. a) By serializing an array and assigning it to the cookie value
  35. a) session_is_started()
  36. a) By using a secure session ID generated with a secret key
  37. a) By using empty($_SESSION)
  38. a) To discard session changes and close the session
  39. a) By checking if a session variable representing the user's login status is set
  40. d) $_COOKIE['secure']
  41. a) By setting the HttpOnly flag when setting session cookies
  42. a) To perform garbage collection on expired session data
  43. a) By modifying the session.gc_maxlifetime configuration directive
  44. a) $_COOKIE['cookieName']
  45. a) By checking if a session variable representing the user's admin status is set to true
  46. a) To destroy all session data
  47. a) By accessing $_COOKIE['cookieName']
  48. d) setcookie() function with the domain parameter
  49. a) By regenerating the session ID after successful login
  50. b) To set the save path for session files

Contribution 🛠️

Please create an Issue for any improvements, suggestions or errors in the content.

You can also contact me using Linkedin for any other queries or feedback.

Visitors