PHP
  Home arrow PHP arrow Page 6 - Building an E-Commerce Site Part 2: Managing Users with Sessions
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
PHP

Building an E-Commerce Site Part 2: Managing Users with Sessions
By: Ying Zhang
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 31
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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

    - Adding Ordering and Grouping Clauses to the ...
    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek