注册页面动态检测php,php无刷新检测用户名注册页面无法预览

请老师看看我的zhuce.php页面预览是打不开是怎么回事

JS代码错了吗

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

if (PHP_VERSION < 6) {

$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}

}

// *** Redirect if username exists

$MM_flag="MM_insert";

if (isset($_POST[$MM_flag])) {

$MM_dupKeyRedirect="error_yhmcm";

$loginUsername = $_POST['username'];

$LoginRS__query = sprintf("SELECT username FROM user_biao WHERE username=%s", GetSQLValueString($loginUsername, "text"));

mysql_select_db($database_conn, $conn);

$LoginRS=mysql_query($LoginRS__query, $conn) 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 user_biao (username, password, truename, xingbie, email, zhuceIP) VALUES (%s, %s, %s, %s, %s, %s)",

GetSQLValueString($_POST['username'], "text"),

GetSQLValueString($_POST['password'], "text"),

GetSQLValueString($_POST['truename'], "text"),

GetSQLValueString($_POST['xingbie'], "text"),

GetSQLValueString($_POST['email'], "text"),

GetSQLValueString($_POST['zhuceIP'], "text"));

mysql_select_db($database_conn, $conn);

$Result1 = mysql_query($insertSQL, $conn) or die(mysql_error());

$insertGoTo = "zccg.php";

if (isset($_SERVER['QUERY_STRING'])) {

$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

$insertGoTo .= $_SERVER['QUERY_STRING'];

}

header(sprintf("Location: %s", $insertGoTo));

}

?>

无标题文档

body,td,th {

font-size: 12px;

}

var xmlHttp = false;

try {

xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");

} catch (e) {

try {

xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

} catch (e2) {

xmlHttp = false;

}

}

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {

xmlHttp = new XMLHttpRequest();

}

function callServer() {

var name = document.getElementById("username").value;

if ((name == null) || (name == "")) return;

var url = "check.php?name=" + escape(name);

xmlHttp.open("GET", url, true);

xmlHttp.onreadystatechange = updatePage;

xmlHttp.send(null);

}

function updatePage() {

if (xmlHttp.readyState < 4) {

username_ts.innerHTML="正在检测用户名是否可用......";

}

if (xmlHttp.readyState == 4) {

var response = xmlHttp.responseText;

username_ts.innerHTML=response;

}

}

注册会员

用户名:
密码:
真实姓名:
性别:

电子邮件:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值