Passing Hidden Form Data in a session post - php

I have to submit this form to a payment processing gateway on my PHP page. All the credit card payment information will be taken on the next screen but the gateway needs the "HostedKey" and "Gateway_ID" need to be invisible from public code view as well.
<form action="nextpage.php" method ="POST" target="_blank">
Patient Account Number:
<input type="text" name="CustRefID" id="CustRefID">
<input type="hidden" name="HostedKey" id="HostedKey" value="ZZZZZZ" />
<input type="hidden" name="Gateway_ID" id="Gateway_ID" value="XXXXXX" />
<input type="hidden" name="IndustryCode" id="IndustryCode" value="2" />
<input type="hidden" name="Amount" id="Amount" value="" />
<input type="hidden" name="RecurringType" id="RecurringType" value="N" />
<input type="hidden" name="RecurringAmount" id="RecurringAmount" value="" />
<input type="hidden" name="CURL" id="CURL" value="back to my site" />
<input type="hidden" name="AVSRequired" id="AVSRequired" value="Y"/>
<input type="hidden" name="CVV2Required" id="CVV2Required"value="Y"/>
<input type="hidden" name="EmailRequired" id="EmailRequired" value="Y"/>
<input type="hidden" name="PostRspMsg" id="PostRspMsg" value="Y"/>
<input type="hidden" name="SECCode" id="SECCode" value="1" />
<input type="hidden" name="Descriptor" id="Descriptor" value="Online" />
<input type="Submit" name="Submit" id="Submit" value="Pay Online Now" />
</form>
I tried something like this. It hid the Key and ID but the form did not pass on the hidden session variables.
<strong>Patient Account Number: </strong>
<form action="nextpage.php" method"post">
<input type="text" name="CustRefID"/>
<input type="hidden" name="HostedKey" id="HostedKey" value="" />
<input type="hidden" name="Gateway_ID" value="<?php ($Gateway_ID); ?>" />
<input type="hidden" name="HostedKey" value="<?php ($HostedKey); ?>" />
<input type="submit" name="Submit" value="Submit" />
</form>
<?php
if (isset($_POST['Submit']))
{ $_session['CustRefID'] = $_POST['CustRefID'];}
{ $_session['HostedKey'] = $_POST['xxxxxx'];}
{ $_session['Gateway_ID'] = "zzzzzz";}
?>
<strong><? echo $_session['CustRefID'];?></strong>
Any help would be great. My programmer is out sick...

You have repetition in your HTML. Change it to this:
<input type="hidden" name="Gateway_ID" value="<?php ($Gateway_ID); ?>" />
<input type="hidden" name="HostedKey" value="<?php ($HostedKey); ?>" />
2. You didn't specify what POST info should go in the SESSION. Change it to this:
{
$_SESSION['CustRefID'] = $_POST['CustRefID'];
$_SESSION['HostedKey'] = $_POST['HostedKey'];
$_SESSION['Gateway_ID'] = $_POST['HostedKey'];
}

Related

does not work recurring paypal sandbox

my php code generates html form which is submitting automatically with redirection of customers:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" name="vm_paypal_form" id="vmPaymentForm" accept-charset="UTF-8">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="cmd" value="_xclick-subscriptions" />
<input type="hidden" name="business" value="bolpav#example.com" />
<input type="hidden" name="custom" value="otmjboutim6sl98u6olis61nm7" /
><input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="return" value="http://example.com/devportal/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=3L99030&pm=1&Itemid=166&lang=" />
<input type="hidden" name="notify_url" value="http://example.com/devportal/index.php?option=com_virtuemart&view=vmplg&task=notify&tmpl=component&lang=" />
<input type="hidden" name="cancel_return" value="http://example.com/devportal/index.php?option=com_virtuemart&view=vmplg&task=pluginUserPaymentCancel&on=3L99030&pm=1&Itemid=166&lang=" />
<input type="hidden" name="rm" value="1" />
<input type="hidden" name="bn" value="VirtueMart_Cart_PPA" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="image_url" value="http://example.com/devportal/images/virtuemart/vendor/" />
<input type="hidden" name="item_name" value="Order Number: 3L99030" />
<input type="hidden" name="lc" value="EN" />
<input type="hidden" name="a3" value="105" />
<input type="hidden" name="p3" value="1" />
<input type="hidden" name="t3" value="M" />
<input type="hidden" name="src" value="1" />
<input type="hidden" name="srt" value="52" />
<input type="hidden" name="sra" value="1" />
<input type="submit" value="Please wait while redirecting to PayPal" />
</form>
After this form is submited i see page with order number, price and message : ". To complete your checkout using PayPal, please log in." After i click Login button then it redirects me to login page . But after i login then it open dasboard and forgets about payment . So payment procedure gets broken. I am using Sanbox business account for seller and sandbox personal account for customer. Can anybody help?
It seems to be a known issue at PayPal's end. The engineering team is working on this for a fix. Will update here once it gets fixed.

Paypal sandbox - your shoping cart is empty after i post variables with form?

I have a problem after I am redirected on paypal site. It display error -> your shopping cart is empty. No idea what is wrong. Thank you.
HTML:
<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" value="_cart" name="cmd">
<input type="hidden" value="1" name="upload">
<input type="hidden" value="jax.cj#seznam.cz" name="business">
<input type="hidden" value="super tričko" name="item_name_0">
<input type="hidden" value="1000" name="amount_0">
<input type="hidden" value="1" name="quantity_0">
<input type="hidden" value="" name="custom">
<input type="hidden" value="https://www.yoursite.com/storescripts/my_ipn.php" name="notify_url">
<input type="hidden" value="https://www.yoursite.com/checkout_complete.php" name="return">
<input type="hidden" value="2" name="rm">
<input type="hidden" value="Return to The Store" name="cbt">
<input type="hidden" value="https://www.yoursite.com/paypal_cancel.php" name="cancel_return">
<input type="hidden" value="CZ" name="lc">
<input type="hidden" value="CZK" name="currency_code">
<input type="image" alt="Make payments with PayPal - its fast, free and secure!" name="submit" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif">
</form>
Your item variables should start with 1 instead of 0. This is how your item related variables should look like:
<input type="hidden" value="super tričko" name="item_name_1">
<input type="hidden" value="1000" name="amount_1">
<input type="hidden" value="1" name="quantity_1">

php forms: value="<?php=$_POST['total_amount']?> vs. value="<?=$_POST['total_amount']?>

My form is generating an error when I use:
<input type="hidden" name="total_amount" value="<?php=$_POST['total_amount']?>" />
however it works fine when I use:
<input type="hidden" name="total_amount" value="<?=$_POST['total_amount']?>" />
I thought it was insecure to use <?= instead of <?php.
Here is the complete form:
<form name="save_file" action="cyprus_funds_transfer.php" method="post" enctype="multipart/form-data">
<? if($_POST['value_type'] == 1) {?>
<input type="hidden" name="amount" value="<?php=$_POST['account_number']?>" />
<input type="hidden" name="value_type" value="1" />
<input type="hidden" name="total_amount" value="<?php=$_POST['total_amount']?>" />
<? } else { ?>
<input type="hidden" name="amount" value="<?php=$_POST['amount']?>" />
<input type="hidden" name="value_type" value="0" />
<? } ?>
<input type="hidden" name="to" value="<?php=$_POST['send_to']?>" />
<input type="hidden" name="from" value="<?php=$_POST['send_from']?>" />
<input type="hidden" name="message" value="<?php=$_POST['message']?>" />
<input type="hidden" name="mode" value="save" />
<input type="hidden" name="order_id" value="<?php=$order_id?>" />
<input type="hidden" name="email_id" value="<?php=$_POST['email_id']?>" />
</form>
This is wrong way
<?php=$_POST['send_to']?>
this is correct way
<?=$_POST['send_to']?> is similar to <?php echo $_POST['send_to']; ?>
Codepad
Try to replace
<?php=$_POST['send_to'];?>
to this
<?=$_POST['send_to'];?>
or with this
<?php echo $_POST['send_to'];?>

regex to replace all from value - php

Hello I need to pull out the value of the input that has the name ending in "message" and replace the whole thing with the match. It needs to be a replace. any ideas what the regex is for this?
Thank you for the help.. Cheers -Jeremy
I have tried alot and this is the last one
patteren
/.*?(message" value="(.*?)").*?/is
replacement
$2
wanting
The value specified for &quot;Email&quot; is already in use by another registered user
in
<input type="hidden" name="cntnt01message" value="The value specified for &quot;Email&quot; is already in use by another registered user" />
for this content
<form id="cntnt01moduleform_1" method="post" action="http://www..com/account/registration.html" class="cms_form">
<div class="hidden">
<input type="hidden" name="mact" value="SelfRegistration,cntnt01,default,0" />
<input type="hidden" name="cntnt01returnid" value="60" />
<input type="hidden" name="cntnt01assign" value="CONT" />
<input type="hidden" name="cntnt01returnid" value="60" />
<input type="hidden" name="cntnt01input_username" value="s" />
<input type="hidden" name="cntnt01input_Salon" value="s" />
<input type="hidden" name="cntnt01input_Hairstylist" value="s" />
<input type="hidden" name="cntnt01input_email" value="s#cableone.net" />
<input type="hidden" name="cntnt01input_email_again" value="s#cableone.net" />
<input type="hidden" name="cntnt01input_Firstname" value="s" />
<input type="hidden" name="cntnt01input_Lastname" value="Bass" />
<input type="hidden" name="cntnt01input_phone" value="208-s-s" />
<input type="hidden" name="cntnt01input_Street" value="s21st ave" />
<input type="hidden" name="cntnt01input_city" value="s" />
<input type="hidden" name="cntnt01input_state" value="Idaho" />
<input type="hidden" name="cntnt01input_zip" value="s" />
<input type="hidden" name="cntnt01input_Description" value="" />
<input type="hidden" name="cntnt01input_services" value="Color,Perm/Relaxer,Sisterlocks®,Braiding" />
<input type="hidden" name="cntnt01orig_url" value="http://www..com/account/registration.html?mact=SelfRegistration,cntnt01,default,0&amp;cntnt01returnid=60&amp;cntnt01group=Platinum&amp;cntnt01pkg=4" />
<input type="hidden" name="cntnt01group_id" value="4" />
<input type="hidden" name="cntnt01pkg" value="4" />
<input type="hidden" name="cntnt01submit
" value="" />
<input type="hidden" name="cntnt01error" value="1" />
<input type="hidden" name="cntnt01message" value="The value specified for &quot;Email&quot; is already in use by another registered user" />
</div>
You're looking for .? (0 or 1 of any character except a new line). I think you should look for [^"]+ i.e.: /message" value="([^"]+)"/is and replace with $1 (not sure why the other brackets are there unless that's for something else).

Paypal IPN not responding at all

Anybody having this problem? Suddenly paypal is not returning POST data to the notify_url. Array is completely empty and it happens when payment is made through new paypal checkout system.
Below is the final page after payment is made. When I click continue booking, it should have redirected to notify_url with POST data for validation and stuff but data is an empty array.
My request code is listed below. Can anybody please take a look at it and tell me whether some variable is missing or i am doing something wrong?
<form method="post" name="paypal_form" action="http://www.sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" name="business" value="ayaz.a_1286483626_biz#gmail.com" />
<input type="hidden" name="cmd" value="_xclick" />
<!-- the next three need to be created -->
<input type="hidden" name="return" value="https://system1.smanager.net/SM/lib/booking_system/response.php" />
<input type="hidden" name="cancel_return" value="https://system1.smanager.net/SM/lib/booking_system/paypal_ipn.php?cancelled=true" />
<input type="hidden" name="notify_url" value="https://system1.smanager.net/SM/lib/booking_system/response.php" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="bn" value="toolkit-php" />
<input type="hidden" name="cbt" value="Continue Back to Booking System" />
<!-- Payment Page Information -->
<input type="hidden" name="no_shipping" value="" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="cn" value="Comments" />
<input type="hidden" name="cs" value="" />
<!-- Product Information -->
<input type="hidden" name="item_name" value="TestProduct" />
<input type="hidden" name="amount" value="10.23" />
<input type="hidden" name="quantity" value="1" />
<input type="hidden" name="item_number" value="1234" />
<input type="hidden" name="undefined_quantity" value="" />
<input type="hidden" name="on0" value="" />
<input type="hidden" name="os0" value="" />
<input type="hidden" name="on1" value="" />
<input type="hidden" name="os1" value="" />
<!-- Shipping and Misc Information -->
<input type="hidden" name="shipping" value="0.0" />
<input type="hidden" name="shipping2" value="" />
<input type="hidden" name="handling" value="" />
<input type="hidden" name="tax" value="6" />
<input type="hidden" name="custom" value="somedata" />
<input type="hidden" name="invoice" value="" />
<!-- Customer Information -->
<input type="hidden" name="first_name" value="ayaz" />
<input type="hidden" name="last_name" value="alavi" />
<input type="hidden" name="address1" value="Address" />
<input type="hidden" name="address2" value="" />
<input type="hidden" name="city" value="" />
<input type="hidden" name="state" value="abc" />
<input type="hidden" name="zip" value="" />
<input type="hidden" name="email" value="ayaz.a_1286483582_per#gmail.com" />
<input type="hidden" name="night_phone_a" value="" />
<input type="hidden" name="night_phone_b" value="" />
<input type="hidden" name="night_phone_c" value="" />
</form>
</body>
Thanks.
I have also face same problem.
Please set the following settings in Your business account.
In Website Payment Preferences
=> Auto Return: On
=> Set Return URL
=> Payment Data Transfer: On.
Please try this, this may help you.
All the best.
Kanji

Categories