?? chkreg.php
字號:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: small;
color: #6666FF;
}
-->
</style>
</head>
<body >
<div align="center">
<?
include("head.inc");
require('db_start.inc'); /*表單匹配*/
$name=$_POST[name];
$user_id=$_POST[username];
$password=$_POST[password];
$address=$_POST[address];
//$hobby=$_POST[hobby];
$chknum=$_POST[chknum];
$checknum=$_POST[checknum]; /*傳遞過來驗證*/
$phone1=$_POST[phone1];
$phone2=$_POST[phone2];
$phone=$phone1."-".$phone2;
$sex=$_POST[sex];
$idtify=$_POST[idtify];
$year=$_POST[year];
$month=$_POST[month];
$day=$_POST[day];
$sex=$_POST[sex];
$qq=$_POST[qq];
$email=$_POST[email];
$telephone=$_POST[telephone];
$personal=$_POST[personal];
$a1="";
if($_POST['checkbox']['a']) $a1.="游泳 ";
if($_POST['checkbox']['b']) $a1.="跑步 ";
if($_POST['checkbox']['c']) $a1.="旅游 ";
if($_POST['checkbox']['d']) $a1.="聽歌 ";
if($_POST['checkbox']['e']) $a1.="釣魚 ";
if($_POST['checkbox']['f']) $a1.="打球 ";
if($_POST['checkbox']['g']) $a1.="寫作 ";
if($_POST['checkbox']['h']) $a1.="打機 ";
if($_POST['checkbox']['i']) $a1.="其他";
$hobby=$a1 ;
/*興趣*/
$a=eregi("^[a-z0-9]{6,10}$",$user_id);
//s$b=ereg("[a-z0-9]{1,12}",$name);
$c=eregi("^[a-z0-9]{6,12}$",$password);
$d=ereg("^[0-9]{15,18}$",$idtify);
$e=ereg("^[0-9]{3,4}$",$phone1);
$f=ereg("^[0-9]{7,8}$",$phone2);
$g=ereg("^[0-9]{7,9}$",$qq);
$h=ereg("[a-z0-9]{3,12}@[a-z0-9]{3,12}.[a-z0-9]{3,5}",$email);
$i=ereg("^[0-9]{11}$",$telephone);
if(!$a)
echo "<script> alert('請輸入正確的用戶名!');history.back();</script>";
$flag=0;
if(!$c)
{$flag=1;
echo "<script> alert('請輸入正確的密碼!');history.back();</script>";
}
if(!$d)
{$flag=1;
echo "<script> alert('身份證號碼非法!');history.back();</script>";
}
if(!$e)
{$flag=1;
echo "<script> alert('電話號碼區號非法!');history.back();</script>";
}
if(!$f)
{$flag=1;
echo "<script> alert('電話號碼區號非法!');history.back();</script>";
}
if( $chknum!=$checknum)
{$flag=1;
echo "<script> alert('驗證碼不匹配!');history.back();</script>";
}
if($qq)
{
if(!$g)
{
$flag=1;
echo "<script> alert('qq號碼非法!');history.back();</script>";
}
}
if($email)
{
if(!$h){
$flag=1;
echo "<script> alert('email號碼非法!');history.back();</script>";
}
}
if($telephone)
{
if(!$i){
$flag=1;
echo "<script> alert('手機號碼非法!');history.back();</script>";
}
}
if(!($_POST['checkbox']['a']||$_POST['checkbox']['b']||$_POST['checkbox']['c']||$_POST['checkbox']['d']||$_POST['checkbox']['e']||$_POST['checkbox']['f']||$_POST['checkbox']['g']||$_POST['checkbox']['h']||$_POST['checkbox']['i']))
echo "<script> alert('請填寫興趣欄!');history.back();</script>";
/* 調試輸出
echo '$user_id'.$user_id;
echo '$name'.$name;
echo '$password'.$password;
echo '$address'. $address;
echo '$phone'.$phone;
echo '$sex'.$sex;
echo '$idtify'.$idtify;
//echo $chknum;
//echo $checknum;
echo $year."年".$month."月".$day."日";
echo '$qq'.$qq;
echo '$email'. $email;
echo '$telephone'.$telephone;
echo '$personal'.$personal;
*/
if($flag==0)
{
$sql="INSERT INTO `test`.`web_user` (
`id` ,
`user_id` ,
`name` ,
`password` ,
`birth_y` ,
`birth_m` ,
`birth_d` ,
`hobby` ,
`phone` ,
`telephone` ,
`at_time` ,
`idtify` ,
`address` ,
`sex` ,
`qq` ,
`email` ,
`personal`
)
VALUES (
NULL , '$user_id', '$name', '$password', '$year', '$month', '$day', '$hobby', '$phone', '$telephone', NOW(), '$idtify', '$address', '$sex', '$qq', '$email', '$personal '
);";
$result = mysql_query($sql);
}
?>
<span class="STYLE1">正在處理...</span>
<?
require('copyright.inc');
?>
</div>
<META HTTP-EQUIV=Refresh CONTENT="3; URL=show.php">
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -