PHP Tutorial User Registration Instance code, suitable for beginners
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 "Captcha error". "
";
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 user name already exists, please replace it!" ";
Exit ();
}
else{
echo "";
}
}
?>
http://www.bkjia.com/PHPjc/631994.html www.bkjia.com true http://www.bkjia.com/PHPjc/631994.html techarticle PHP Tutorial User Registration Instance code, suitable for Beginners if ($_post[submit]) {checkusername ($_post[username]), if ($_session[code]==$_post[code]) {$ Username= Str_replace (,, $_post[usern ...