<?php /* EL PSY CONGROO */    	 			 	 
require '../../../zb_system/function/c_system_base.php';     		  	  
     			  	 
require '../../../zb_system/function/c_system_admin.php';      	    	
    	       
$zbp->Load();     	 	 			
    						  
$action = 'root';      	 	 		
if (!$zbp->CheckRights($action)) {$zbp->ShowError(6);die();}    					 		
    		 	 		 
if (!$zbp->CheckPlugin('AnquanLogin')) {$zbp->ShowError(48);die();}      	     
       	 		 
$blogtitle = 'ZBLOG安全登录-设置';       		 		
       					
if (GetVars('act') == 'save') {      		 			
    		   			
  $zbp->Config('AnquanLogin')->ExpireDay =  (int) GetVars("aql_ExpireDay");    	 				 	
  $zbp->Config('AnquanLogin')->Agent_Enable =  (bool) GetVars("aql_Agent_Enable");    		 		 		
  $zbp->Config('AnquanLogin')->IP_Enable =  (bool) GetVars("aql_IP_Enable");     				 		
  $zbp->Config('AnquanLogin')->LevelRange =  (int) GetVars("aql_LevelRange");    	  			 	
  $zbp->Config('AnquanLogin')->AppendKey =  (string) GetVars("aql_AppendKey");     			    
  $zbp->Config('AnquanLogin')->Lb_Enable = (bool)GetVars("aql_Lb_Enable");       					
  $zbp->Config('AnquanLogin')->Lb_LevelRange = (int)GetVars("aql_Lb_LevelRange");    	  	 	  
  $AnquanLogin_ExpireDay    = $zbp->Config('AnquanLogin')->ExpireDay;    		    	 
  $AnquanLogin_Agent_Enable = $zbp->Config('AnquanLogin')->Agent_Enable;    	   	  	
  $AnquanLogin_IP_Enable    = $zbp->Config('AnquanLogin')->IP_Enable;    		 	   	
  $AnquanLogin_LevelRange   = $zbp->Config('AnquanLogin')->LevelRange;     		 				
  $AnquanLogin_AppendKey    = $zbp->Config('AnquanLogin')->AppendKey;     	 	    
  $zbp->SaveConfig('AnquanLogin');    			    	
      	  		 
	$zbp->SetHint('good');     				  	
  AnquanLogin_VerifyLogin();    				    
	Redirect('./main.php');    	  	  	 
    		 	 			
}     			 		 
    				    
require $blogpath . 'zb_system/admin/admin_header.php';       	    
require $blogpath . 'zb_system/admin/admin_top.php';     	 			  
?>
<div id="divMain">

  <div class="divHeader"><?php echo $blogtitle;?></div>
  <div id="divMain2">
<div class="SubMenu">
<?php if ($zbp->Config('AnquanLogin')->Lb_Enable == true){ ?>
	<a href="config.php"><span class="m-left">Google两步验证</span></a>
<?php }?>
	</div>
            <form action="?act=save" method="post">
              <table width="100%" border="0">
                <tr height="32">
                  <th colspan="2" align="center">设置
                    </td>
                </tr>
                <tr height="32">
                  <td width="30%" align="left"><p><b>· 密码保存时间</b><br/>
                      <span class="note">&nbsp;&nbsp; </span></p></td>
                  <td><select id="aql_ExpireDay" name="aql_ExpireDay" >
<option value="1" <?php if ($zbp->Config('AnquanLogin')->ExpireDay == 1){echo 'selected="selected"';};?> >1小时</option>
<option value="6" <?php if ($zbp->Config('AnquanLogin')->ExpireDay == 6){echo 'selected="selected"';};?> >6小时</option>
<option value="24" <?php if ($zbp->Config('AnquanLogin')->ExpireDay == 24){echo 'selected="selected"';};?> >1天</option>
<option value="168" <?php if ($zbp->Config('AnquanLogin')->ExpireDay == 168){echo 'selected="selected"';};?> >7天</option>
<option value="720" <?php if ($zbp->Config('AnquanLogin')->ExpireDay == 720){echo 'selected="selected"';};?> >30天</option>
                 </select></td>
                </tr>
                <tr height="32">
                  <td width="30%" align="left"><p><b>· 密码和浏览器Agent绑定</b><br/>
                      <span class="note">&nbsp;&nbsp;</span></p></td>
                  <td><input id="aql_Agent_Enable" name="aql_Agent_Enable" type="text" value="<?php echo (int)$zbp->Config('AnquanLogin')->Agent_Enable;?>" class="checkbox"/></td>
                </tr>
                <tr height="32">
                  <td width="30%" align="left"><p><b>· 密码和登录者IP绑定</b><br/>
                      <span class="note">&nbsp;&nbsp;</span></p></td>
                  <td><input id="aql_IP_Enable" name="aql_IP_Enable" type="text" value="<?php echo (int)$zbp->Config('AnquanLogin')->IP_Enable;?>" class="checkbox"/></td>
                </tr>
                <tr height="32">
                  <td width="30%" align="left"><p><b>· 指定应用安全登录的用户范围</b><br/>
                      <span class="note">&nbsp;&nbsp;</span></p></td>
                  <td><select id="aql_LevelRange" name="aql_LevelRange" >
<option value="1" <?php if ($zbp->Config('AnquanLogin')->LevelRange == 1){echo 'selected="selected"';};?> ><?php echo $zbp->lang['user_level_name'][1];?></option>
<option value="2" <?php if ($zbp->Config('AnquanLogin')->LevelRange == 2){echo 'selected="selected"';};?> ><?php echo $zbp->lang['user_level_name'][1] .'+'.$zbp->lang['user_level_name'][2];?></option>
<option value="3" <?php if ($zbp->Config('AnquanLogin')->LevelRange == 3){echo 'selected="selected"';};?> ><?php echo $zbp->lang['user_level_name'][1] .'+'.$zbp->lang['user_level_name'][2] .'+'. $zbp->lang['user_level_name'][3];?></option>
<option value="4" <?php if ($zbp->Config('AnquanLogin')->LevelRange == 4){echo 'selected="selected"';};?> ><?php echo $zbp->lang['user_level_name'][1] .'+'.$zbp->lang['user_level_name'][2] .'+'. $zbp->lang['user_level_name'][3] .'+'. $zbp->lang['user_level_name'][4];?></option>
<option value="5" <?php if ($zbp->Config('AnquanLogin')->LevelRange == 5){echo 'selected="selected"';};?> ><?php echo $zbp->lang['user_level_name'][1] .'+'.$zbp->lang['user_level_name'][2] .'+'. $zbp->lang['user_level_name'][3] .'+'. $zbp->lang['user_level_name'][4] .'+'. $zbp->lang['user_level_name'][5];?></option>
                 </select></td>
                </tr>
                <tr height="32" style="display:none;">
                  <td width="30%" align="left"><p><b>· 追加的认证字符串</b><br/>
                      <span class="note">&nbsp;&nbsp;</span></p></td>
                  <td><input id="aql_AppendKey" name="aql_AppendKey" type="text" value="<?php echo $zbp->Config('AnquanLogin')->AppendKey;?>"  size="50"/></td>
                </tr>
<tr><td class="td30"><p><b>· 启用Google两步认证</b><br/><span class="note">&nbsp;&nbsp;</span></p></td>
<td><input id="aql_Lb_Enable" name="aql_Lb_Enable" type="text" value="<?php echo $zbp->Config('AnquanLogin')->Lb_Enable;?>" class="checkbox"/></td></tr>
                <tr height="32">
                  <td width="30%" align="left"><p><b>· 指定使用Google两步认证的用户范围</b><br/>
                      <span class="note">&nbsp;&nbsp;</span></p></td>
                  <td><select id="aql_Lb_LevelRange" name="aql_Lb_LevelRange" >
<option value="1" <?php if ($zbp->Config('AnquanLogin')->Lb_LevelRange == 1){echo 'selected="selected"';};?> ><?php echo $zbp->lang['user_level_name'][1];?></option>
<option value="2" <?php if ($zbp->Config('AnquanLogin')->Lb_LevelRange == 2){echo 'selected="selected"';};?> ><?php echo $zbp->lang['user_level_name'][1] .'+'.$zbp->lang['user_level_name'][2];?></option>
<option value="3" <?php if ($zbp->Config('AnquanLogin')->Lb_LevelRange == 3){echo 'selected="selected"';};?> ><?php echo $zbp->lang['user_level_name'][1] .'+'.$zbp->lang['user_level_name'][2] .'+'. $zbp->lang['user_level_name'][3];?></option>
<option value="4" <?php if ($zbp->Config('AnquanLogin')->Lb_LevelRange == 4){echo 'selected="selected"';};?> ><?php echo $zbp->lang['user_level_name'][1] .'+'.$zbp->lang['user_level_name'][2] .'+'. $zbp->lang['user_level_name'][3] .'+'. $zbp->lang['user_level_name'][4];?></option>
<option value="5" <?php if ($zbp->Config('AnquanLogin')->Lb_LevelRange == 5){echo 'selected="selected"';};?> ><?php echo $zbp->lang['user_level_name'][1] .'+'.$zbp->lang['user_level_name'][2] .'+'. $zbp->lang['user_level_name'][3] .'+'. $zbp->lang['user_level_name'][4] .'+'. $zbp->lang['user_level_name'][5];?></option>
                 </select></td>
                </tr>
              </table>
              <hr/>
              <p>
                <input type="submit" value="提交" class="button" />
              </p>
              <hr/>
            </form>

	<script type="text/javascript">AddHeaderIcon("<?php echo $bloghost . 'zb_users/plugin/AnquanLogin/logo.png';?>");</script>
  </div>
</div>


<?php
require $blogpath . 'zb_system/admin/admin_footer.php';      	  	  
    	   	  	
RunTime();    	   	  	
?>