Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Session

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 234
    Comment on it

    To make the data accessible across the website we need to use session.

    Session create a temporary file on the server where the registered data is stored and the data is made available to all pages.

    The location of the temporary file is determined by a setting in the php.ini file called session.save_path.

     

    When a session start

    PHP first create a unique identifier for that particular session which is a random string of 32 hexadecimal number.

    A PHPSESSID named cookie is called automatically and sent to the user computer to store unique session identification string.

    A file is created automatically on the server in the designated temporary directory.

     

    A PHP session is easily started by making a call to the session_start() function.

    we can use the constant SID which is defined if the session started if the user do not allow to get cookie.

     

    A session is closed when the user close the browser.

    isset() function is used to check if the session is set already or not.

    You do not need to call start_session() function to start a session if you can set session.auto_start variable to 1 in php.ini file.

    The htmlspecialchars() can be used when printing the SID in order to prevent XSS related attack.

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: