用php+dw做一个注册页面,点击注册却不能跳转,但注册信息已经在数据库已经有了,求大神解答 20
//***Redirectifusernameexists$MM_flag="MM_insert";if(isset($_POST[$MM_flag])){$MM_dup...
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="regfail.php";
$loginUsername = $_POST['username'];
$LoginRS__query = sprintf("SELECT username FROM member WHERE username=%s", GetSQLValueString($loginUsername, "text"));
mysql_select_db($database_memberconn, $memberconn);
$LoginRS=mysql_query($LoginRS__query, $memberconn) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
//if there is a row in the database, the username was found - can not add the requested username
if($loginFoundUser){
$MM_qsChar = "?";
//append the username to the redirect page
if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
$MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
header ("Location: $MM_dupKeyRedirect");
exit;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO member (username, password, question, answer, truename, sex, address, tel, QQ, email, authority) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['question'], "text"),
GetSQLValueString($_POST['answer'], "text"),
GetSQLValueString($_POST['truename'], "text"),
GetSQLValueString($_POST['sex'], "text"),
GetSQLValueString($_POST['address'], "text"),
GetSQLValueString($_POST['tel'], "text"),
GetSQLValueString($_POST['QQ'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['authority'], "text"));
mysql_select_db($database_memberconn, $memberconn);
$Result1 = mysql_query($insertSQL, $memberconn) or die(mysql_error());
$insertGoTo = "regok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
}
这是代码,点击注册网页提示问题出在这一句header(sprintf("Location: %s", $insertGoTo)); 展开
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="regfail.php";
$loginUsername = $_POST['username'];
$LoginRS__query = sprintf("SELECT username FROM member WHERE username=%s", GetSQLValueString($loginUsername, "text"));
mysql_select_db($database_memberconn, $memberconn);
$LoginRS=mysql_query($LoginRS__query, $memberconn) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
//if there is a row in the database, the username was found - can not add the requested username
if($loginFoundUser){
$MM_qsChar = "?";
//append the username to the redirect page
if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
$MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
header ("Location: $MM_dupKeyRedirect");
exit;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO member (username, password, question, answer, truename, sex, address, tel, QQ, email, authority) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['question'], "text"),
GetSQLValueString($_POST['answer'], "text"),
GetSQLValueString($_POST['truename'], "text"),
GetSQLValueString($_POST['sex'], "text"),
GetSQLValueString($_POST['address'], "text"),
GetSQLValueString($_POST['tel'], "text"),
GetSQLValueString($_POST['QQ'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['authority'], "text"));
mysql_select_db($database_memberconn, $memberconn);
$Result1 = mysql_query($insertSQL, $memberconn) or die(mysql_error());
$insertGoTo = "regok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
}
这是代码,点击注册网页提示问题出在这一句header(sprintf("Location: %s", $insertGoTo)); 展开
1个回答
2015-10-02
展开全部
header('Location:要跳转的链接');
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询