Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Posting variables the impossible way!

Status
Not open for further replies.

Nicksta

Programmer
Joined
Jul 17, 2004
Messages
3
Location
ZA
Hi guys... you guys are my last resort. Im so stuck and annoyed.

Please take 5min to go to my site and have a look, sign up and user "Paygate" as your payment option :
Right, the problem, i hope someone can help! I use the OsCommerce solution for my website right, and we needed to add credit cards as a payment option. Now, not sure if im on the right track here or not but...

A user comes to the site, add things to basket, clicks checkout...has to fill in details etc...then choose shipping, and finally payment. For the payment the user is re-directed to a third party payment gateway(Setcom) - i post the total amount, user-email addy, shop name etc etc to setcom. The user enters his CC details and clicks confirm. Setcom is now meant to re-direct the user to my website, which it does...

Now the problem.

Because Setcom uses a set return url the session id is lost which means when the user gets back to my site it asks the user to log in. So i need to pass the session id along right?

Right, so thats what i tried to do until i hit more problems. Whats wrong with my code?

This is the info setcom sent me :

The ConfirmationURL is a URL that points to a script or template on your system that is able to accept certain variables through a normal HTTP post operation.
The HTTP post to the ConfirmationURL allows the merchant to receive new order details without having to log into the Commerce Manager.
If the ConfirmationURL is set to blank, this operation will not be performed.
The variables passed to the ConfirmationURL are as follows:
ordernumber - This is the unique OrderID created for every new order. This is Setcom's reference to the order and should be used when further queries are done on the order.
amount - The total amount of the order (shipping, tax etc included) in normal decimal format without currency symbol.
reference - This is your unique reference to the order, passed to Setcom in your pay-button.
authnumber - The authorization number returned from the bank for the transaction.
brandid - The brand used for the transaction. The brand ID's are as follows:
1. Visa
2. MasterCard
3. American Express
4. Diners
5. Direct Deposit
6. C.O.D.
7. SBM Cards


--------------------------------------------------------------------------------

Please enter your ConfirmationURL below (Include Confirmation URL:

Right, so what i do is write a script that has the following to push the variables to the right page :

<body onload="document.twocoprocessform.submit()">
<form name="twocoprocessform" method="POST" action=" <table cellpadding="0" width="100%" height="100%" cellspacing="0">
<tr>
<td align="middle" style="height:100%; vertical-align:middle;">
<?php
echo $_GET['ordernumber'];
echo $_GET['amount'];
$os = $_GET['reference'];
print "<input type=\"hidden\" name=\"osCsid\" value=\"$os\">\n";
echo $_GET['authnumber'];
echo $_GET['brandid'];
echo $osCsid;
?>

Thing is they all come out BLANK???? Any idea's why??

Thanks in advance for any help/advice...if im ever in your area i'll come drop off a crate of beers:)
 
The instructions:
The ConfirmationURL is a URL that points to a script or template on your system that is able to accept certain variables through a normal HTTP post operation.
specifically indicate that your routine is invoked as though it was from a form using "method=post". You are using the "GET" parameters. Change
Code:
    echo $_GET['ordernumber'];
    echo $_GET['amount'];
    $os = $_GET['reference'];
    print "<input type=\"hidden\" name=\"osCsid\" value=\"$os\">\n";
    echo $_GET['authnumber'];
    echo $_GET['brandid'];
    echo $osCsid;
to
Code:
    echo $_POST['ordernumber'];
    echo $_POST['amount'];
    $os = $_POST['reference'];
    print "<input type=\"hidden\" name=\"osCsid\" value=\"$os\">\n";
    echo $_POST['authnumber'];
    echo $_POST['brandid'];
    echo $osCsid;
and you should see information you're looking for.

Ken
 
Hi,

Thanks for the reply...

Just made a breakthrough and it all seems to work now!

Needed to change $_GET to $_REQUEST

Could somebody please explain the difference though please??
 
I strongly recommend that you not use $_REQUEST. It has some of the "variable poisoning" problems decribed in the "Using Register Globals" section of the manual.

If a "<form>" tag contains 'method="POST"', use $_POST. If the form contains 'method="GET"' or does not specify a method at all, use $_GET.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top