Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Cookie in php its uses and types

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 45
    Comment on it

    Hello Readers

    A cookie is often used to identify a user. It is a small amount of information that sent by a server to a browser and after that sent back to the browser.

    The below is the syntax of cookie:

    Syntax:

    setcookie(name, value, expire, path, domain, secure, httponly);
    
    name: name of the cookie.
    
    value: value of the cookie stored in clients computer.
    
    expire: expiry date in unix timestamp format. After this time the cookie will become inaccessible.
    
    Path: server path for which the cookie will be available.
    
    Domain: to which domain the cooki is vailble.
    
    Secure: If set to true the cookie is available to secure connection.
    
    Httponly: If set true the cookie is available over http protocol only.
    

    Uses of cookie:

    1. Authentication.
    2. User tracking.
    3. Maintaining user preferences, shopping cart etc.
    

    Types of cookie:

    There are 2 types of cookie:

    1. Session cookie
    2. Persistent cookie
    
    1. Session cookie: It is one of the type of cookie, it is also called temprory cookie or non-persistent cookie. It is stored only on the browser memory.When we closed the browser the cookie will be erased.It can not be used for long term tracking information.

    2. Persistent cookie: It is another type of cookie, that is stored in a file on the browsers computer. It can be track long term information. In case, of security it is less secure as compared to session cookie because in this users can easily open the files, see the cookie or changes the values easily.

 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: