個人管理:
班級通訊錄: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;
}
?>