【发布时间】:2013-12-30 11:04:15
【问题描述】:
我有以下 php 代码
<?php
$token_cipherText=$_POST['tokenex_cipherText'];
$token=generateToken($tokenex_cipherText);
$merchantid="example";
$Password="example1";
$remoteIP='11.22.95.5';
$customerReferenceNo = $_POST['customerReferenceNo'];
$amount=$_POST['amount'];
$currencyCode='356';
$expiryMonth=$_POST['expiry_month'];
$expiryYear=$_POST['expiry_year'];
$securityCode=$_POST['cvv'];
$cardHolderName=$_POST['name_on_card'];
$cardType=$_POST['selectedRadioValue'];
if($cardType=='radio1')
{
$cardType='CC';
}
if($cardType=='radio2')
{
$cardType='DB';
}
$cardProvider=$_POST['ccType'];
if($cardProvider=='visa_electron')
{
$cardProvider='visa';
}
if($cardProvider=='mastercard')
{
$cardProvider='mc';
}
if($cardProvider=='maestro')
{
$cardProvider='maest';
}
if($cardProvider=='sbi_maestro')
{
$cardProvider='sbime';
}
$cardProvider=strtoupper($cardProvider);
$name=$cardHolderName;
$mobileNo=$_POST['mobileNo'];
$Email=$_POST['email'];
$merchant_id=$_POST['merchant_id'];
$sql=mysql_query("select * from card_token where token='$token'");
$numrows=mysql_num_rows($sql);
if($numrows==0)
{
$sql=mysql_query("insert into card_token value('','$token','$merchant_id',now())");
}
$sql=mysql_query("update payment_tools_transactions set token_id='$token', cardHolderName='$cardHolderName', cust_Email='$Email', mobileNo='$mobileNo', trans_type='$cardType', cardProvider='$cardProvider', trans_amount='$amount' where trans_refNo='$customerReferenceNo'");
$checksum = $merchantid."|".$_POST['amount']."|".$customerReferenceNo;
$checksum = hash('sha256', $checksum);
$data='tokenNo='.$token.'&securityCode='.$securityCode.'&cardExpiryMonth='.$expiryMonth.'&cardExpiryYear='.$expiryYear.'&cardHolderName='.$cardHolderName.'&transactionAmount='.$amount.'&paymentMode='.$cardType.'¤cyCode='.$currencyCode.'&customerReferenceNo='.$customerReferenceNo.'&cardProvider='.$cardProvider.'&name='.$name.'&mobileNo='.$mobileNo.'&email='.$Email.'&password='.$Password.'&amount='.$_POST['amount'].'&remoteIP='.$remoteIP.'&checkSum='.$checksum;
$encryption_key = "CE5D964";
$desEncryptedData = encryptText_3des($data, $encryption_key);
$desEncryptedData = urlencode($desEncryptedData);
$url='https://payment.paykml.com/PGCCDCToken/TokenPayment.jsp?merchantId='.$merchantid.'&data='.$desEncryptedData; //URL for CC authentication
header("location:$url");
一个html表单将一些值发布到这个php中,上面的代码被执行并使用标题header("location:$url");这些参数被重定向到$url='https://payment.paykml.com/PGCCDCToken/TokenPayment.jsp?merchantId='.$merchantid.'&data='.$desEncryptedData;
但我面临的问题是,重定向 url 像 https://payment.paykml.com/PGCCDCToken/TokenPayment.jsp?merchantId=example&data=********** 一样暴露
任何人都可以操纵或轻松获取此值。有什么方法可以通过使用会话来隐藏此参数?或者有没有其他方法可以隐藏此 url 重定向参数?
有人可以帮忙吗?我一直在到处寻找解决方案,但在 vien :(
解决方案: 由于我们正在重定向到第三方网站,因此无法在此处使用会话。所以我使用 curl 将我的参数发布到该网站
//Copy paste all the code till here...
$encryption_key = "CE5D964";
$desEncryptedData = encryptText_3des($data, $encryption_key);
$desEncryptedData = urlencode($desEncryptedData);
$url='https://payment.paykml.com/PGCCDCToken/TokenPayment.jsp?merchantId='.$merchantid.'&data='.$desEncryptedData;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$auth = curl_exec($curl);
if($auth)
{
header("Location:success.php"); //Redirect to a success page after payment.
exit;
}
【问题讨论】:
-
是的,您可以将它们存储在 session/cookies 中并轻松将它们放入重定向页面中。
-
访问该页面的用户是否重要?如果只是需要访问它,为什么不在上面运行
file_get_contents? -
thanks.but 我没有参加过会议,我不知道 flw.ca 的工作你帮帮我
标签: php html session redirect header