您现在的位置: 军旅同心-旅游自驾-军旅文学 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 正文
杏林同学录(四)
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 14:36:05
个人管理:
   班级通讯录:class/address.php
<?
session_start(); // 开始session
if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册.
{
echo "<a href='../index.php'>请重新注册<BR>";
exit;
}
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>班级通讯录</TITLE>
<style type="text/css">
<!--
.white12 {  font-size: 12pt; color: #FFFFFF; text-decoration: none}
.blue9 {  font-size: 9pt; color: #9999FF}
-->
</style>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<table width="98%" border="0" cellspacing="0" cellpadding="0" height="65">
  <tr>  
    <td width="35%"><img src="image/classlogo.gif" width="224" height="60"> </td>
    <td width="65%">  
      <table width="97%" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#CC0000" bordercolordark="#FFFFFF" bordercolor="#FFFFFF">
        <tr>  
          <td><img src="image/aslist.gif" width="470" height="70" alt="班级通讯录"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<?php
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 "<table width='76%' border='1' cellspacing='0' cellpadding='0' bordercolorlight='#330099' bordercolordark='#FFFFFF' align='center' class='blue9'> <tr bgcolor='#3399FF'> <td colspan='8'>      <div class='white12' align='center'>......................○班级通讯录○....................</div>    </td> </tr> <tr>  <td width='30%'><img src='$face.gif' width='32' height='32'>&nbsp;姓名:$name</td>  <td colspan='6'>性别:$sex</td> <td width='35%'>生日:$birth</td>  </tr> <tr> <td colspan='7'>电话: $ph</td> <td width='34%'>传呼:$bp</td> </tr> <tr>  <td colspan='7'>Email:<a href='mailto:$email'>$email</a></td>  <td width='34%'>oicq:$oicq</td> </tr> <tr> <td colspan='7'>工作单位:$work</td> <td width='34%'>邮编:$post</td></tr> <tr><td colspan='8'>通讯地址:$ad</td></tr> <tr>  <td colspan='8'>个人照片:$photo</td> </tr>  <tr> <td colspan='8'>个人说明:$account</td> </tr></table>";
}   
?>  

</BODY>
</HTML>
个人资料修改:class/modify.php
<?
session_start(); // 开始session
if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册.
{
echo "<a href='../index.php'>请重新注册<BR>";
exit;
}
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>个人资料修改</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<?php
include "config.php";
if ($submit){
if (!$username||!$psw||!$psw2||!$name||!$ad||!$ph||!$email){           //检查是否填写完整
      echo "对不起,您必须填所有带*的项目!<BR>"."<a href='javascript:history.back()'>重填</a>";
      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 "请确认密码,<a href='javascript:history.back()'>返回</a>";
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不合法!<BR>"."<a href='register_step2.php?yname=$name'>重填</a><BR>";
       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.",你好:<BR>&nbsp;&nbsp;祝贺你成功修改个人信息!您的用户名为".$username.",密码为".$psw."<BR>现在登陆<a href='$url'>$sitename</a>";//信件内容
$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);
?>
<table width='95%' border='0' cellspacing='0' cellpadding='0' align='center'>
  <tr>  
    <td colspan="2">  
      <div align="center"><img src="image/classlogo.gif" width="224" height="60"></div>
    </td>
  </tr>
  <tr>  
    <td>  
      <div align="center">个人资料修改<br>
        注意不要有空格,带*的项目为必填。</div>
    </td>
  </tr>
  <tr>  
    <td colspan="2">  
      <form method='post' action='<? echo $PHP_SELF;?>'>
        <table width="95%" border="1" cellspacing="1" cellpadding="0" align="center" bordercolor="#FFCC00">
          <tr>
            <td height="153" width="60%"><br>
              用户名:  
              <input type='Text' name='username' size='12' maxlength='12' value="<? echo $userregister;?>">
              *<br>
              (英文字母或加数字,长度不超过12)<br>
          密码:  
&n

[1] [2] [3] 下一页


更多
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
  • 上一篇文章:
  • 下一篇文章:
  • 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 网站地图 | 版权申明 | 网站公告 | 管理登录 |