PHP database image information and deletion of images in folders_PHP tutorial

WBOY
Release: 2016-07-13 17:49:07
Original
1027 people have browsed it

/**
*Picture management
* 2011/8/20
* kcj
**/ 
include "isLogin.php"; 
 
 
?> 
 
     
         
        后台管理 
         
         
         
         
     
     
       

 
           后台管理->文章管理 
             
           
 
               
     
     
                    
  •  
     
                         
                            图片名称 
                            图片路径 
                            添加时间 
                            操作 
     
                       
  •  
       
                                                    /**
                                                                                                                                                        * kcjs
                     **/ 
                            require "../conn/conn.php"; 
                            if($_GET["del"]){                   //删除图片信息及文件夹下的图片(注意不要犯逻辑性的错误,当然可以分开写这两个的删除)  
                                $id=$_GET["del"]; 
                                $sql2="select*from pic where id=".$id; 
                                $rst2=mysql_query($sql2); 
                                $row=mysql_fetch_array($rst2);  
                                $sql="delete from pic where id=".$id; 
                                mysql_query($sql); 
                                $filename=$row['picpath']; 
                                if(file_exists($filename)){ 
                                    unlink($filename); 
                                }else { 
                                    echo "图片路径不正确"; 
                                } 
                                 
                            } 
     
                            $sql="select*from pic"; 
                            $rst=mysql_query($sql); 
                            $totalnum=mysql_num_rows($rst); //print_r($totalnum);exit;  
                            $pagenum=5; 
                            $page=$_GET["page"]; 
                            if($page==" "){ 
                                $page=1; 
                            } 
                            $begin=($page-1)*$pagenum; 
                            $pagecount=ceil($totalnum/$pagenum); 
                            $sql2="select * from pic order by id desc limit ".$begin.",".$pagenum." "; 
                            $rst2=mysql_query($sql2); 
                            while (@$row=mysql_fetch_array($rst2)){ 
                            ?> 
     
                    
  •  
          
                             
                             
                             
                             
                            【修改】【删除】 
                       
                         
              
                                                } 
                        ?> 
                
                     
       
  •  
                             
     
     
                                共条 ;共页;每页显示条 
     
                                    首页   
     
                                    上一页   
     
     
     
     
     
                                    下一页   
     
     
     
                                    尾页   
     
                           
     
                       
  •  
                   
 
           
 
                     
       
 
     
 
/**
*Picture management
* 2011/8/20
* kcj
**/
include "isLogin.php";


?>

 
  
  后台管理
  
  
  
  
 
 
  


     后台管理->文章管理
     
   

    

                    

  •      
                         图片名称
          图片路径
          添加时间
          操作

         


  •  
                            /**
    * Picture management
                     * 2011/8/20
                      * kcjs
                 **/
                require "../conn/conn.php";
                if($_GET["del"]){                   //删除图片信息及文件夹下的图片(注意不要犯逻辑性的错误,当然可以分开写这两个的删除)
                 $id=$_GET["del"];
                    $sql2="select*from pic where id=".$id;
                 $rst2=mysql_query($sql2);
                 $row=mysql_fetch_array($rst2);
                    $sql="delete from pic where id=".$id;
                    mysql_query($sql);
                    $filename=$row['picpath'];
                    if(file_exists($filename)){
                     unlink($filename);
                    }else {
                     echo "图片路径不正确";
                    }
                 
                }

    $sql="select*from pic";
    $rst=mysql_query($sql);
    $totalnum=mysql_num_rows($rst); //print_r($totalnum);exit;
    $pagenum=5;
    $page=$_GET["page"];
    if($page==" "){
    $page=1;
    }
    $begin=($page-1)*$pagenum;
    $pagecount=ceil($totalnum/$pagenum);
    $sql2="select * from pic order by id desc limit ".$begin.",".$pagenum." ";
    $rst2=mysql_query($sql2);
    while (@$row=mysql_fetch_array($rst2)){
    ?>

                    


  •     
            
                         
          
          
          【修改】【删除】
                     
         
            
          }
    ?>
              
        
     

  •       


                                共条 ;共页;每页显示

            首页 

            上一页 

     

     

            下一页 

     

            尾页 

          
         


  •     

   

                                                                                                                          




Excerpted from chaojie2009’s column

http://www.bkjia.com/PHPjc/478362.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478362.htmlTechArticle?php /***Picture management * 2011/8/20 * kcj **/ include isLogin.php; ? html head meta http-equiv=Content -Type content=text/html; charset=gb2312 / title background management/title meta name=Au...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template