⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcdel.php

📁 这是一个用c++builder编写的照片管理系统比较实用
💻 PHP
字号:
<?
require("config.php");
if (empty($id) || empty($albumid)) exit;
$check_status=0;
$login_status="未知错误";
if (empty($username)) $login_status="请确认";
  else { if (empty($password)) $login_status="请填密码";
    else {
    if (!file_exists("user/$user_file")) $login_status="用户不存在";
      else { 
      $user_list=file("user/$user_file");
      $count=count($user_list);
      for ($i=0; $i<$count; $i++) {
        $detail=explode("|",$user_list[$i]);
        if ($detail[1]==$username && $detail[4]==$password) {$mark=$i; $check_status=1; $id=$detail[0]; $login_status="注销成功"; break;}
      }
      if ($check_status==1) {
      ############删除文件
      if (!empty($picid)) {
        if (!file_exists("user/$id/$albumid/$picid")) exit;
        $picsize=filesize("user/$id/$albumid/$picid");
        unlink("user/$id/$albumid/$picid");
      ############更改userlist
      $fp=fopen("user/$user_file","w");
      flock($fp,3);
      for ($i=0; $i<$count; $i++) {
        if ($mark==$i) {$detail=explode("|",$user_list[$i]);
          $detail[3]--; $detail[5]=$detail[5]-$picsize;
          $user_list[$i]=implode("|",$detail); }
        fputs($fp,$user_list[$i]);
      }
      fclose($fp);
      ############更改albumlist
      $al_list=file("user/$id/albumlist.php");
      $count=count($al_list);
      $fp=fopen("user/$id/albumlist.php","w");
      flock($fp,3);
      for ($i=0; $i<$count; $i++) {
        $detail=explode("|",$al_list[$i]);
        if ($detail[0]==$albumid) {
        $detail[3]--; $al_list[$i]=implode("|",$detail);
        }
        fputs($fp,$al_list[$i]);
      }
      fclose($fp);
      ############更改piclist
      $pic_list=file("user/$id/$albumid/piclist.php");
      $count=count($pic_list);
      $fp=fopen("user/$id/$albumid/piclist.php","w");
      flock($fp,3);
      for ($i=0; $i<$count; $i++) {
      $detail=explode("|",$pic_list[$i]);
      if ($detail[0]!=$picid) fputs($fp,$pic_list[$i]);
      }
      fclose($fp);
      }
      ############删除目录
      else {
      $picsize=0; $picno=0;
      ############删除目录下文件及目录
      $dirhandle=opendir("user/$id/$albumid");
      while($file_name=readdir($dirhandle)) {
      if ($file_name!="." && $file_name!="..") {
      if ($file_name!="piclist.php") {$picsize=$picsize+filesize("user/$id/$albumid/$file_name");
      $picno++;}
      unlink("user/$id/$albumid/$file_name");
      }}
      closedir($dirhandle);
      rmdir("user/$id/$albumid");
      ############修改userlist
      $fp=fopen("user/$user_file","w");
      flock($fp,3);
      for ($i=0; $i<$count; $i++) {
        if ($mark==$i) {$detail=explode("|",$user_list[$i]);
          $detail[3]=$detail[3]-$picno; $detail[5]=$detail[5]-$picsize;
          $user_list[$i]=implode("|",$detail); }
        fputs($fp,$user_list[$i]);
      }
      fclose($fp);
      #############修改albumlist
      $al_list=file("user/$id/albumlist.php");
      $count=count($al_list);
      $fp=fopen("user/$id/albumlist.php","w");
      flock($fp,3);
      for ($i=0; $i<$count; $i++) {
        $detail=explode("|",$al_list[$i]);
        if ($detail[0]!=$albumid) fputs($fp,$al_list[$i]);
      }
      fclose($fp);
      #############修改完毕
      }
      }
      else $login_status="用户/密码错误";
          }
        }
       }
if ($check_status==1) {
?>
<html>
<head>
<title>删除完成</title>
<meta HTTP-EQUIV=REFRESH CONTENT="2;URL=<? echo "pcdlist.php?id=$id"; ?>">
</head>
<body bgcolor="<? echo $bg_color; ?>">
<br><br><br><br><br><br><br><br>
<center>---------<b><a href="<? echo "pcdlist.php?id=$id"; ?>"><font size=2 color=#336699>删除完成:自动返回</font></a></b>-------------</center>
</body>
</html>
<? exit;}
?>
<html>
<head>
<title>图档删除</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body <? echo "bgcolor=$bg_color"; ?>>

<table width="700" border="0" cellspacing="0" cellpadding="0" height="73">
  <tr>
    <td width="34%"><img src="images/pcd.jpg" width="200" height="60"></td>
    <td width="66%" align="center"><font size="4"><b><? echo $login_status; ?></b></font></td>
  </tr>
</table>
<table width="500" border="0" cellspacing="0" cellpadding="0" bgcolor="ccccff">
  <tr>
    <td><form method=post>
      <table width="100%" border="0" cellspacing="1" cellpadding="2">
        <tr align="center"> 
          <td colspan=7 bgcolor="ccccff"><font size="2"><b>请确认</b></font></td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td width="35%" align="right"><font size="2">用户名:</font></td>
          <td width="65%"><b><font color="#800000"> 
            <input type="text" size="20" maxlength="14" name="username" value="" style="background-color:#ffffff; color:#FF90CD; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#E5F0FF'" onMouseOut = "this.style.backgroundColor = ''">
            </font></b></td>
        </tr>
        <tr bgcolor="eeeeee"> 
          <td width="35%" bgcolor="eeeeee" align="right"><font size="2">密码:</font></td>
          <td width="65%"><b><font color="#800000"> 
              <input type="password" size="20" maxlength="14" name="password" value="" style="background-color:#ffffff; color:#FF90CD; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#E5F0FF'" onMouseOut = "this.style.backgroundColor = ''">
            </font></b></td>
        </tr>
        <tr> 
          <td width="35%">&nbsp;</td>
          <td width="65%"> 
            <input type="hidden" name="id" value="<? echo $id; ?>">
            <input type="hidden" name="albumid" value="<? echo $albumid; ?>">
            <? if (isset($picid)) echo "<input type='hidden' name='picid' value='$picid'>"; ?>
            <input type="submit" value="送出资料" name="submit" style="font-family: 新细明体, 宋体, Arial; font-size: 9pt; height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'">
            <input type="reset" value="清除重写" name="reset" style="font-family: 新细明体, 宋体, Arial; font-size: 9pt; height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'">
          </td>
        </tr>
        <tr bgcolor="9999cc"> 
          <td colspan=7><center><a href="register.php"><font size="2" color=black>新用户注册</font></a></center></td>
        </tr>
      </table></form>
    </td>
  </tr>
</table>
<p align="center"><font size="2"><b>风事画馆&copy;2001</b></font></p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -