if(登录成功){
echo '<script>alert(\'登录成功\');location.href="'.$PHP_SELF.'";</script>';
exit;
}
echo '<script>alert(\'登录成功\');location.href="'.$PHP_SELF.'";</script>';
exit;
}
解决方案 »
- windows+php+oracle+apache 开发基于 数据库的WEB网站 OK么?
- 利用自己的专业特长
- htmlentities函数问题
- 大家看哪种写法执行效率高?
- 大家进下面这个网址,帮看看怎样改这些错误,谢谢了
- & 的问题求救
- 大虾救命啊!一个session的问题,一定帮我啊·!高分啊
- 请问各位有谁知道招商银行的网上个人银行系统是用什么写的????
- 我们讨论一下 每个QQ有很多不同好友,数据库如何设计会更方便?
- Parse error: syntax error, unexpected 'else' (T_ELSE), expecting end of file in
- 请问如何向一个页面POST一条字符串,并获取返回值?
- 有用PHPEdit的吗?帮我一下啦
<?php
session_start();
$colname_Recdl = "1";
if (isset($_SESSION['MM_Username'])) {
$colname_Recdl = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_products, $products);
$query_Recdl = sprintf("SELECT * FROM memberdata WHERE m_username = '%s'", $colname_Recdl);
$Recdl = mysql_query($query_Recdl, $products) or die(mysql_error());
$row_Recdl = mysql_fetch_assoc($Recdl);
$totalRows_Recdl = mysql_num_rows($Recdl);$MM_paramName = ""; // *** Start the session
session_start();
// *** Validate request to log in to this site.
$FF_LoginAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING']) && $HTTP_SERVER_VARS['QUERY_STRING']!="") $FF_LoginAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING'];
if (isset($HTTP_POST_VARS['m_username'])) {
$FF_valUsername=$HTTP_POST_VARS['m_username'];
$FF_valPassword=$HTTP_POST_VARS['m_passwd'];
$FF_fldUserAuthorization="";
$FF_redirectLoginSuccess="dlin.php";
$FF_redirectLoginFailed="dlok.php";
$FF_rsUser_Source="SELECT m_username, m_passwd ";
if ($FF_fldUserAuthorization != "") $FF_rsUser_Source .= "," . $FF_fldUserAuthorization;
$FF_rsUser_Source .= " FROM memberdata WHERE m_username='" . $FF_valUsername . "' AND m_passwd='" . $FF_valPassword . "'";
mysql_select_db($database_products, $products);
$FF_rsUser=mysql_query($FF_rsUser_Source, $products) or die(mysql_error());
$row_FF_rsUser = mysql_fetch_assoc($FF_rsUser);
if(mysql_num_rows($FF_rsUser) > 0) {
// username and password match - this is a valid user
$MM_Username=$FF_valUsername;
session_register("MM_Username");
if ($FF_fldUserAuthorization != "") {
$MM_UserAuthorization=$row_FF_rsUser[$FF_fldUserAuthorization];
} else {
$MM_UserAuthorization="";
}
session_register("MM_UserAuthorization");
if (isset($accessdenied) && false) {
$FF_redirectLoginSuccess = $accessdenied;
}
mysql_free_result($FF_rsUser);
session_register("FF_login_failed");
$FF_login_failed = false;
header ("Location: $FF_redirectLoginSuccess");
exit;
}
mysql_free_result($FF_rsUser);
session_register("FF_login_failed");
$FF_login_failed = true;
header ("Location: $FF_redirectLoginFailed");
exit;
}// *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
// create the list of parameters which should not be maintained
$MM_removeList = "&index=";
if ($MM_paramName != "") $MM_removeList .= "&".strtolower($MM_paramName)."=";
$MM_keepURL="";
$MM_keepForm="";
$MM_keepBoth="";
$MM_keepNone="";
// add the URL parameters to the MM_keepURL string
reset ($HTTP_GET_VARS);
while (list ($key, $val) = each ($HTTP_GET_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepURL .= "&".$key."=".urlencode($val);
}
}
// add the URL parameters to the MM_keepURL string
if(isset($HTTP_POST_VARS)){
reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepForm .= "&".$key."=".urlencode($val);
}
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
$MM_keepBoth = $MM_keepURL."&".$MM_keepForm;
if (strlen($MM_keepBoth) > 0) $MM_keepBoth = substr($MM_keepBoth, 1);
if (strlen($MM_keepURL) > 0) $MM_keepURL = substr($MM_keepURL, 1);
if (strlen($MM_keepForm) > 0) $MM_keepForm = substr($MM_keepForm, 1);?>这是代码。。 $FF_redirectLoginSuccess="dlin.php";//(登录成功)
$FF_redirectLoginFailed="dlok.php";//(登录失败)
alert("登陆成功!");
window.history.go(-1);
</script>
登录成功了,马上返回上一个登录页面。如何做?
session_start();
session_unset();
session_destroy();
$tourl=isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:'index.php';
header("location:$tourl");
exit;
?>
然后
<?php
session_start();
session_unset();
session_destroy();
$tourl=isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:'index.php';
header("location:$tourl");
exit;
?>
我以前问过了一次。。你只是把我以前的复制了一下而于。