<?php
?>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title>yd631_php_user Member Management Example </title>
<body><center>
<form name= "Form1" method= "Post" action= "reg_cl.php" ><table width= "68%" height= "304" border= "0" cellpadding= "0" cellspacing= "1" bgcolor= "#000000" >
<TR align= "center" bgcolor= "#CCCCCC" >
<TD colspan= "2" > Registration (reg.php) | | <a href= "index.php" > Return </a></td>
</tr>
<tr bgcolor= "#CCCCCC" >
<TD width= "29%" align= "right" > Username:</td>
<TD width= "71%" align= "left" ><input name= "Yd631_name" type= "text" id= "Yd631_name" ></td>
</tr>
<tr bgcolor= "#CCCCCC" >
<TD align= "Right" > Password:</td>
<TD align= "left" ><input name= "YD631_PWS" type= "password" id= "YD631_PWS" ></td>
</tr>
<tr bgcolor= "#CCCCCC" >
<TD align= "right" > Sex:</td>
<TD align= "left" ><input name= "Yd631_sex" type= "Radio" value= "Male" checked>
Man
<input type= "Radio" name= "Yd631_sex" value= "female" >
Female </td>
</tr>
<tr bgcolor= "#CCCCCC" >
<TD align= "Right" > Age:</td>
<TD align= "left" ><input name= "Yd631_age" type= "text" id= "Yd631_age" size= "Ten" maxlength= "4" ></td>
</tr>
<tr bgcolor= "#CCCCCC" >
<TD align= "Right" > Telephone:</td>
<TD align= "left" ><input name= "Yd631_call" type= "text" id= "Yd631_call" ></td>
</tr>
<tr bgcolor= "#CCCCCC" >
<TD align= "Right" > Mail:</td>
<TD align= "left" ><input name= "Yd631_email" type= "text" id= "Yd631_email" ></td>
</tr>
<tr bgcolor= "#CCCCCC" >
<TD align= "Right" > Address:</td>
<TD align= "left" ><input name= "yd631_address" type= "text" id= "yd631_address" size= "></td>"
</tr>
<TR align= "center" bgcolor= "#CCCCCC" >
<TD colspan= "2" ><input type= "Submission" name= "submit" value= "submitted" >
<input type= "reset" name= "Submit" value= "reset" ></td>
</tr>
</table>
</form>
</center>
</body>
Register PHP Processing page
<?php
Registering processing pages
Www.yd631.com
Technical D.joy
function Checkmail ($nmail) {///Authentication e-mail address
if (Ereg ("^ [a-za-z0-9_-]) +@ ([a-za-z0-9_-]) + (. [ A-za-z0-9_-]) + ", $nmail))
return true;
Else
return false;
}
Include ("config.php"); Parameter page fetch over
if (Empty ($_post["Yd631_name"])) {
Echo ("<script type= ' Text/javascript ' > Alert (' username cannot be empty '); History.go ( -1);</script>");
Exit
}
if (Empty ($_post["YD631_PWS"])) {
Echo ("<script type= ' Text/javascript ' > alert (' Password is empty '); History.go ( -1);</script>");
Exit
}
if (Empty ($_post["Yd631_sex"])) {
Echo ("<script type= ' Text/javascript ' > Alert (' Gender '); History.go ( -1);</script>");
Exit
}
if (Empty ($_post["Yd631_age"])) {
Echo ("<script type= ' Text/javascript ' > alert (' Age cannot be empty '); History.go ( -1);</script>");
Exit
}
if (!is_numeric ($_post["Yd631_age"])) {
Echo ("<script type= ' Text/javascript ' > Alert (' Age is numeric '); History.go ( -1);</script>");
Exit
}
if (Empty ($_post["Yd631_call"])) {
Echo ("<script type= ' Text/javascript ' > alert (' Telephone cannot be empty '); History.go ( -1);</script>");
Exit
}
if (!is_numeric ($_post["Yd631_call"])) {
Echo ("<script type= ' Text/javascript ' > alert (' Telephone number '); History.go ( -1);</script>");
Exit
}
if (Empty ($_post["Yd631_email"])) {
Echo ("<script type= ' Text/javascript ' > Alert (' Mailbox cannot be empty '); History.go ( -1);</script>");
Exit
}
if ($_post["Yd631_email"]!= "") {
if (!checkmail ($_post["Yd631_email"])) {
Echo ("<script type= ' Text/javascript ' > Alert (' Incorrect, mailbox format '); History.go ( -1);</script>");
Exit
}
}
if (Empty ($_post["yd631_address"])) {
Echo ("<script type= ' Text/javascript ' > alert (' Address cannot be empty '); History.go ( -1);</script>");
Exit
}
$yd 631_name=$_post["Yd631_name"];
$yd 631_pws=$_post["YD631_PWS"];
$yd 631_sex=$_post["Yd631_sex"];
$yd 631_age=$_post["Yd631_age"];
$yd 631_call=$_post["Yd631_call"];
$yd 631_email=$_post["Yd631_email"];
$yd 631_address=$_post["Yd631_address"];
$yd 631_time=date ("y-m-d");
$yd 631_pass= "No";
$db =mysql_connect ($servername, $sqlservername, $SQLSERVERPWS);
mysql_select_db ($sqlname, $db);
$sql = "SELECT * from $sqltable where yd631_name= ' $yd 631_name '";
$result =mysql_fetch_row (mysql_query ($sql));
if ($result) {
Echo ("<script type= ' Text/javascript ' > Alert (' username is in, you cannot register this name '); History.go ( -1);</script>");
}
else{
$sql = "INSERT INTO $sqltable (yd631_name,yd631_pws,yd631_sex,yd631_age,yd631_call,yd631_email,yd631_address,yd631_ Time,yd631_pass values (' $yd 631_name ', ' $yd 631_pws ', ' $yd 631_sex ', ' $yd 631_age ', ' $yd 631_call ', ' $yd 631_email ', ' $ Yd631_address ', ' $yd 631_time ', ' $yd 631_pass ');
mysql_query ($sql);
Echo ("<script type= ' Text/javascript ' > Alert (' Add success '); location.href= ' index.php ';</script>");
}
?>
MySQL Database
--
--The structure of the table ' Yd631_users '
--
CREATE TABLE ' yd631_users ' (
' yd631_id ' int () not NULL auto_increment,
' yd631_name ' varchar (10) Default NULL,
' YD631_PWS ' varchar (a) default null,
' yd631_sex ' varchar (4) default NULL,
' Yd631_age ' varchar (4) default NULL,
' yd631_call ' varchar ' default NULL,
' yd631_email ' varchar (2 0 default NULL,
' yd631_address ' text,
' yd631_pass ' varchar (4) default NULL,
' Yd631_time ' Date default NULL,
PRIMARY key (' yd631_id ')
);