295 lines
9.0 KiB
PHP
Executable File
295 lines
9.0 KiB
PHP
Executable File
<?php
|
|
/*********************************************************
|
|
程序说明:系统强度配置
|
|
功能说明:
|
|
调用关系:调用:header.inc
|
|
变量说明:
|
|
返回值:无
|
|
作者:
|
|
|
|
修改注释:
|
|
NO.1
|
|
姓名:
|
|
时间:
|
|
修改说明:
|
|
*********************************************************/
|
|
require("../../inc/header.inc");
|
|
|
|
?>
|
|
<body leftmargin="15" rightmargin="10" onload="javascript:adjust_frame('up');" onresize="javascript:adjust_frame('up');" style="background-color:#FFFAF4;overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
|
|
<?php
|
|
//adjust_head();
|
|
//adjust_title_head();
|
|
/*
|
|
echo "<br>";
|
|
echo "<table id=\"table_up\" border=\"0\" width=\"100%\">";
|
|
echo "<tr>";
|
|
echo "<td width=\"50%\" align=\"left\">";
|
|
echo "$strAdvanced > $strOmcUser";
|
|
echo "</td>";
|
|
echo "</tr>";
|
|
echo "</table>";*/
|
|
//adjust_title_tail();
|
|
adjust_content_head();
|
|
echo "<br>";
|
|
|
|
$DEBUG = 0;
|
|
$pubDb ='OMC_PUB';
|
|
$table_name ='sysPwdStrength'; /*密码强度表*/
|
|
|
|
if($DEBUG) echo "userInfo[ID] = $userInfo[ID]<br>";
|
|
$confMode=$_REQUEST['confMode'];
|
|
$ucCategory=$_POST['ucCategory']; //字符Unicode类别
|
|
$maxLength=$_REQUEST['maxLength'];
|
|
$maxLoginNum=$_POST['maxLoginNum'];
|
|
$delayedTime=$_POST['delayedTime'];
|
|
|
|
if($DEBUG) echo "confMode=$confMode<br>";
|
|
if($DEBUG) echo "confMode=$ucCategory<br>";
|
|
if(!isset($ucCategory)){
|
|
$ucCategory=3;
|
|
}
|
|
if(!isset($maxLength)){
|
|
$maxLength=127;
|
|
}
|
|
if(!isset($maxLoginNum)){
|
|
$maxLoginNum=5;
|
|
}
|
|
if(!isset($delayedTime)){
|
|
$delayedTime=120;
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
<script language="JavaScript">
|
|
function question_Validator(theForm)
|
|
{
|
|
if(theForm.unicodeType.value==''){
|
|
var TypeEmpty="<?php echo $strTypeCannotBeEmpty; ?>";
|
|
alert(TypeEmpty);
|
|
theForm.unicodeType.focus();
|
|
return(false);
|
|
}else if(theForm.maxLength.value==''){
|
|
var MaxEmpty="<?php echo $strMaxCannotBeEmpty; ?>";
|
|
alert(MaxEmpty);
|
|
theForm.maxLength.focus();
|
|
return(false);
|
|
|
|
|
|
|
|
}else if(theForm.pwdOutTime.value==''){
|
|
var pwdEmpty="<?php echo $strPwdEmpty; ?>";
|
|
alert(pwdEmpty);
|
|
theForm.pwdOutTime.focus();
|
|
return(false);
|
|
|
|
}
|
|
else{
|
|
|
|
if(theForm.maxLoginNum.value==''){
|
|
var NumEmpty="<?php echo $strNumCannotBeEmpty; ?>";
|
|
alert(NumEmpty);
|
|
theForm.maxLoginNum.focus();
|
|
return(false);
|
|
}
|
|
|
|
|
|
|
|
if(theForm.delayedTime.value==''){
|
|
var TimeEmpty="<?php echo $strTimeCannotBeEmpty; ?>";
|
|
alert(TimeEmpty);
|
|
theForm.delayedTime.focus();
|
|
return(false);
|
|
}
|
|
|
|
|
|
if(theForm.pwdOutTime.value <24){
|
|
var pwdConfirm="<?php echo $strPwdMistake; ?>";
|
|
alert(pwdConfirm);
|
|
theForm.pwdOutTime.focus();
|
|
return (false);
|
|
}
|
|
|
|
|
|
if(theForm.unicodeType.value <1 || theForm.unicodeType.value>4){
|
|
var UnicodeTypeConfirm="<?php echo $strUnicodeTypeMistake; ?>";
|
|
alert(UnicodeTypeConfirm);
|
|
theForm.unicodeType.focus();
|
|
return (false);
|
|
}
|
|
if(theForm.maxLength.value < 9 || theForm.maxLength.value > 128){
|
|
var maxLengthConfirm="<?php echo $strMaxLengthMistake; ?>";
|
|
alert(maxLengthConfirm);
|
|
theForm.maxLength.focus();
|
|
return (false);
|
|
}
|
|
|
|
|
|
if(theForm.maxLoginNum.value <5 || theForm.maxLoginNum.value>8){
|
|
var maxLoginNumConfirm="<?php echo $maxLoginNumRule; ?>";
|
|
alert(maxLoginNumConfirm);
|
|
theForm.maxLoginNum.focus();
|
|
return (false);
|
|
}
|
|
if(theForm.delayedTime.value < 120 || theForm.delayedTime.value > 600){
|
|
var delayedTimeConfirm="<?php echo $delayedLoginTimeRule; ?>";
|
|
alert(delayedTimeConfirm);
|
|
theForm.delayedTime.focus();
|
|
return (false);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
return (true);
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<?php
|
|
if ($confMode == 'strong'){
|
|
?>
|
|
<form action="<?php echo"$PHP_SELF?table_name=$table_name"; ?>" method="POST" onsubmit="return question_Validator(this)" name="operForm" >
|
|
<!-- <table border="1" width="100%" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" height="189" bgcolor="#FFFFEF">
|
|
-->
|
|
<table class="formCenter">
|
|
<tr>
|
|
<td colspan=3 vAlign="top" bgcolor="#E6E6E6" height="12"><b>
|
|
<?php
|
|
|
|
echo $configPwdStreng; //配置密码强度
|
|
|
|
?>
|
|
</b></td>
|
|
</tr>
|
|
|
|
<!-- //配置密码强度-->
|
|
|
|
<tr>
|
|
<td><?php echo $unicodeNum; ?></td>
|
|
<td><input type="text" name="unicodeType" id="unicodeType" maxlength="16" size="16" value="<?php echo $ucCategory; ?>" class="text"></td><!--类型的输入框-->
|
|
<td width="150"><?php echo $pwdType; ?></td> <!--类型只能选1-4的提示-->
|
|
</tr>
|
|
<tr>
|
|
<td><?php echo $theMax; ?></td> <!--输入最长长度-->
|
|
<td> <input type="text" name="maxLength" id="maxLength" maxlength="16" size="16" value="<?php echo $maxLength; ?>" class="text">
|
|
<td width="150"> <?php echo $maxLengthRule; ?></td> <!--最高128-->
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><?php echo $strMaxLoginNum; ?></td> <!--输入最大登录失败次数-->
|
|
<td> <input type="text" name="maxLoginNum" id="maxLoginNum" maxlength="16" size="16" value="<?php echo $maxLoginNum; ?>" class="text">
|
|
<td width="150"> <?php echo $maxLoginNumRule; ?></td> <!--最高为八次-->
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td><?php echo $strDelayedLoginTime; ?></td>
|
|
<td> <input type="text" name="delayedTime" id="delayedTime" maxlength="16" size="16" value="<?php echo $delayedTime; ?>" class="text">
|
|
<td width="150"> <?php echo $delayedLoginTimeRule; ?></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><?php echo $strPwdOutTime; ?></td>
|
|
<td> <input type="text" name="pwdOutTime" id="pwdOutTime" maxlength="16" size="16" value="<?php echo $pwdOutTime; ?>" class="text">
|
|
<td width="150"> <?php echo $pwdOutTimeRule; ?></td>
|
|
</tr>
|
|
|
|
<tr align="center">
|
|
<td colspan=3 width=600 align=center><p>
|
|
<?php
|
|
echo "<input type=\"submit\" name=\"config\" value=\"$strConfig\" class=\"button\"> "; //配置按钮
|
|
echo "<input type=\"reset\" name=\"reset\" value=\"$strCancel\" class=\"button\"> ";
|
|
echo "<input type=\"button\" value=\"$strReturn\" class=\"button\" onclick=javascript:location.href=\"./userList.php\";> ";
|
|
?>
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<?php
|
|
//配置密码强度
|
|
|
|
|
|
$config=$_POST['config'];
|
|
if($config){
|
|
//获取输入的数据,
|
|
$ucCategory=$_POST['unicodeType'];
|
|
$pwdOutTime=$_POST['pwdOutTime'];
|
|
$select_sql ="SELECT count(*) as number_of_records
|
|
FROM $table_name
|
|
WHERE ucCategory='$ucCategory' and maxLength='$maxLength' and maxLoginNum='$maxLoginNum' and delayedTime='$delayedTime' and pwdOutTime='$pwdOutTime'";
|
|
//配置并没有改动,则不添加
|
|
|
|
|
|
$result = mysqli_query($pubConn,$select_sql);
|
|
$record = @mysqli_fetch_object($result);
|
|
$number_of_records = $record->number_of_records;
|
|
//echo "<br>number_of_records=$number_of_records";
|
|
if(1) echo "<br>select_sql=$select_sql";
|
|
|
|
if($number_of_records){
|
|
echo "<script language=\"javascript\"> ";
|
|
echo "alert('";
|
|
echo "$strTheRecordExits,$strConfigFails"; /*未有改动的地方,请重新配置*/
|
|
echo "'); ";
|
|
echo "</script>";
|
|
echo " <meta http-equiv=\"refresh\" content=\"3; url=./userList.php\"> ";
|
|
adjust_content_tail();
|
|
exit();
|
|
}else{
|
|
// $str_sql="REPLACE INTO $table_name
|
|
// ( realName,userName,password,privilege,updateTime)
|
|
// VALUES
|
|
// ('$realName','$userName',md5('$password'),'$privilege',CURRENT_TIMESTAMP)
|
|
// ";
|
|
|
|
//修改系统强度表的强度
|
|
$str_sql="UPDATE $table_name
|
|
SET ucCategory='$ucCategory',maxLength='$maxLength',write_time=CURRENT_TIMESTAMP,maxLoginNum='$maxLoginNum',delayedTime='$delayedTime',pwdOutTime='$pwdOutTime'
|
|
WHERE keyId=1
|
|
";
|
|
|
|
|
|
$result=mysqli_query($pubConn,$str_sql);
|
|
// echo "sql=$str_sql";
|
|
echo mysqli_error($pubConn);
|
|
if(!$result){
|
|
echo "<script language=\"javascript\"> ";
|
|
echo "alert('";
|
|
echo "$strConfigFails"; /*配置失败*/
|
|
echo "'); ";
|
|
echo "</script>";
|
|
echo " <meta http-equiv=\"refresh\" content=\"20; url=./userList.php\"> ";
|
|
adjust_content_tail();
|
|
exit();
|
|
}else{
|
|
echo "<script language=\"javascript\"> ";
|
|
echo "alert('";
|
|
echo "$strConfigSucceeds";/*配置成功*/
|
|
echo "'); ";
|
|
echo "</script>";
|
|
echo " <meta http-equiv=\"refresh\" content=\"0; url=./userList.php\"> ";
|
|
adjust_content_tail();
|
|
exit();
|
|
}
|
|
}
|
|
}
|
|
|
|
adjust_content_tail();
|
|
|
|
?>
|
|
|
|
</html>
|
|
|
|
|
|
|