2016-02-24 47 views
1

我已经完成了支付网关项目,并且完美地工作。付款从用户帐户中正确记入并记入公司帐户。但它不会重定向到商家网站的文件ccavResponseHandler.php中提到的页面。相反,它会重定向到商家网站的主页。我想重定向到success.php,并从同一页面我将从数据库撰写订单详细信息并将邮件发送给客户和公司。以下是来自CC Avenue的代码。我已经从中删除了一些保密的细节,但是我的文件中也有相同的细节。从CC Avenue网站重定向到商家的网页。 PHP

<?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"; 
    ?> 

回答

0

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

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

嗨,首先我怀疑它是否访问ccavResponseHandler.php文件或不。因为它在成功交易后直接进入我的网站主页。除非该URL在某处被提及,否则它不会自动进入。 ccAvenue的控制面板中有没有可以输入重定向网址的地方? – Rajesh