个人管理:
班级通讯录:class/address.php
session_start(); // 开始session
if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册.
{
echo "请重新注册
";
exit;
}
?>
班级通讯录 include "config.php";
$result = mysql_query("SELECT * FROM user",$db);
$row=mysql_num_rows($result);//查看结果有多少行
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 "
......................○班级通讯录○.................... |
姓名:$name | 性别:$sex | 生日:$birth |
电话: $ph | 传呼:$bp |
Email:$email | oicq:$oicq |
工作单位:$work | 邮编:$post |
通讯地址:$ad |
个人照片:$photo |
个人说明:$account |
";
}
?>
个人资料修改:class/modify.php
session_start(); // 开始session
if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册.
{
echo "请重新注册
";
exit;
}
?>
个人资料修改 include "config.php";
if ($submit){
if (!$username||!$psw||!$psw2||!$name||!$ad||!$ph||!$email){ //检查是否填写完整
echo "对不起,您必须填所有带*的项目!
"."重填";
exit;
}
$user=trim($username);
$psw=trim($psw);
$psw2=trim($psw2);
$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));//去掉首尾空格及html标记
$signature=strip_tags(trim($signature));
//检查密码重复是否正确
if (!$psw==$psw2){
echo "请确认密码,返回";
exit;
}
//检查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不合法!
"."重填
";
exit;}
//写入数据库
$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);
//发祝贺邮件
$subject="祝贺你成功修改个人信息".$sitename."!";//主题
$message=$name.",你好:
祝贺你成功修改个人信息!您的用户名为".$username.",密码为".$psw."
现在登陆$sitename";//信件内容
$headers .= "Content-Type: text/html; charset=gb2312n"; // Mime type
mail($email,$subject,$message,$headers);
echo "恭喜您修改成功!一封欢迎信已发到您的邮箱,请注意查收。";
exit;
}
$result = mysql_query("SELECT * FROM user where user='$userregister'",$db);
$psw=mysql_result($result,0,"psw");
$name=mysql_result($result,0,"name");//读取个人注册信息
$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);
?>
|
个人资料修改 注意不要有空格,带*的项目为必填。 |
|
上传照片:class/uploadphoto.php
session_start(); // 开始session
if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册.
{
echo "请重新注册
";
exit;
}
?>
上传照片 include "../config.php";
if ($upload){
if ($picurl=="none"){
echo "你没有上传任何文件.";
exit;
}
$v=opendir("image");
if ($v==0)
{ mkdir("image"); //若目录不存在,则新建一个
$v=opendir("image"); //取得目录handle
}
$up=copy("$picurl","image/$picurl_name");
if($up==1)
{
//初始化写入内容
$result = mysql_query("SELECT * FROM user where user='$userregister'",$db);//查询以往照片信息
$photo=mysql_result($result,0,'photo');
$photo=str_replace("'","'",$photo);//将'用'代替
$photo=$photo."看照片|";//加上此次内容
mysql_query("UPDATE user SET photo='$photo' where user='$userregister'",$db);//写入
mysql_close($db);
echo "文件上传成功!
";
echo "文件名:$picurl_name 文件大小:$picurl_size byte 文件类型:$picurl_type
";
}
else
{echo "文件上传失败.";exit;}
unlink ($picurl); //从临时文件夹中删除档案$picurl
closedir ($v); //关闭目录handle
exit;
}
?>
|
上传照片 |
|
以上就介绍了同学录5460 杏林同学录四,包括了同学录5460方面的内容,希望对PHP教程有兴趣的朋友有所帮助。