Jump to content

rianquinn

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

rianquinn's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the help. After doing a lot more reading I came across some Third Party support for PayPal. Basically I can create my own cart (which will be simple compared to all of the AJAX I had to write for this site), and then send the cart contents to PayPal for processing. This should give me the control I want, without having to deal with credit cards. So I think PayPal is still an option, but e-junkie is definitely out of the question. Once again, thanks for your help. I learned a lot through this whole thing.
  2. Thanks everyone for your help. Please read the following http://www.e-junkie.com/bb/topic/3310/pg/0/?s1=51ab64&s2=3f542af1 Basically, its impossible. I will have to use another cart. Hopefully third times a charm. Rian
  3. My database has no cart information. I do have a user table, and I do keep track of a user_id, but in no way is this tied back to the cart. The only code that I have with regards to the cart is what they give me which is a little html and thats it. If I'm using something like e-junkie, or paypal, how would you even tell their cart what the current user_id is?
  4. I feel we are getting somewhere here. This is basically the same thing the PayPal guy said before he stopped answering my questions. My problem is that to integrate the cart into the site all you do is insert the code e-junkie spits out for you. So when you say, I don't exactly know what you mean. Is the cart expecting me to set some sort of conventional session variable? When you refer to user_id, what are you referring to? I do not store a "user_id" I store the user's "email"
  5. I did this test yesterday. The cart contents remain the same regardless of the session_id (which is changing). I can also change the session_name manually, and this breaks the entire site, but somehow the cart still has the contents. What I want to say is the cart is simply not tied to the session. But then where is the data being saved, and how do I clear it out?
  6. I'm not using anything third party. The only third party software I am running is jQuery. Other than that everything is my own. Also, I have been testing everything via MAMP. I have also tried this on my host "godaddy" and it is not working there either. When you refer to session management what do you mean? What I understand this to mean is utilizing php's session_<something> functions. Could the fact that I'm using AJAX being screwing something up? Thanks for all of your help
  7. I just tried this code and it also does not work. User B can still see user A's cart. What's really frustrating is that I cannot find any documentation on how to use something like e-junkie or PayPal other than to "insert this code into your site". Thats it. The only reason for using e-junkie and PayPal is that I do not want to store credit information on my site. I'd rather have someone else do that. How are other's doing this? Is there a better shopping cart to use?
  8. lol..... thats the exact code that I'm using (minus the session_regenerate_id you just suggested) and it doesn't seem to be working. Is it even possible to have a shopping cart like e-junkie tied to a user account?
  9. Just tried that and it didn't work Thanks, though. Any other suggestions?
  10. Can you suggest a good way to unset the cookies
  11. Sessions are unique to each visitor. If an existing cart can be seen by a different visitor it means you have logic error or a design problem in your code and this has nothing to do with the basic functioning of sessions and it has nothing to do with your logout code. How are your cart's stored and how do you relate that information to each visitor? I did not make the cart, I'm using PayPal's shopping cart and E-Junkie. All I have to do is add the "Add to Cart" and "View" buttons. Also, keep in mind you cannot see other user's cart contents if your in a different browser or on a different computer. Its only if your in the same browser, and on the same machine.
  12. Is "username" a php thing, or was it just an example. Currently, the username is there email. The following is my login function Keep in mind that everything is AJAX based. <?php /* Session is started first because PHP requires it first */ session_start(); /* If the session is still active, logout. */ if(session_is_registered('email')) { // Already logged in. echo "ALREADY_LOGGED_IN|" . $_SESSION['card_code'] . "|"; } else { /* Get the document root. */ $ROOT = $_SERVER['DOCUMENT_ROOT']; /* Include the database class. */ require_once $ROOT . '/assets/php/db.php'; /* Define the database. */ $db = new Database; /* Connect to the Database. */ $result = $db->connect(); /* Make sure the the connection was a success. Once a connection is made attempt to login the user. If the login fails, return the error, otherwise return success. */ if ($result == "SUCCESS") { $email = $_POST["email"]; $password = $_POST["password"]; # If the email is '0', this is a loggin attempt from an init function. # This login attempt should be ignored. if ($email == "0") { // Done. echo "IGNORE"; } else { # Login the user. echo login($db, $email, $password); } } else { # Return error. echo $result; } } /* *********************************************************************** */ /* The following function attempts to login the user. */ function login() { # Get the function arguments. $db = func_get_arg (0); $email = strtolower(func_get_arg (1)); $password = func_get_arg (2); # Get the user. $users = $db->user_select ($email, '', '', '*'); # Make sure there where no errors. if (is_string ($users)) { # Report error. return $users; } # Convert the user query to an array. $user = mysql_fetch_array ($users, MYSQL_ASSOC); # Clean up memory mysql_free_result ($users); # Define a salt for the md5 encryption. $salt = <something>; # Veifry the password. if (md5 ($salt . $password) != $user['password']) { # Report error. return "ERROR_INVALID_PASSWORD"; } else { # Login successful. Setup the session variables. $_SESSION['email'] = $email; $_SESSION['user_id'] = $user['id']; $_SESSION['card_code'] = $user['card_code']; # Done return "SUCCESS|" . $user['card_code'] . "|"; } } ?>
  13. If this code is correct, why are the shopping carts not clearing out? I have posted this question to the PayPal forums and the guy said it is because there is no difference between users http://www.pdncommunity.com/pdn/board/message?board.id=ppcart&thread.id=11266&view=by_date_ascending&page=1 I not sure if he's brushing me off, but he hasn't replied in two days now. I don't like PayPal anyways so I decided to try e-junkie and I like it much better but I get the same exact problem.
  14. I have a site that uses sessions. Users can register with my site, and then login, and logout. They can choose a product, and add it to their cart. Scenario: Suppose user A logs in, and adds an item to his/her cart. Then user A logs out. When User B logs in, and views his/her cart, he/she can see user A's cart contents. This happens with multiple shopping carts including PayPal and E-Junkie. These all use cookies they are said to be tied to the session. How do you clear them out. I have tried a lot. Currently my logout code is NOTE: This is straight from the php manual. Has anyone gotten PHP working with regards to user logins and shopping carts? <?php // Initialize the session. // If you are using session_name("something"), don't forget it now! session_start(); // Unset all of the session variables. $_SESSION = array(); // If it's desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } // Finally, destroy the session. session_destroy(); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.