fff fffff
源代码在线查看: function.php.bak
//######################定义函数checkuser()##########################
function checkuser(){
global $user_name,$user_card,$user_pass,$user_repass,$user_email,$user_ques,$user_answ;
global $hostname,$dbuser,$dbname,$dbpassword,$book_table,$send_table,$user_table;
if(empty($user_name)){echo "用户名不能为空。";
echo "点此返回";
exit;}
if(empty($user_card)){
echo "请输入你的借阅证号";
exit;
}
if(strlen($user_card)'8'){
echo"你输入的借阅证号码位数不对。";
echo "点此返回";
exit;
}
if(empty($user_pass)){
echo "你的密码呢?";
echo "点此返回";
exit;
}
if(empty($user_repass)||(strcmp($user_pass,$user_repass))){
echo "你的确认密码有误";
echo "点此返回";
exit;
}
if(empty($user_email)){
echo "你的E-MAIL不能为空。";
echo "点此返回";
exit;
}
if(!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$",$user_email)){
echo "你的E-MAIL格式不对。";
echo "点此返回";
exit;
}
//$db=mysql_connect($hostname,$dbuser,$dbpassword) or die("数据库连接错误!");
$db=mysql_connect($hostname,$dbuser);
mysql_select_db($dbname,$db);
$sql="select*from $user_table where user_name='".$user_name."'";
$result=mysql_query($sql,$db);
if(mysql_fetch_object($result))
{
echo"已经有相同的名字存在,请重新填写";
exit;
}
$query=mysql_query("insert into $user_table values('','$user_name','$user_card','$user_pass','$user_email','$user_ques','$user_answ')") or die("数据表连接错误。");
if($query){
echo $user_name.",感谢你的注册,如果此页面没有自动返回,请点击此处返回登录";
echo "";
}
}
?>