侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

杏林同学录(四)

技术  /  管理员 发布于 7年前   406

个人管理:
   班级通讯录:class/address.php
<?
session_start(); // 开始session
if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册.
{
echo "<a href='https:/article/../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='https:/article/$face.gif' width='32' height='32'> 姓名:$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='https:/article/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='https:/article/../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=''>重填</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=''>返回</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='https:/article/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>  祝贺你成功修改个人信息!您的用户名为".$username.",密码为".$psw."<BR>现在登陆<a href='https:/article/$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>
          密码:  
          <input type='password' name='psw' size='8' maxlength='8' value="<? echo $psw; ?>">
              *<br>
              (英文字母或加数字,长度不超过8个字符)<br>
          确认密码:  
          <input type='password' name='psw2' size='8' maxlength='8' value="<? echo $psw; ?>">
          *<br>
          姓名:  
          <input type='Text' name='name' size='8' maxlength='8' value="<? echo $name; ?>">
          *<br>
          性别:男  
          <input type='radio' name='sex' value='男' <? if ($sex=='男'){echo "checked";} ?>>
          女  
          <input type='radio' name='sex' value='女' <? if ($sex=='女'){echo "checked";} ?>>
          <br>
          生日:<input type="text" name="birth" size="12" maxlength="12" value="<? echo $birth; ?>"><br>
          工作单位:  
          <input type='Text' name='work' size='30' maxlength='50' value="<? echo $work; ?>">
          <br>
          通讯地址:  
          <input type='Text' name='ad' size='30' maxlength='50' value="<? echo $ad; ?>">
          *<br>
          邮编:  
          <input type='Text' name='post' size='6' maxlength='6' value="<? echo $post; ?>">
          <br>
          电话:  
          <input type='Text' name='ph' size='15' maxlength='30' value="<? echo $ph; ?>">
          *<br>
          传呼:  
          <input type='Text' name='bp' size='15' maxlength='20' value="<? echo $bp; ?>">
          <br>
          Email:  
          <input type='Text' name='email' size='15' maxlength='35' value="<? echo $email; ?>">
          *<br>
          oicq:  
          <input type='Text' name='oicq' size='12' maxlength='12' value="<? echo $oicq; ?>">
          <br>
          个人说明:(在通讯录里显示,不超过125个汉字)<BR>
          <textarea name='account' cols='50' rows='5'><? echo $account; ?></textarea>
          <br>
          个人签名:(在留言簿的自动签名,不超过125个汉字)<br>
              <textarea name="signature" cols="50" rows="5"><? echo $signature; ?></textarea>
            </td>
            <td height="153" width="40%"><br>
              选择一个自己喜欢的头像:<br>
          <?
           for ($i=1;$i<=64;$i++){
            echo "<img src='https:/article/image/face/icon".$i.".gif' width='32' height='32'>";  
            echo "<input type='radio' name='face' value='$i' ";
            if ($face==$i){
            echo "checked";
            }
            echo ">";
            if (($i%4)==0){ //隔4行,换行
             echo "<br>";
            }
           }
           ?><br>
            </td>
          </tr>
        </table>
        <div align="center">
          <br>
          <input type='Submit' name='submit' value='提交'>
          <input type='reset' name='Reset' value='重写 '>
        </div>
      </form>
    </td>
  </tr>
</table>
</BODY>
</HTML>
上传照片:class/uploadphoto.php
<?
session_start(); // 开始session
if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册.
{
echo "<a href='https:/article/../../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 ($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."<a href='https:/article/upload/image/$picurl_name'>看照片</a>|";//加上此次内容
  mysql_query("UPDATE user SET photo='$photo' where user='$userregister'",$db);//写入
  mysql_close($db);
  echo "文件上传成功!<BR>";
  echo "文件名:$picurl_name 文件大小:$picurl_size byte 文件类型:$picurl_type<BR>";
   }  
  else  
  {echo "文件上传失败.";exit;}  
unlink ($picurl); //从临时文件夹中删除档案$picurl
closedir ($v); //关闭目录handle
exit;
}
?>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
  <tr>  
    <td height="56" width="32%"><img src="../image/classlogo.gif" width="224" height="60"></td>
    <td height="56" width="68%">  
      <div align="center">上传照片</div>
    </td>
  </tr>
  <tr>  
    <td height="108" colspan="2"><form action="<? echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="UL">
        <!--注意:这里必须加上‘enctype="multipart/form-data" ',否则不会产生上
传动作-->
        <div align="center">上传照片:
          <input type="file" name="picurl" size="15" accept="image/x-png,image/gif,image/jpeg">
          <br>
          <input type="Submit" name="upload" value="上传">
          <input type="reset" name="Reset" value="重写">
        </div>
      </form>  
</td>
  </tr>
</table>
</BODY>
</HTML>


  • 上一条:
    杏林同学录(五)
    下一条:
    杏林同学录(三)
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 2024.07.09日OpenAI将终止对中国等国家和地区API服务(0个评论)
    • 2024/6/9最新免费公益节点SSR/V2ray/Shadowrocket/Clash节点分享|科学上网|免费梯子(0个评论)
    • 国外服务器实现api.openai.com反代nginx配置(0个评论)
    • 2024/4/28最新免费公益节点SSR/V2ray/Shadowrocket/Clash节点分享|科学上网|免费梯子(0个评论)
    • 近期文章
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 欧盟关于强迫劳动的规定的官方举报渠道及官方举报网站(0个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf文件功能(0个评论)
    • Laravel从Accel获得5700万美元A轮融资(0个评论)
    • 在go + gin中gorm实现指定搜索/区间搜索分页列表功能接口实例(0个评论)
    • 在go语言中实现IP/CIDR的ip和netmask互转及IP段形式互转及ip是否存在IP/CIDR(0个评论)
    • PHP 8.4 Alpha 1现已发布!(0个评论)
    • Laravel 11.15版本发布 - Eloquent Builder中添加的泛型(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2016-10
    • 2016-11
    • 2017-07
    • 2017-08
    • 2017-09
    • 2018-01
    • 2018-07
    • 2018-08
    • 2018-09
    • 2018-12
    • 2019-01
    • 2019-02
    • 2019-03
    • 2019-04
    • 2019-05
    • 2019-06
    • 2019-07
    • 2019-08
    • 2019-09
    • 2019-10
    • 2019-11
    • 2019-12
    • 2020-01
    • 2020-03
    • 2020-04
    • 2020-05
    • 2020-06
    • 2020-07
    • 2020-08
    • 2020-09
    • 2020-10
    • 2020-11
    • 2021-04
    • 2021-05
    • 2021-06
    • 2021-07
    • 2021-08
    • 2021-09
    • 2021-10
    • 2021-12
    • 2022-01
    • 2022-02
    • 2022-03
    • 2022-04
    • 2022-05
    • 2022-06
    • 2022-07
    • 2022-08
    • 2022-09
    • 2022-10
    • 2022-11
    • 2022-12
    • 2023-01
    • 2023-02
    • 2023-03
    • 2023-04
    • 2023-05
    • 2023-06
    • 2023-07
    • 2023-08
    • 2023-09
    • 2023-10
    • 2023-12
    • 2024-02
    • 2024-04
    • 2024-05
    • 2024-06
    • 2025-02
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客