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

$ProductID = $_GET['ProductID'];
$fIDProd = $_GET['fIDProd'];
$backUrl = $_GET['backUrl'];

$PInfo = PInfo($fIDProd);
//print_r($PInfo);
if(!$PInfo) die("<script>alert('指定的产品不是由您管理！！');history.back()</script>");
$actionclass = $PInfo["ActionClass"];
if(!$actionclass) die("<script>alert('非指定产品！！');history.back()</script>");
$proimpl = new $actionclass($ProductID);
if($proimpl->ProRecord->UserName != $_SESSION['User_S']) {
	$db->close();
	die("<script>alert('指定的产品不是由您管理！！');history.back()</script>");
}
$num = $proimpl->ProRecord->Num > 0 ? $proimpl->ProRecord->Num : 1;
$ProductName = $proimpl->ProRecord->Domain."  ".$PInfo['ProductName'];

//email的续费与大小有关需要另外处理2011-3-8
$arrCheckEmail = array("qy_gq","qy_gb","qy_mq","qy_mb");
$quota = 1;
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['boxGrade']){
		$boxInfo = box_for_vhost("",$ProductID);
		$PInfo['iRenew_Price'] += ($boxInfo[$vhostInfo['boxGrade']]['price']?$boxInfo[$vhostInfo['boxGrade']]['price']:0);
	}
}
for($i=1;$i<=5;$i++) {
  $option_renew_years .= "<option value='".$i."'>".$i."年/".($PInfo['iRenew_Price']*$i*$num*$quota)."</option>\r\n";
}
//输出

$smarty->assign("ProductName",$ProductName);
$smarty->assign("option_renew_years",$option_renew_years);
$smarty->assign("expiry_date",date('Y-m-d',strtotime($proimpl->ProRecord->dtExpiry)));
$smarty->assign("fIDProd",$fIDProd);
$smarty->assign("quota",$quota);
$smarty->assign("ProductID",$ProductID);
$smarty->assign("backUrl",$backUrl);
$smarty->display('renew.html');
$db->close();
?>