有关登录的简单问题。 新建一个Html页面,显示出错信息,在此页面中做一个链接到登录窗口 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <%if notlogin then response.write "<script> alert('登录失败');history.go(-1);</script>" response.endend if%> <%'验证登陆的代码。。开始。。'***************'验证登陆的代码。。结束。。if checkuser_OK=True then response.write "<script>alert('登录成功');</script>"else response.write "<script>alert('登陆失败);</script>"end if%> 有没有用php来写的呢?php函数? <?php if($username!="..." and $userpwd!="..."){?><scirpt language=javascript>alert("错误!");now=new date();window.nivagate("")</script><?php}?> if(失败){echo'<script>window.alert("失败的描述");window.location.href="登陆页面的URL";</script>';exit;} 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");//登陆成功进入发布页面 }}?> //管理员登录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"); } }} QQ空间那种 是怎么实现图片的检测的 PHP怎么用转义符包这句话 url的问题 php namespace与use的问题 php 正则提取XML 指定内容方法?求大拿帮忙(史上最难) php中怎样得到从表单提交过来的信息?急!!!! 求一个sql,高手请进!在线等!觖决马上结贴! 本论坛贴子的版权归谁所有? 关于数据提取锁定的问题 php socket 编程 测试问题 如何去掉 IE浏览器上 标准按钮,地址栏,链接等 很奇怪的问题,关于身份验证
if notlogin then
response.write "<script> alert('登录失败');history.go(-1);</script>"
response.end
end if
%>
'验证登陆的代码。。开始。。
'***************
'验证登陆的代码。。结束。。if checkuser_OK=True then
response.write "<script>alert('登录成功');</script>"
else
response.write "<script>alert('登陆失败);</script>"
end if%>
if($username!="..." and $userpwd!="...")
{
?>
<scirpt language=javascript>
alert("错误!");
now=new date();
window.nivagate("")
</script>
<?php
}
?>
echo'<script>window.alert("失败的描述");window.location.href="登陆页面的URL";</script>';
exit;}
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");//登陆成功进入发布页面
}
}
?>
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");
}
}
}