Session Management - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Session Management

Description:

For all keys set by the session software developer. The Session Approach ... as the first line in the PHP script, PHP does the rest. PHP Sessions ... – PowerPoint PPT presentation

Number of Views:85
Avg rating:3.0/5.0
Slides: 14
Provided by: jackbe7
Category:

less

Transcript and Presenter's Notes

Title: Session Management


1
Session Management
2
Session
  • A series of transactions between a browser and
    server.

3
The Issue
  • Passing information between the browser and
    server over the series of transactions

4
The Hidden Approach
  • Use hidden input tags in a form to send
    information from the server to the browser and
    back to the server for the next part of the
    transaction

5
Analysis Hidden Approach
  • Pretty simple and straightforward.
  • The Concern a view source of the HTML page can
    reveal the contents of the hidden tags, which may
    cause a security breach.
  • Remember, the pages might be cached, so someone
    else can view the cache and view the hidden tags.

6
The Session Approach
  • Instead of passing information to the browser, a
    unique Session ID is passed to the browser.
    Information is maintained on the server in a
    temporary file that is associated to the Session
    ID

7
The Session Approach
  • When the reply is returned from the browser, the
    Session ID is returned with the form
    information.

8
The Session Approach
  • The server matches up the Session ID with the
    appropriate temporary file and restores the
    information that was saved is placed in the
    session hash
  • _SESSIONkey
  • For all keys set by the session software
    developer

9
The Session Approach
  • If the session is continued, the contents of
    _SESSION is saved in a temporary file associated
    with the Session ID, and the session continues.

10
PHP Sessions
  • All you do is include the statement,
  • session_start()
  • as the first line in the PHP script, PHP does
    the rest.

11
PHP Sessions
  • To place the current contents of a variable into
    session hash,
  • _SESSIONnamename
  • To restore a variable,
  • name _SESSIONname
  • To erase a variable from the session hash,
  • session_unregister(name)

12
PHP Sessions
  • The contents of _SESSION is save in the
    temporary file when the script terminates
    successfully.

13
Passing The Session ID
  • Take all the PHP defaults and it is handled
    automatically.
  • Otherwise, you are on your own.
Write a Comment
User Comments (0)
About PowerShow.com