【问题标题】:redirecting to merchant's web page from CC Avenue website. PHP从 CC Avenue 网站重定向到商家的网页。 PHP
【发布时间】:2016-06-06 07:55:14
【问题描述】:

我已经完成了一个支付网关项目,它运行良好。付款从用户帐户中正确扣除并记入公司帐户。但它不会重定向到文件 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";
    ?>

【问题讨论】:

    标签: php payment gateway ccavenue


    【解决方案1】:

    我不知道为什么 header('Location:success.php');不会工作,但你可以试试这个?下面的代码应该用一个警告框提示用户:“付款成功!”。一旦用户点击警告框上的“确定”,他们应该被重定向到success.php。

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

    【讨论】:

    • 嗨,首先我怀疑它是否访问 ccavResponseHandler.php 文件。因为交易成功后直接进入我的网站首页。除非在某处提到该 URL,否则它不会自动运行。 ccAvenue 的控制面板中是否有可以输入重定向 URL 的地方?
    猜你喜欢
    • 2014-01-03
    • 2016-05-06
    • 2012-11-19
    • 2017-04-30
    • 2017-09-25
    • 1970-01-01
    • 2013-12-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多