﻿  //处理方法
    function CheckIsLogin()
    {
    send_request("/ashx/CheckUser.ashx?timeid="+Math.random()+"","flag=islogin","reciveusername");
    }
    
    function reciveusername()
  { 
   if (http_request.readyState == 4) { // 判断对象状态
    
            if (http_request.status == 200) { // 信息已经成功返回，开始处理信息
           
              chuliusername(http_request.responseText);
            //lert(http_request.responseText);
            }
            else
             {
             //页面不正常
                alert("您所请求的页面有异常。");
            }
        }
        else
        {

        }
    }
    
   function chuliusername(str)
    {
     
      if(str=="0")
      {
          window.location.href="/random/index.aspx";
      }
      else
      {
      window.location.href="/member/index.aspx";
      }

    } 
    
    
    
    
     //是否有该用户
    function CheckHaveUser()
    {
    if(document.getElementById("login1_name").value=='')
    {
    alert("用户名必须填写!");
    return false;
    }
    
    if(document.getElementById("login1_password").value=='')
    {
    alert("密码不能为空!");
    return false;
    }
    send_request("/ashx/Handler.ashx?timeid="+Math.random()+"","flag=haveuser&username="+encodeURIComponent(document.getElementById("login1_name").value)+"&password="+encodeURIComponent(document.getElementById("login1_password").value)+"","haveusername")
    }
//否有该用户返回状态
    function haveusername()
  { 
   if (http_request.readyState == 4) { // 判断对象状态

            if (http_request.status == 200) { // 信息已经成功返回，开始处理信息
           
              alerthaveuser(http_request.responseText);
            }
            else
             {
             //页面不正常
                alert("您所请求的页面有异常。");
                return false;
            }
        }
        else
        {

        }
     
    }
    
   function alerthaveuser(str)
    {
      if(str=="0")
      {
          alert('对不起，您的用户名或者密码错误，请重新输入');
          return false;
      }else
      {
       top.location.href='/user/index.aspx';
      }

    } 
    
   
