Personal Management:
Class Address Book: class/address.php
Session_Start (); Start session
if (!session_is_registered ("Userregister") | | ($userregister = = "")) Check whether registration, such as Userregister is not registered or session is NULL, re-register.
{
echo "Please re-register
";
Exit
}
?>
<title>Class Address Book</title>
Include "config.php";
$result = mysql_query ("SELECT * from User", $db);
$row =mysql_num_rows ($result);//See how many rows the result is
for ($i =0; $i <= ($row-1); $i + +) {
$name =mysql_result ($result, $i, ' name ');
$sex =mysql_result ($result, $i, ' sex ');
$birth =mysql_result ($result, $i, ' birth ');
$ph =mysql_result ($result, $i, ' ph ');
$BP =mysql_result ($result, $i, ' BP ');
$email =mysql_result ($result, $i, ' email ');
$oicq =mysql_result ($result, $i, ' Oicq ');
$work =mysql_result ($result, $i, ' work ');
$photo =mysql_result ($result, $i, ' photo ');
$ad =mysql_result ($result, $i, ' ad ');
$post =mysql_result ($result, $i, ' post ');
$account =mysql_result ($result, $i, ' account ');
$face =mysql_result ($result, $i, ' face ');
$face = ' Image/face/icon '. $face;
echo "
| ...................... 0 Class Address Book 0 ........ ..... |
| Name: $name |
Gender: $sex |
Birthday: $birth |
| Tel: $ph |
Pager: $BP |
| Email: $email |
OICQ: $oicq |
| Work Unit: $work |
P.C.: $post |
| Mailing Address: $ad |
| Personal photos: $photo |
| Personal Note: $account |
";
}
?>
Personal Information Modification: class/modify.php
Session_Start (); Start session
if (!session_is_registered ("Userregister") | | ($userregister = = "")) Check whether registration, such as Userregister is not registered or session is NULL, re-register.
{
echo "Please re-register
";
Exit
}
?>
<title>Modification of personal data</title>
Include "config.php";
if ($submit) {
if (! $username | |! $PSW | |! $PSW 2| |! $name | |! $ad | |! $ph | |! $email) {//check if complete
echo "Sorry, you have to fill in all the items with *!"
"." Re-fill ";
Exit
}
$user =trim ($username);
$PSW =trim ($PSW);
$PSW 2=trim ($PSW 2);
$name =trim ($name);
$birth =trim ($birth);
$work =trim ($work);
$ad =trim ($AD);
$post =trim ($post);
$ph =trim ($PH);
$BP =trim ($BP);
$email =trim ($email);
$oicq =trim ($OICQ);
$account =strip_tags (Trim ($account));//Remove the trailing spaces and HTML tags
$signature =strip_tags (Trim ($signature));
Check that the password is duplicated correctly
if (! $psw = = $PSW 2) {
echo "Please confirm password, return";
Exit
}
Check the legality of email
if (!ereg (' ^[-!#$%& ' *+./0-9=? A-z^_ ' a-z{|} ~]+'.' @'.' [-!#$%& ' *+\/0-9=? A-z^_ ' a-z{|} ~]+.'.' [-!#$%& ' *+\./0-9=? A-z^_ ' a-z{|} ~]+$ ', $email) && $email) {
echo "Email is not legal!
"." Re-fill
";
Exit;}
Write to Database
$sql = "UPDATE user SET user= ' $user ', psw= ' $psw ', name= ' $name ', sex= ' $sex ', birth= ' $birth ', work= ' $work ', ad= ' $ad ', post= ' $post ', ph= ' $ph ', bp= ' $bp ', email= ' $email ', oicq= ' $oicq ', account= ' $account ', signature= ' $signature ', face= ' $face ' where user= ' $userregister ';
$result = mysql_query ($sql, $db);
Mysql_close ($DB);
Send a congratulatory message
$subject = "Congratulations on your successful modification of your personal information". $sitename. "! ";//Theme
$message = $name. "Hello:
Congratulations on your successful modification of your personal information! Your user name is ". $username." And the password is ". $psw."
Login now $sitename ";//letter Content
$headers. = "content-type:text/html; Charset=gb2312n "; Mime type
Mail ($email, $subject, $message, $headers);
echo "Congratulations on your successful revision!" A welcome letter has been sent to your e-mail, please pay attention to check. ";
Exit
}
$result = mysql_query ("SELECT * from user where user= ' $userregister '", $db);
$PSW =mysql_result ($result, 0, "PSW");
$name =mysql_result ($result, 0, "name");//Read personal registration information
$sex =mysql_result ($result, 0, "sex");
$birth =mysql_result ($result, 0, "birth");
$work =mysql_result ($result, 0, "work");
$ad =mysql_result ($result, 0, "ad");
$post =mysql_result ($result, 0, "post");
$ph =mysql_result ($result, 0, "ph");
$BP =mysql_result ($result, 0, "BP");
$email =mysql_result ($result, 0, "email");
$oicq =mysql_result ($result, 0, "Oicq");
$photo =mysql_result ($result, 0, "photo");
$account =mysql_result ($result, 0, "account");
$signature =mysql_result ($result, 0, "signature");
$face =mysql_result ($result, 0, "face");
Mysql_close ($DB);
?>
|
Modification of personal data
Be careful not to have spaces, items with * are required.
|
|
Upload Photo: class/uploadphoto.php
Session_Start (); Start session
if (!session_is_registered ("Userregister") | | ($userregister = = "")) Check whether registration, such as Userregister is not registered or session is NULL, re-register.
{
echo "Please re-register
";
Exit
}
?>
<title>Uploading photos</title>
Include ". /config.php ";
if ($upload) {
if ($picurl = = "None") {
echo "You didn't upload any files.";
Exit
}
$v =opendir ("image");
if ($v ==0)
{mkdir ("image");//If the directory does not exist, create a new
$v =opendir ("image"); Get catalog Handle
}
$up =copy ("$picurl", "image/$picurl _name");
if ($up ==1)
{
Initialize Write content
$result = mysql_query ("SELECT * from user where user= ' $userregister '", $db);//Query previous photo information
$photo =mysql_result ($result, 0, ' photo ');
$photo =str_replace ("'", "'", $photo);//Will ' replace ' with '
$photo = $photo. " See photos | "; /Add this content
mysql_query ("UPDATE user SET photo= ' $photo ' where user= ' $userregister '", $db);//write
Mysql_close ($DB);
echo "File Upload successful!
";
echo "file name: $picurl _name File size: $picurl _size byte file type: $picurl _type
";
}
Else
{echo "File upload failed."; Exit;}
Unlink ($picurl); Delete the archive from the Temp folder $picurl
Closedir ($v); Close directory Handle
Exit
}
?>
http://www.bkjia.com/PHPjc/316114.html www.bkjia.com true http://www.bkjia.com/PHPjc/316114.html techarticle Personal Management: Class Address Book: class/address.php? Session_Start ();//Start session if (!session_is_registered (userregister) | | ($userregister = =)) Check whether to register, such as Userregist ...