<?
session_start();
require_once("../common/init.php");
require_once("security.inc.php");

if($_POST['OrderID']!='')
{
	$OrderID = $_POST['OrderID'];
}
else
{
	$OrderID = $_GET['OrderID'];
}
//查询
$order = new Order($OrderID);

if($order->Pay()==1) {
	$payresult = "订单交费成功,".$order->Message;//还只在本系统中
	if($order->isAutoStart()){
		//提交到远程新建开通产品
		if($order->Doit()==1) $payresult .= "<br>产品开通成功,".$order->Message;
		else $payresult .= "<br>产品开通失败,".$order->ErrorMsg.", 产品稍后由系统自动开通";
	}
} else {
	$payresult = "订单交费失败<br><br>".$order->ErrorMsg;
}
//输出

$smarty->assign("payresult",$payresult);
$smarty->display('user_order_pay.html');
$db->close();
?>