<?php
//****************************************请求权限****************************************
require("locked.php");                                                                 //*
setlocked(-1);                                                                         //*
//****************************************************************************************

echo '<script>document.title="处理结果通知";</script>';

//新增数据开始；
include("cnn.php");
$strsql='insert into user(id,name,password,telephone) values("'.$_POST["id"].'","'.$_POST["name"].'","'.md5("123456").'","'.$_POST["telephone"].'")';
$mysqli->query($strsql);
$afr=$mysqli->affected_rows;

if($afr==1){ //如果存在数据；

    //成功添加用户后自动向权限表中加入权限记录；
	$mysqli->query("insert into power values('".$_POST["id"]."','0','会计科目','0')");
	$mysqli->query("insert into power values('".$_POST["id"]."','1','现金流量','0')");
	$mysqli->query("insert into power values('".$_POST["id"]."','2','客户','0')");
	$mysqli->query("insert into power values('".$_POST["id"]."','3','个人','0')");
	$mysqli->query("insert into power values('".$_POST["id"]."','4','存货','0')");
	$mysqli->query("insert into power values('".$_POST["id"]."','5','供应商','0')");
	$mysqli->query("insert into power values('".$_POST["id"]."','6','部门','0')");
	$mysqli->query("insert into power values('".$_POST["id"]."','7','核算项目','0')");
	$mysqli->query("insert into power values('".$_POST["id"]."','8','凭证管理','0')");
	$mysqli->query("insert into power values('".$_POST["id"]."','9','限于本人','0')");
	$mysqli->query("insert into power values('".$_POST["id"]."','10','科目余额表','0')");
	$mysqli->query("insert into power values('".$_POST["id"]."','11','项目余额表','0')");
	
    echo '新增成功；';
	
}else{
    echo '新增失败；<a href="#" onclick="javascript:history.back()">返回</a>';
}
$mysqli->close();
?>