Parse error:syntax error, unexpected ' include ' (t_include) in D:\myweb\add.php
Source code for add.php:
The user registers the data processing file later. You need to check the legitimacy of the information before writing to the database
Get data submitted by registered users
$UserName 1=$_post["UserName"];//user name
$Password 1=$_post["Password"];//password
$ConfirmPassword 1=$_post["ConfirmPassword"];//Confirm password
$Email =$_post["email"];//Email
Define Save Activation Code variable
$actnum = ""
Import Database files
Include ' config.php ';
Define the generated Activation code function
function Check_actnum ()
{
$chars _for_actnum=array ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V "," W "," X "," Y "," Z "," a "," B "," C "," D "," E "," F "," G "," H "," I "," J "," K "," L "," M "," N "," O "," P "," Q "," R "," s "," T "," U "," V "," W ", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
for ($i =1; $i <=20; $i + +)//Generate a 20-character activation code
{
$actnum = $chars _for_actnum[mt_rand (0,count ($chars _for_actnum)-1)];
}
return $actnum;
}
Determine the user name function
function Check_username ($UserName)//user name registered by parameter
{
User name three aspects check
Whether to detect the length of an empty string
$Max _strlen_username=16;//User name Maximum length
$Min _strlen_username=4;//User name Minimum length
$UserNameChars = "^[a-za-z0-9_-]";//Regular expression for string detection
$UserNameGood = "User name detected correctly";//defines the string variable returned
if ($UserName = = "")
{
$UserName = "User name cannot be empty";
return $UserNameGood;
}
if (!reg ("$UserNameChars", $UserName))//Regular expression matching check
{
$UserNameGood = "User Name string detected incorrectly";
return $UserNameGood;
}
if (strlen (UserName) < $Min _strlen_username| | strlen (UserName) > $Max _strlen_username)
{
$UserNameGood = "User name length detection is incorrect";
return $UserNameGood;
}
return $UserNameGood;
}
Determine if a password is a valid function
function Check_password ($Password)
{
Whether to detect the length of an empty string
$Max _strlen_password=16;//Password Maximum length
$Min _strlen_password=6;//Password Minimum length
$PasswordChars = "^[a-za-z0-9_-]";//password string detection regular expression
$PasswordGood = "Password detection is correct";//defines the returned string variable
if ($Password = = "")
{
$PasswordGood = "Password cannot be empty";
return $PasswordGood;
}
if (!ereg ("$PasswordChars", $Password))
{
$PasswordGood = "Password string detection is incorrect";
return $PasswordGood;
}
if (strlen ($Password) < $Min _strlen_password) | | strlen ($Password) > $Max _strlen_password)
{
$PasswordGood = "Password length detection is incorrect";
return $PasswordGood;
}
return $PasswordGood;
}
Determine if a mailbox is a legitimate function
function Check_email ($Email)
{
$EmailChars = "^[_a-z0-9-]+ (. [ _a-z0-9-]+) *@[a-z0-9-]+ (. [ a-z0-9-]+) *$ ";//Regular expression to determine whether it is a legitimate e-mail address
$EmailGood = "Mailbox detection is correct";
if ($Email = = "")
{
$EmailGood = "Mailbox cannot be empty";
return $EmailGood;
}
return $EmailGood;
}
Determine if the password input is consistent two times
function Check_confirmpassword ($Password, $ConfirmPassword)
{
$ConfirmPasswordGood = "Two times password input consistent";
if ($Password <> $ConfirmPassword)
{
$ConfirmPasswordGood = "Two times password input inconsistency";
return $ConfirmPasswordGood;
}
Else
return $ConfirmPasswordGood;
}
Calling functions to detect user input data
$UserNameGood =check_username ($UserName 1);
$PasswordGood =check_password ($Password 1);
$EmailGood =check_email ($Email);
$ConfirmPasswordGood =check_confirmpassword ($Password 1, $ConfirmPassword 1);
$error =false;//Define the variable to determine if the registration data is faulty
if ($UserNameGood! = "User name detected correctly")
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.