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

if($_POST['fIDProd'])
{
	$fIDProd = $_POST['fIDProd'];
}
else
{
	$fIDProd = $_GET['fIDProd'];
}

if($_POST['ProductID'])
{
	$ProductID = $_POST['ProductID'];
}
else
{
	$ProductID = $_GET['ProductID'];
}
if($_POST['backUrl'])
{
	$backUrl = $_POST['backUrl'];
}
else
{
	$backUrl = $_GET['backUrl'];
}


$PInfo = PInfo($fIDProd);
$actionclass = $PInfo["ActionClass"];
$proimpl = new $actionclass($ProductID);
if($proimpl->ProRecord->UserName != $_SESSION['User_S']){
	$db->close();
	die("<script>alert('指定的产品不是由您管理！！');history.back()</script>");
}
if($execute == 1){
    $userinfo = GetUserInfo($_SESSION['User_S']);
	if($userinfo['Password'] != MD5($CtrlPw)){
		$db->close();
	    die("<script>alert('您输入的用户控制中心密码错误！！！');history.back()</script>");
	}
	$result = $proimpl->InitPassword($NewPw);
	if($result==1){
		$result_str = "重置密码成功";
	}else{
		$result_str = $proimpl->ErrorMsg;
	}
}
$ProductDisp = $proimpl->ProRecord->Domain." -- ".$PInfo['ProductName'];
$db->close();
//输出
$smarty->assign("fIDProd",$fIDProd);
$smarty->assign("ProductID",$ProductID);
$smarty->assign("backUrl",$backUrl);
$smarty->assign("ProductDisp",$ProductDisp);
$smarty->assign("result_str",$result_str);
$smarty->display('user_pro_initpw.html');
?>