SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Opinion Gurus please. Shopping Cart

    Am developing my own Cart Using PHP and MySQL its a good learning curve However; I cant help wondering the commend method in retrieving information from user, So far what i have found online is using the Session_id().


    Is using the Session_id() the commend way? The only way ?

    Is it sufficient to use the Session_id() as the only way to track user orders?


    Is it secure to use it ? or there is some considerations i need to keep in mind?


    Please enlighten me regarding these questions.




    Thank you
    Never be shy to ask silly Qs
    An answer is always better than none

  2. #2
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well.. You may want to use sessions to store login data for users (so they stay logged in while navigating your site).

    However, to keep track of orders, you'll want to store that in a database of some sort, otherwise you could have a very large session, and its not very practicle. What would happen if their computer crashed, or something happened, closed the browser, rebooted their computer, etc.. Their order (as in what they selected) would be lost. So I would strongly suggest a database.

    Also for sessions, you do it like this:

    PHP Code:
    <?php
    #This has to go at the top of EVERY page you use sessions on.
    session_start();

    $_SESSION["name"] = "This is the name session.. I guess";
    $_SESSION["password"] = "This is a password";

    echo 
    $_SESSION["name"];
    echo 
    "<br>";
    echo 
    $_SESSION["password"];

    #This destroys the session.
    session_destroy();
    ?>
    For further session functions, you will want to look through php.net's documentation regarding session_start(); and other stuff.

  3. #3
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Surgeon View Post
    Well.. You may want to use sessions to store login data for users (so they stay logged in while navigating your site).

    However, to keep track of orders, you'll want to store that in a database of some sort, otherwise you could have a very large session, and its not very practicle. What would happen if their computer crashed, or something happened, closed the browser, rebooted their computer, etc.. Their order (as in what they selected) would be lost. So I would strongly suggest a database.

    Also for sessions, you do it like this:

    PHP Code:
    <?php
    #This has to go at the top of EVERY page you use sessions on.
    session_start();

    $_SESSION["name"] = "This is the name session.. I guess";
    $_SESSION["password"] = "This is a password";

    echo 
    $_SESSION["name"];
    echo 
    "<br>";
    echo 
    $_SESSION["password"];

    #This destroys the session.
    session_destroy();
    ?>
    For further session functions, you will want to look through php.net's documentation regarding session_start(); and other stuff.

    Thanks for the fast reply I think i have to explain in more details my bad

    i Do keep track of the order in the Data Base and i relate the user with the record using Session_id() because thats what sources i have found online so far suggest to use that.

    Regarding the Issues like computer Crash Its ok because the Shop will be handling few products only so this feature is not very necessary however i will consider Adding Users Login very soon but at the time been am more concern about keeping track of orders and how to make them secure against alteration.

    I hope this will clear some of the Goals.
    Never be shy to ask silly Qs
    An answer is always better than none


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •