close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Session not ending

Thread began 10/12/2009 8:34 am by 4egidio363291 | Last modified 10/23/2009 3:03 pm by Eric Mittman | 2921 views | 18 replies |

4egidio363291

Session not ending

When a user chooses to purchase another product, paypal says that the product has already been purchased. It also sometimes saves over the previous product purchased in the database. I don't think the session is ending.
I attached the necessary pages.

Thanks

Attached Files
Archive.zip
Sign in to reply to this post

Office Guy-172461

Maybe this will help

Cleaning all sessions after checkout
154/

Sign in to reply to this post

4egidio363291

not working

thanks for the tip, but I couldn't get it to work

anyone else?

Sign in to reply to this post

tom92909Beta Tester

Add the following to the bottom of your checkout success page...

php:
<?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();
?>
</body>
Sign in to reply to this post

4egidio363291

session

I already have that at the bottom of my checkout_success page.

Sign in to reply to this post

Eric Mittman

Have you tried adding the code in for regenerating the id like this:

php:
session_regenerate_id();



This may help if the problem is a persistent session id. However the code and troubleshooting tips that have been posted already should also be clearing out the session for you.

To test to see if your session is being cleared out properly just after the session destroy code that you have put in this code:

php:
var_dump($_SESSION);



This line of code should print out the contents of the session object and let you know exactly what is in the session at the end of this checkout success page.

Sign in to reply to this post

4egidio363291

session

Where do I add this code?

PHP Code:
session_regenerate_id();


To test to see if your session is being cleared out properly just after the session destroy code that you have put in this code:

PHP Code:
var_dump($_SESSION);
This line of code should print out the contents of the session object and let you know exactly what is in the session at the end of this checkout success page.

I already have that line:

<?php
// Initialize the session.
// If you are using session_name("something"), don't forget it now!
@session_start();
echo("Before destrying the session: ");
var_dump($_SESSION);
echo("<br />");
// 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();
echo("After destrying the session: ");
var_dump($_SESSION);
?>

I don't get to see the success page because it stops at the paypal page saying that the order has already been placed.

Sign in to reply to this post

Eric Mittman

I think the last part you said may be the key to this:

I don't get to see the success page

Since this code should be running on the success page if you do not get to it the sessions will not be cleared. You would not want to clear out the sessions before you get to this page, only after you get to this page.

You should try closing your browser and run another test knowing if you do not get to the success page the session variables will not be reset. Once you go through a transaction and get to the success page the variables will be reset and you will be able to test it again.

Sign in to reply to this post

4egidio363291

Session

I tried running a test purchase and keep getting the same error.

This invoice has already been paid. For more information, please contact the merchant.

Prior to this, I was able to make a purchase but then when I want to make another one I get stuck on the above error.

Please advise,
Thanks

Sign in to reply to this post

Eric Mittman

So that we are clear on what is happening are you saying that you cannot get a successful transaction regardless of how you test it? If you are getting this error when you try to transact there must be something to it.

To help determine what may be going wrong you should print out the values that you are passing to PayPal on this page you are getting to. You will need to have these values on the page and run a test, then close out the browser or use another one to run another test. On your next test you should compare what you have on this page with what you had during the first test. This will help to clear up what values are being passed to PayPal that may be a problem. If the problem is an invoice number then you should be looking at this value very closely.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...