今天搞了个登陆框,但是在登陆的时候一直出现等待窗体,又找不出什么原因。用FireBug检验的时候发现数据已经成功POST,但是貌似一直获取不到返回值。卡在waitMsg数据处,死循环。FireBug检查的结果是SYNTAX ERROR : ExtJS制作Form

Ext.onReady(function() {
  Ext.QuickTips.init();
  var Login = new Ext.form.FormPanel({
    labelWidth : 70,
    labelAlign : 'right',
    frame      : true,
    title      : 'Site Manage System',
    bodyStyle  : 'padding:5px 5px 0',
    width      : 350,
    defaults   : {width: 150, msgTarget: 'side'},
    defaultType: 'textfield',
    
    items: [{
      fieldLabel: 'Username',
      name      : 'username',
      allowBlank: false,
      blankText : 'Please input your username'
    }, {
      fieldLabel: 'Password',
      inputType : 'password',
      name      : 'password',
      allowBlank: false,
      blankText : 'Please input your password'
    }],
    
    buttons: [{
      text: 'Login',
      formBind: true,
      type: 'submit',
      handler: function (){
        if (Login.getForm().isValid()) {
  				Login.getForm().submit({
            clientValidation: true,
            waitTitle: 'Waiting',
            waitMsg: 'Check Login Information...',
            method:'POST',
            url:'login.php?action=login',
            success:function(form,action){
              if (action.result.msg == 'OK') {
                document.location = 'admincp.php';
              } else {
                Ext.Msg.alert('Status',action.result.msg);
              }
            },
            failure:function(){
            	Ext.Msg.alert('Status','System Error!');
            }
          });
        }
      }
    },{
      text: 'Cancel',
      handler: function() {Login.form.reset();}
    }]
  });
  
  Login.render(Ext.get('loginForm'));
});


PHP文件

if ($_GET['action'] == 'login') {
	$username = $_POST['username'];
	$password = $_POST['password'];

	if ($db->GetLogin($username, $password)){
		echo "{success:true,msg:'OK'}";
		exit();
	} else {
		echo "{success:true,msg:'Wrong user name or password.'}";exit();
	}
}

Nginx 自动禁止爬虫IP采集

### 背景最近我们有一个公开服务提供给客户查询关键词的热度值,由于这个API做在官方网站上,自然没有用户登陆,也没有很高查询成本,所以设计上没有任何鉴权无法进行身份认定,于是就被一个爬虫开了超高并发请求,直接后端的AWS Tomcat CPU被用尽,导致无法响应。爬虫显然...… Continue reading

Redis原子性事务Lua应用

Published on June 28, 2020