从CC Avenue网站重定向到商家的网页。 PHP

时间:2016-02-24 06:49:43

标签: php payment gateway ccavenue

我已经完成了支付网关项目,它运行良好。付款从用户帐户中扣除,并记入公司帐户。但它没有重定向到商家网站中的页面,该网站在文件ccavResponseHandler.php中提到。相反,它会重定向到商家网站的主页。我想将它重定向到success.php,从同一页面我将从数据库中编写订单详细信息并将邮件发送给客户和公司。这是CC Avenue的代码。我已从此删除了一些机密细节,但我的档案中也是如此。

 <?php include('Crypto.php')?>    
    <?php    
    error_reporting(0);    
    $workingKey='';     
    $encResponse=$_POST[""];
    $rcvdString=decrypt($encResponse,$workingKey);  
    $order_status="";
    $decryptValues=explode('&', $rcvdString);
    $dataSize=sizeof($decryptValues);

    for($i = 0; $i < $dataSize; $i++) 
    {
        $information=explode('=',$decryptValues[$i]);
        if($i==3)   $order_status=$information[1];
    }

    if($order_status==="Success")
    {
        header('Location:success.php');             
    }
    else if($order_status==="Aborted")
    {   
        header('Location:abort.php');   
    }
    else if($order_status==="Failure")
    {
        header('Location:failure.php');     
    }
    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>'.urldecode($information[1]).'</td></tr>';
    }    
    echo "</table><br>";    
    ?>

以下是目标网页

<html>
<head>
</head>
    <?php
    echo "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";
    ?>

1 个答案:

答案 0 :(得分:0)

我不知道为什么标题(&#39;位置:success.php&#39;);不会工作,但你可以试试吗?以下代码应提示用户使用警告框说:&#34;付款成功!&#34;。一旦用户点击“确定”即可。在警告框中,他们应该被重定向到success.php。

if($order_status==="Success")
{
   echo "<script>window.alert('Payment was Successful!')
   window.location.href='success.php'</script>";             
}