新建一个Html页面,显示出错信息,在此页面中做一个链接到登录窗口

解决方案 »

  1.   

    <%
    if notlogin then
      response.write "<script> alert('登录失败');history.go(-1);</script>"
      response.end
    end if
    %>
      

  2.   

    <%
    '验证登陆的代码。。开始。。
    '***************
    '验证登陆的代码。。结束。。if checkuser_OK=True then
         response.write "<script>alert('登录成功');</script>"
    else
         response.write "<script>alert('登陆失败);</script>"
    end if%>
      

  3.   

    有没有用php来写的呢?php函数?
      

  4.   

    <?php 
    if($username!="..." and $userpwd!="...")
    {
    ?>
    <scirpt language=javascript>
    alert("错误!");
    now=new date();
    window.nivagate("")
    </script>
    <?php
    }
    ?>
      

  5.   

    if(失败){
    echo'<script>window.alert("失败的描述");window.location.href="登陆页面的URL";</script>';
    exit;}
      

  6.   

    if(!mysql_num_rows($idresu)||strcmp($password,mysql_result($idresu,0,"password")) ) {
          mysql_close($db);
          Header("Location:errormsg.php?errmsg=不正确的用户名或密码!");
          reutrn;}
      else {
          Session_Register("current_user");
          $current_user=$user;
          Session_Register("current_user1");
          $current_user1=$dwmc;
          Session_Register("current_user2");
          $current_user2=$dwbm;
          include("index1.php");//登陆成功进入发布页面
      }
    }
    ?>
      

  7.   

    //管理员登录
    function ManagerLogin()
    {
    if (empty($_SERVER["PHP_AUTH_USER"])||empty($_SERVER["PHP_AUTH_PW"])||$_SESSION["LoginAgain"] == true)
    {
    session_unregister("LoginAgain");
    if ($_GET["ManagerType"] == "SystemAdministrator")
    {
    switch ($_SESSION["LanguageType"])
    {
    case "中文繁體":
    Header('WWW-Authenticate: Basic realm="系統管理員"');
    break;
    case "English":
    Header('WWW-Authenticate: Basic realm="System Administrator"');
    break;
    default:
    Header('WWW-Authenticate: Basic realm="系统管理员"');
    break;
    }
    }
    //AuthorizationManager
    else
    {
    switch ($_SESSION["LanguageType"])
    {
    case "中文繁體":
    Header('WWW-Authenticate: Basic realm="授權管理員"');
    break;
    case "English":
    Header('WWW-Authenticate: Basic realm="Authorization Manager"');
    break;
    default:
    Header('WWW-Authenticate: Basic realm="授权管理员"');
    break;
    }
    }
    Header("HTTP/1.0 401 Unauthorized");
    }
    else
    {
    ConnectDatabase();
    if ($_GET["ManagerType"] == "SystemAdministrator")
    {
    $SelectUserSql = 'select MasterLogName,MasterLogPassword from master where MasterLogName="'.$_SERVER["PHP_AUTH_USER"].'" and MasterLogPassword=password("'.$_SERVER["PHP_AUTH_PW"].'")';
    $RunSUS = mysql_query($SelectUserSql);
    $SelectResult = mysql_num_rows($RunSUS);
    if($SelectResult == 1)
    {
    $ResultRSUS = mysql_fetch_array($RunSUS);
    $UserLoginName = $ResultRSUS[MasterLogName];
    $UserLoginPermission = 6;
    }
    }
    else
    {
    $SelectUserSql = 'select UserLogName,UserLogPassword,UserPermission from user where UserLogName="'.$_SERVER["PHP_AUTH_USER"].'" and UserLogPassword=password("'.$_SERVER["PHP_AUTH_PW"].'")';
    $RunSUS = mysql_query($SelectUserSql);
    $SelectResult = mysql_num_rows($RunSUS);
    if($SelectResult == 1)
    {
    $ResultRSUS = mysql_fetch_array($RunSUS);
    $UserLoginName = $ResultRSUS[UserLogName];
    $UserLoginPermission = $ResultRSUS[UserPermission];
    }
    }
    //如果登录失败,则重新弹出登录对话框
    if($SelectResult < 1)
    {
    $_SESSION["LoginAgain"] = true;
    echo '<script langauge="javascript">';
    echo ' alert("LoginName or LoginPassword is Wrong!");';
    echo ' window.location = "login.php";';
    echo '</script>';
    }
    //否则登录成功进入管理界面
    else
    {
    $_SESSION["UserLoginName"] = $UserLoginName;
    $_SESSION["UserLoginPermission"] = $UserLoginPermission;
    Header("Location:manage.php");
    }
    }
    }