PHP
  Home arrow PHP arrow Page 6 - Building an E-Commerce Site Part 2: Ma...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Building an E-Commerce Site Part 2: Managing Users with Sessions
By: Ying Zhang
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 30
    2000-05-16

    Table of Contents:
  • Building an E-Commerce Site Part 2: Managing Users with Sessions
  • Assumptions and Requirements
  • Primer on Sessions
  • User Management and Privileges
  • Step 1: Creating the Users Table
  • Step 2: Extracting the New Scripts
  • Step 3: General Script Changes from Tutorial 1
  • Step 5: User Scripts
  • Step 6: A Note on Security
  • Step 7: Putting It All Together

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Building an E-Commerce Site Part 2: Managing Users with Sessions - Step 2: Extracting the New Scripts


    (Page 6 of 10 )

    Okay, we've got our user table, let's make screens for the user to log in and log out. Download the mymarket2.tar.gz file and extract it into your web root directory. Note that this replaces the files from the first tutorial.

    IMPORTANT NOTE: If you have made modifications to the files from the first tutorial, please make a backup copy and store it somewhere else. The files in mymarket2.tar.gz will overwrite any changes you made to the files from the first tutorial.

    We do the same drill from the first tutorial. Download the mymarket2.tar.gz file and extract it into your web root directory. For example, if your web root is in

    type


    $ tar -zxf /tmp/mymarket2.tar.gz

    Assuming that you've downloaded mymarket2.tar.gz into /tmp. Now, open up the file application.php and change the $CFG->wwwroot and $CFG->dirroot paths to match your server configuration.

    Before we dive into the source code, let me explain how I've setup the directories and files. Once you go into the mymarket directory, you will see five directories, and four files. Everything in bold is new to this tutorial:


    drwxrws--- 2 ying web 1024 Apr 20 02:05 images/ drwxrws--- 2 ying web 1024 May 4 09:18 lib/ drwxrws--- 3 ying web 1024 May 9 11:20 templates/ drwxrwsr-x 3 lanuser web 1024 May 9 11:20 users/ -rw-rw---- 1 ying web 2074 May 7 14:58 application.php -rw-rw-r-- 1 lanuser web 1488 May 7 12:21 index.php -rw-rw-r-- 1 lanuser web 2427 May 7 14:51 login.php -rw-rw-r-- 1 lanuser web 1040 May 9 11:19 logout.php

    I won't go over the files and directories that were from the first tutorial (admin, images, lib, templates) except to say that the scripts inside them have changed a bit. Take a look at them and see if you can spot what's changed <grin>, just kidding, I will cover those as necessary :)

    The users directory is where we keep the scripts relating to user functions. For now, it contains scripts to let the users signup for an account, change their password, change their settings, and retrieve forgotten passwords.

    The index.php file is the MyMarket homepage. We didn't have one of these from part 1 of this guide because we were only interested in the administrative functions. We have it now only to show a dummy homepage (which we will add to in part 3 of this guide).

    The login.php and logout.php files handle the process of logging in and logging out. We've briefly gone over what was involved in logging in and logging out, see these scripts for more details.

    More PHP Articles
    More By Ying Zhang


     

       

    PHP ARTICLES

    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview
    - Handling Attachments in MIME Email with PHP
    - Completing the Project Management Application





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway