Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lahore, Pakistan
    Posts
    150
    Thanks
    2
    Thanked 0 Times in 0 Posts

    problem in login page

    hi,

    i am just making a small cart. In which there is a members area. each member is signup to buy products. Suppose one user is login through its proper userid and password, and put his selected items in cart. And then that user go to the home page of the site.

    I want if user is already login through his userid and password, then my shopping cart did not ask the user to signin again, when he add another item to cart

    how can i implement this

  • #2
    New Coder
    Join Date
    Jul 2005
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts
    One solution of the problem is using cookies. You first check whether there is a user via cookie and if there is you don't open the login form else you will open the login form
    If you can not find a decision, maybe you have to try to change a problem

    http://www.gunman.co.nr
    http://bglinux.org

  • #3
    Regular Coder
    Join Date
    Dec 2002
    Location
    UK
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It depends, if you are storing sensitive data (what someone orders should be kept secret?) then sessions are the best choice.. Here is some pseudocode

    select the user from the user table where that users name is equal to $username and password is equal to md5($password)

    if that query returns 1 row then
    set the session variable to the value of $username

    To check if they are logged in (in code)..

    PHP Code:
    if(isset($_SESSION['sessionvar'])) {
       echo 
    "hello, you are logged in";
    } else {
       echo 
    "hello, you are not logged in"; } 


  •  

    Posting Permissions

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