if ($_post[submit]) {
Checkusername ($_post[username]);
if ($_session["code"]==$_post[code])
{
$username = Str_replace ("", "", $_post[username]);
$password =md5 ($_post[password]. ALL_PS);
$sql = INSERT into ' member '. ' User_list ' (' uid ', ' m_id ', ' username ', ' password ') VALUES (NULL, ' $_post[select] ', ' $ Username ', ' $password ');
MySQL tutorial _query ($sql);
echo "registered successfully";
}
Else
{
echo "Authentication code error." <br> ";
Session_destroy ();
}
}
function Checkusername ($username)
{
$sql 2 = "Select UID from user_list where Username= '". Mysql_escape_string ($username). "'";
$result = mysql_query ($sql 2) or Die (' ERROR: ' . Mysql_error ());
if (mysql_num_rows ($result) >0)
{
echo "The username already exists, please replace it!" ";
Exit ();
}
else{
echo "<script> location.href= ' reg.php ' </script>";
}
}
?>
<link href= "common.css Tutorial" Type=text/css rel=stylesheet>
<form action= "" method= "POST" >
User name: <input type= "text" name= "username" style= "height:23px"/><br>
Password: <input type= "password" name= "password" style= "height:23px"/><br>
Position
<select name= "Select" size= "1" style= "height:23px"/>
<option value= "1" >1</option>
<option value= "2" >2</option>
</select>
<br/>
Verification code: <input type= "code" name= "code" size= "style=" "height:23px"/>
<br><br>
<input type= "Submit" name= "submit" value= "registered"/>
</form>