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

$fIDProd = $_POST['fIDProd'];
$period = $_POST['period'];
$ProductID = $_POST['ProductID'];
$backUrl = $_POST['backUrl'];

$PInfo = PInfo($fIDProd);
$actionclass = $PInfo["ActionClass"];
$proimpl = new $actionclass($ProductID);

$boxGrade = 0;
$quota = 1;
//email的续费与大小有关需要另外处理2011-3-8
$arrCheckEmail = array("qy_gq","qy_gb","qy_mq","qy_mb");
if(in_array($PInfo['productid'],$arrCheckEmail)) {
	$sql = "select * from email where IDEmail = '".$ProductID."'";
	$result = $db->query($sql);
	$emailInfo = $db->fetch_array($result);
	$quota = $emailInfo['quota'];
}elseif($actionclass=="HostImpl"){
	$sql = "select * from host where IDHost = '".$ProductID."'";
	$vhostInfo = $db->getdata($sql);
	if($vhostInfo && $vhostInfo[boxGrade]) $boxGrade = $vhostInfo[boxGrade];
}

$num = $proimpl->ProRecord->Num > 0 ? $proimpl->ProRecord->Num : 1;
$ProductDisp = $proimpl->ProRecord->Domain."  ".$PInfo['ProductName'];
$dtExpiry = date("Y-m-d",strtotime($proimpl->ProRecord->dtExpiry." +$period years"));
$oOrder = Order::AddOrder($fIDProd,$ProductID,1,$proimpl->ProRecord->Domain,$period,$num,$dtExpiry,$quota,$boxGrade);



$smarty->assign("ProductDisp",$ProductDisp);
$smarty->assign("OrderAmount",$oOrder['Amount']);
$smarty->assign("OrderID",$oOrder['OrderID']);
$smarty->assign("period",$oOrder['Period']);
$smarty->assign("backUrl",$backUrl);
$smarty->display('renew_submit.html');
$db->close();
?>