Create a Database Tutorial connection
MySQL tutorial _connect (' localhost ', ' 111cn.net ', ' www.111cn.net ');
mysql_select_db (' www.111cn.net ');//Database selection
mysql_query (' Set names "GBK");
Progress Query Operations
?>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<script language= "JavaScript Tutorial" >
Check111cnnet ()
{
if (Myfm.uid.value = = ")
{
Alert (' Www.111cn.net prompts you: username error ');
return false;
}
if (! myfm.pwd.value!= ' && myfm.pwd.value = = myfm.pwd1.value)
{
Alert (' Www.111cn.net prompts you: two times password incorrect ');
return false;
}
}
</script>
<body>
<form id= "myFM" name= "myFM" method= "POST" action= ""
<label>
username br> <input type= "text" name= "UID"/>
<br>
Password
<input type= "text" Nam E= "pwd"/>
<br>
Password 2
<input type= "text" name= "Pwd2"/>
<br>
& nbsp </label>
<LABEL>
<input type= "Submit" name= "submit" value= "register" onclick= "return Check111cnnet (); "/>
</label>
</form>
</body>
<?php
if ($_post)
{
$uid = $_post[' uid '];
$pwd = $_post[' pwd '];
$PWD 1 = $_post[' pwd1 '] ;
if (Empty ($uid)) {exit ();} &NBSP
$sql = "SELECT * from user where uid = ' $uid ' limit 0,10";
$query = mysql_query ($sql) or Die ("W Ww.111cn.net prompts you: "Query Error");
if (mysql_num_rows ($query))
{
echo ' user has already been registered ';
}
els E&NBSP;&NBSP
{
if (mysql_query ("INSERT into User (UID,PWD) VALUES (' $uid ', ' MD5 ($PWD) ')")
{
echo ' www.111cn.net prompts you: Register for success ';
else
{
echo ' registration failed ';
}
}
/*
Data table structure
CREATE TABLE ' 111cnNet '. ' User ' (
' ID ' INT (8) not NULL auto_increment,
' UID ' CHAR ($) NULL,
' pwd ' char (NULL),
PRIMARY KEY (' id ')
) ENGINE
This tutorial is only for learning to use no security processing, such as for commercial use of any problems with the site www.111cn.net has nothing to do
*/
Original site reprint must indicate the source or the source of responsibility http://www.111cn.net/phper/php.html
?>