CECS 5100 User Session - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

CECS 5100 User Session

Description:

I will be making the word file available online and you have several days to ... present the user with a page thanking them for joining and inform them what ... – PowerPoint PPT presentation

Number of Views:46
Avg rating:3.0/5.0
Slides: 16
Provided by: greg254
Category:
Tags: cecs | session | thanking | user

less

Transcript and Presenter's Notes

Title: CECS 5100 User Session


1
CECS 5100User Session Files
  • Dr. Jones

2
Review
  • Assignment 1 (example)
  • Assignment 2 ?
  • Forms
  • Other Questions ?

3
Midterm Review
  • 20 points
  • Fill in the blanks
  • On Programming
  • On Concepts
  • On Process
  • Short Answers
  • I will be making the word file available online
    and you have several days to complete it.

4
User Session
  • Pages 203-212
  • Super Global _SESSION
  • Purpose Track a user between pages and when they
    later come back
  • Can avoid using Hidden value between forms
  • Warning Dont use for security. You cant be
    sure that an old session is the same person --
    just the same computer.

5
User Session
  • Assign User Session
  • Store Variables (array) Related to User Session
  • Like for storing preferences or other information
  • Tracking choices between forms

6
Files
  • Pages 213-236
  • Files allow us to store information
  • Next phase we will move from files to databases
  • Testing Files (p. 218)
  • file_exists(), is_file(), is_readable(), etc
  • Opening (p. 222)
  • fp fopen(filename, r)
  • fp is the variable that points to the file being
    open
  • Filename is the path and the name of the file to
    be opened
  • r is for read, it can be a for append, w for
    write, etc

7
Files
  • Read (p. 224, listing 11.9)
  • For assignment 3, read by line
  • fgets(), feof()
  • Write
  • Write overwrites a file -- from the beginning --
    thus can destroy data
  • Append (p. 228)
  • Append, adds to the of the file.
  • fputs()
  • Close
  • fclose()

8
Assignment 3 - Part 1
  • MEMBERSHIP_FILE
  • create a file named MEMBERSHIP_FILE
  • Upload or used an editor to create it
  • in that file place the following information
  • Greg,Jones,gjones_at_unt.edu,password
  • Gerald,Jones,gjones_at_unt.edu,test
  • place that file in the assignment directory. You
    will be reading and appending to that file for
    this assignment.
  • It has to be TEXT and each line has to contain a
    CR (carriage return)

9
Assignment 3 - Entry Page
  • Upon entry to the page, start or resume a session
    ID.
  • Note The session ID will be used to retain who
    the user is as they move between the different
    pages of this assignment and using session
    variables to track various states (have they
    logged in ?, etc).
  • The entry page will present a group or store
    front (of your own creation). Graphics, What we
    do, etc.
  • It will provide the user with the following
    links.
  • New Member
  • Membership Information

10
Assignment 3 - New Member
  • Present the user with a form asking for
  • First Name, Last Name, e-mail address
  • present a link back to the first page.
  • upon form submission
  • Check to ensure all fields have been entered
  • then check the above fields against the
    MEMBERSHIP_FILE (using the read file commands)
  • If all three fields exist in an entry stored in
    MEMBERSHIP_FILE, then inform the user that they
    are already a member and provide them a link to
    the membership information page.

11
Assignment 3 - New member
  • if they are not in the MEMBERSHIP_FILE
  • Generate a password (it doesn't have to be secure
    for this assignment)
  • append to the MEMBERSHIP_FILE the new members
    information in the format as provided for at the
    top of the assignment. First Name, Last Name,
    e-mail Address, and the password you just
    assigned -- all seperated by commas.
  • present the user with a page thanking them for
    joining and inform them what their new password
    is.
  • provide them with a link to home or to the
    membership information page

12
Assignment 3 - Member Info
  • if the session ID variable to indicate logged in
    or not shows that the user has already entered a
    password, then display the membership information
    and skip the rest of this task.
  • If not already logged in, then ask for the users
    First Name, Last Name, and Password

13
Assignment 3 - Member Info
  • Check the MEMBERSHIP_FILE for that information
  • If it exists in the MEMBERSHIP_FILE, set a
    session ID variable to indicate that the user is
    logged in and then display a page that shows all
    the information in the file for that user
  • If the First and Last Name match, but the
    password is wrong, say that the password is
    incorrect and provide a link to the password help
    page. Save the First and Last Name to session ID
    variables.
  • If first and last name do not exist, give the
    user an option of going to the new member page or
    home.

14
Assignment 3 - Password Help
  • Ask the user for their e-mail address
  • check the e-mail, first and last names (from
    session ID variable) and if they all match one in
    the MEMBERSHIP_FILE provide a page with the
    password for the user's entry.
  • If it doesn't exist in the MEMBERSHIP_FILE
    provide a page that says sorry not in the
    membership file and provide a link to home or new
    member.

15
Questions ??
Write a Comment
User Comments (0)
About PowerShow.com