[英]Security Error. Illegal access detected using ccavenue in php
我成功地重定向到ccavenue支付網關但是在點擊取消按鈕時,它在重定向網頁中顯示錯誤“安全錯誤。檢測到非法訪問” 。
這是我的重定向頁面:
<?php include('Aes.php');include('adler32.php')?>
<?php
$workingKey='myWorkingKey'; //Working Key should be provided here.
$encResponse=$_POST["encResponse"]; //This is the response sent by the CCAvenue Server
$rcvdString=decrypt($encResponse,$workingKey);
$AuthDesc="";
$MerchantId="";
$OrderId="";
$Amount=0;
$Checksum=0;
$veriChecksum=false;
$decryptValues=explode('&', $rcvdString);
$dataSize=sizeof($decryptValues);
echo "<center>";
for($i = 0; $i < $dataSize; $i++)
{
$information=explode('=',$decryptValues[$i]);
if($i==0) $MerchantId=$information[1];
if($i==1) $OrderId=$information[1];
if($i==2) $Amount=$information[1];
if($i==3) $AuthDesc=$information[1];
if($i==4) $Checksum=$information[1];
}
$rcvdString=$MerchantId.'|'.$OrderId.'|'.$Amount.'|'.$AuthDesc.'|'.$workingKey;
$veriChecksum=verifyChecksum(genchecksum($rcvdString), $Checksum);
if($veriChecksum==TRUE && $AuthDesc==="Y")
{
echo "<br>Thank you for shopping with us. Your credit card has been charged and your transaction is successful. We will be shipping your order to you soon.";
}
else if($veriChecksum==TRUE && $AuthDesc==="B")
{
echo "<br>Thank you for shopping with us.We will keep you posted regarding the status of your order through e-mail";
}
else if($veriChecksum==TRUE && $AuthDesc==="N")
{
echo "<br>Thank you for shopping with us.However,the transaction has been declined.";
}
else
{
echo "<br>Security Error. Illegal access detected";
}
echo "<br><br>";
echo "<table cellspacing=4 cellpadding=4>";
for($i = 0; $i < $dataSize; $i++)
{
$information=explode('=',$decryptValues[$i]);
echo '<tr><td>'.$information[0].'</td><td>'.$information[1].'</td></tr>';
}
echo "</table><br>";
echo "</center>";
?>
我搜索了這個問題,但無法得到任何解決方案。 如何解決這個錯誤..請給出一些相同的建議?
我從文檔中發現(可能已經過時但我找不到更新的文檔)您需要傳遞一個名為cancel_url
的參數,如果客戶在結算頁面上取消了該交易,CCAvenue會將客戶重定向到此URL。
因此,在您創建付款的頁面中,您需要向表單添加類似的內容
<input type="hidden" id="cancel_url" name="cancel_url" value="the_url_where_you_will_proccess_canceled_orders">
您必須已經擁有與redirect_url
類似的東西
您的代碼沒有任何問題。 您需要為取消訂單維護單獨的頁面,您不需要使用CC途徑響應代碼。 由於用戶未完成付款,因此您無法從ccavenue收到任何響應參數。 所以,他們不需要$ verifyCheckSum和$ AuthDesc變量。 他們只是自願取消訂單。 因此,只需要在您的網站上向他們顯示一條消息“您的訂單已被取消” 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.