您的位置:澳门402永利com > 澳门402永利com网络 > 展示系统,php批量上传二

展示系统,php批量上传二

发布时间:2019-09-27 06:21编辑:澳门402永利com网络浏览(130)

    <?php
    $id = $_GET['id'];
    $sql = "select * from biao where pid=".$id;
    $res = mysqli_query($conn,$sql);
    $num = mysqli_num_rows($res);   //现成多少张图纸
    $sql1 = "select * from biao where id=".$id;
    $res1 = mysqli_query($conn,$sql1);
    $row1 = mysqli_fetch_assoc($res1);
    $num1 = $row1['p_num'];
    $p_name = $row1['p_name'];
    ?>

    本系统能够录入标题、内容、图片、相关软件,显示时会根据是还是不是有有图片和连锁软件来推断是或不是出示该项内容,张开页面展现的是流行的一片文章,点击目录会显示在此之前的篇章。
        建构channelimages和channelsoft目录,并把权限设为777。
    *********************************
    news表结构
    *********************************
    # Host: localhost Database : yourdb
    # --------------------------------------------------------

    <form action="" method="post" enctype="multipart/form-data" name="form2">
    <br>
    <table width="750" border="1" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
    <tr>
    <td height="25"  width="550" align="center" valign="middle" bgcolor="#FFFFFF"><font size="5">添  加  图  片</font></td>
    <td height="25"  align="center" valign="middle" bgcolor="#FFFFFF"><input type="submit" name="fanhui" value="重返上一层"></td>
    </tr>
    </table>
    <br>

    #
    # Table structure for table 'yourtable'
    #

    <table width="750" border="1" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFCC">
    <tr>
        <td align="center" colspan="2">
      <p align="left"> 现已上传图片<?php echo $num?>张:</p>
      <p>图片名称1:<input type="text" name="name[]" size="25"><input type="hidden" name="tu1"/>  <input type="file" name="pictures[]" id="file1"  /></p><p></p>
      <p>图片名称2:<input type="text" name="name[]" size="25"><input type="hidden" name="tu2"/>  <input type="file" name="pictures[]" id="file2" /></p><p></p>
      <p>图片名称3:<input type="text" name="name[]" size="25">  <input type="file" name="pictures[]" id="file3" /></p><p></p>
      <p>图片名称4:<input type="text" name="name[]" size="25">  <input type="file" name="pictures[]" id="file1"  /></p><p></p>
      <input type="submit" name="upload" value="提交" />
      </td>
    </tr>
    </table>
      
    </form>
    </body>
    </html>

    CREATE TABLE news(
       id int(11) DEFAULT '0' NOT NULL auto_increment,
       kind varchar(16),
       title varchar(60),
       content text,
       pic varchar(30),
       timer datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
       soft varchar(30),
       PRIMARY KEY (id),
       KEY timer (timer)
    );

    *********************************
    音讯录入文件:insert.htm
    *********************************
    <html>
    <head>
    <title>消息录入</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body bgcolor="#FFFFFF">
    <form name="form1" enctype="multipart/form-data" action="insert.php" method="post" >
      <table width="81%" border="0" cellspacing="2" cellpadding="0" align="center">
        <tr>  
          <td width="11%" align="right" bgcolor="#CC0000"><font color="#FFFFFF">标题:</font></td>
          <td bgcolor="#E7E7E7">  
            <input type="text" name="title" size="60">
          </td>
        </tr>
        <tr>  
          <td align="right" bgcolor="#CC0000"><font color="#FFFFFF">类别:</font></td>
          <td bgcolor="#E7E7E7">  
            <input type="radio" name="kind" value="类型1">
            类型1  
            <input type="radio" name="kind" value="类型2">
            类型2
            <input type="radio" name="kind" value="类型3">
            类型3
            <input type="radio" name="kind" value="类型4">
            类型4</td>
        </tr>
        <tr>  
          <td width="11%" align="right" bgcolor="#CC0000"><font color="#FFFFFF">内容:</font></td>
          <td bgcolor="#E7E7E7">  
            <textarea name="content" cols="60" rows="10"></textarea>
          </td>
        </tr>
        <tr>  
          <td width="11%" align="right" bgcolor="#CC0000"><font color="#FFFFFF">图片:</font></td>
          <td bgcolor="#E7E7E7">  
            <input type="file" name="pic" size="60">
          </td>
        </tr>
        <tr>  
          <td width="11%" align="right" bgcolor="#CC0000"><font color="#FFFFFF">软件:</font></td>
          <td bgcolor="#E7E7E7">  
            <input type="file" name="soft" size="60">
          </td>
        </tr>
        <tr>  
          <td width="11%" align="right" bgcolor="#CC0000"> </td>
          <td bgcolor="#E7E7E7">  
            <div align="center">  
              <input type="submit" name="Submit" value="提 交">
            </div>
          </td>
        </tr>
      </table>
    </form>
    </body>  
    </html>  
    *********************************
    end of insert.htm
    *********************************

    *********************************
    insert.php
    *********************************
    <?
    $day=date("md");
    If($pic != "none"){
    $picname=$day.$pic_name;
    copy($pic,"channelimages/$picname");
    unlink($pic);
    }
    If($soft!= "none"){
    copy($soft,"channelsoft/$soft_name");
    unlink($soft);
    }
    $dbh =  mysql_connect('localhost','uesrname','passward');
    mysql_select_db('yourtable');  
    $dat=date("Y-m-d h:i:s");
    $query="insert into news(title,kind,content,pic,timer,soft) values('$title','$kind','$content','$picname',now(),'$soft_name')";
    $res = mysql_query($query,$dbh);  

    $err = mysql_error();
    if($err){echo $err;exit();}
    echo "<p></p><p align=center>";
    echo "<body><h2>录入成功</h2></body></p>";
    ?>
    *********************************
    end of insert.php
    *********************************

    *********************************
    新闻显示文件:news.php
    *********************************
    <html>
    <head>
    <title>彰显档期的顺序1</title>
    <meta http-equiv="目录项目" content="文本/html; 字符集=gb2312">
    </head>
    <body bgcolor="#FFFFFF">
    <?
    $db=mysql_connect("localhost","username","passward");
    mysql_select_db("yourtable",$db);
    $result=mysql_query("select id,title from news where kind='类型1' order by timer desc");
    for($a=0;$a<10;$a++)
    {if(!($ahrow=mysql_fetch_row($result)))break;
    $id=mysql_result($result,$a,"id");
    $title=mysql_result($result,$a,"title");
    echo "<a href=news.php?id=".$id.">".$title."</a><br>";
    }
    if (!isset($id)) $id=mysql_result($result1,0,"id");
    $result=mysql_query("select * from news where id=$id order by timer desc");
    $rows=mysql_fetch_row($result);
    echo "<br><center><font color=ff0000>";
    print $rows[2];
    echo "</font><br>$rows[5]</center>";
    if (strlen($rows[4])>0) echo "<p><img src=channelimages/$rows[4] align=right>";
    echo str_replace("r","<br>",str_replace(" "," ",$rows[3]));
    if (strlen($rows[6])>0) echo "</p><p align=right><a href=channelsoft/$rows[6]>>>点击下载</a></p>";
    ?>
    </body>
    </html>
    *********************************
    end of news.php
    *********************************

    【本文版权归作者与奥索网共同持有,如需转发,请评释作者及出处】    

    本文由澳门402永利com发布于澳门402永利com网络,转载请注明出处:展示系统,php批量上传二

    关键词:

上一篇:没有了

下一篇:没有了