Skip to content

Super Globals

IT Notes → PHP @ December 22, 2020

  • If register_globals turned ON the super globals will be stored in its corresponding local variables creating security issues. So, we need to initialize local variables before use.
  • session_start( ) => PHP will check to see whether the visitor sent a session cookie. If it did, PHP will load the session data. Otherwise, PHP will create a new session file on the server, and send an ID back — SESSID or whatever name in config file.
  • Clear session data for a user => $_SESSION = array(); session_destroy( ); For a particular session variable use unset.
  • Sessions store only Id in a cookie and it expires when browser closes. It cannot be used outside a specific web browser. The corresponding datafile is stored on the server.
  • Setcookie(name, value, expiry, path, domain, secure) //Before any html output.
  • Cookies are hackable and permanent, can work with cluster of web servers, set with first page and resent back with every page.
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x