杏林同學錄(四)

來源:互聯網
上載者:User
關鍵字 杏林同學錄(四)
個人管理:
  班級通訊錄: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:$emailoicq:$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;
}
?>








                  
 
   上傳照片
  
 




  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.