• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    一個系統中的新聞增加程序

    發布: 2007-7-14 19:53 | 作者: 佚名    | 來源: 網絡轉載     | 查看: 8次 | 進入軟件測試論壇討論

    領測軟件測試網 <?php
    /*******所用到的表結構********
    DROP TABLE IF EXISTS index_news;
    CREATE TABLE index_news (
       news_id bigint(20) NOT NULL auto_increment,
       news_date date DEFAULT '0000-00-00' NOT NULL,
       news_title varchar(100) NOT NULL,
       news_content text,
       news_link varchar(100),
       is_new char(1) DEFAULT '1',
       picture_id int(11),
       picture_side char(1) DEFAULT '1',
       news_show char(1) DEFAULT '1',
       PRIMARY KEY (news_id),
       KEY id (news_id)
    );
    DROP TABLE IF EXISTS picture;
    CREATE TABLE picture (
       id int(11) NOT NULL auto_increment,
       picture blob NOT NULL,
       picture_type varchar(50) NOT NULL,
       PRIMARY KEY (id),
       UNIQUE id (id)
    );
    **********************/
    require("../include/date.inc.php3");
    require("../include/config.inc.php3");
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>
    <head>
    <title>修改首頁新聞信息</title>
    <script language="JavaScript">
    <!--
    function MM_findObj(n, d) { //v3.0
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
    }

    function MM_validateForm() { //v3.0
      var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
      for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; obj_name=args[i+1]; val=MM_findObj(args[i]);
        if (val) { nm=val.name; if ((val=val.value)!="") {
          if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
            if (p<1 || p==(val.length-1)) errors+='- '+obj_name+' 必須是一個E-Mail地址.\n';
          } else if (test!='R') { num = parseFloat(val);
            if (val!=''+num) errors+='- '+obj_name+' 必須是一個數字.\n';
            if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
              min=test.substring(8,p); max=test.substring(p+1);
              if (num<min || max<num) errors+='- '+obj_name+' 必須是一個在 '+min+' 和 '+max+'之間的數字.\n';
        } } } else if (test.charAt(0) == 'R') errors += '- '+obj_name+' 必須輸入.\n'; }
      } if (errors) alert('輸入數據存在錯誤:\n'+errors);
      document.MM_returnValue = (errors == '');
    }
    //-->
    </script>
    </head>

    <body>
    <?php
    if ($add){
        $date=input2date($news_date);
        //echo $picture . "  ". filesize($picture);
        //if ($is_new!="0") $is_new="1" ;
        //if ($news_show!="0") $news_show="1";
        //if ($picture_side!="2") $picture_side="1";
        if ($picture!="none"){
            $pic_data = addslashes(fread($fp=fopen($picture,"r"), filesize($picture)));
            $i_str="insert into picture (picture,picture_type) values ('$pic_data','$picture_type')";
            //$rs->open($i_str);
            $result=mysql_query($i_str,$dbconnect);
            $picture_id=mysql_insert_id();
            fclose($fp);
            unlink($picture);
        }
        else{
            $picture_id=0 ;
        }
        $i_str="insert into index_news (news_date,news_title,news_content,news_link,picture_id,is_new,picture_side,news_show) values ";
        $i_str.="('$date','$news_title','$news_content','$news_link','$picture_id','$is_new','$picture_side','$news_show') ";

        if (mysql_query($i_str,$dbconnect)) echo "已添加!";

    }

    <form name="F" enctype="multipart/form-data" method="post" action="<?php echo $PATH_INFO; ?>" >
      <table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
          <td colspan="2">
            <div align="center"><font size="4">增加新聞信息</font></div>
          </td>
        </tr>
        <tr>
          <td colspan="2">  </td>
        </tr>
        <tr>
          <td width="100">新聞標題: </td>
          <td>
            <input type="text" name="news_title" size="60">
          </td>
        </tr>
        <tr>
          <td>新聞內容:</td>
          <td>
            <textarea name="news_content" cols="58" rows="5"></textarea>
          </td>
        </tr>
        <tr>
          <td>新聞日期:</td>
          <td>
            <input type="text" name="news_date">
            (日期請按照2000-01-02格式輸入) </td>
        </tr>
        <tr>
          <td>新聞鏈接:</td>
          <td>
            <input type="text" name="news_link" size="60">
          </td>
        </tr>
        <tr>
          <td>是否最新:</td>
          <td>
            <select name="is_new">
              <option value="1" selected>是最新</option>
              <option value="0">不是最新</option>
            </select>
          </td>
        </tr>
        <tr>
          <td>新聞圖片:</td>
          <td>
            <input type="file" name="picture" size="50">
          </td>
        </tr>
        <tr>
          <td>圖片位置:</td>
          <td>
            <select name="picture_side">
              <option value="1" selected>左邊</option>
              <option value="2">右邊</option>
            </select>
          </td>
        </tr>
        <tr>
          <td>是否顯示:</td>
          <td>
            <select name="news_show">
              <option value="1" selected>顯示</option>
              <option value="0">不顯示</option>
            </select>
          </td>
        </tr>
        <tr>
          <td colspan="2">
            <div align="center">
              <input type="submit" name="add" value="增加" onClick="MM_validateForm('news_title','','R','news_date','','R','news_content','','R');return document.MM_returnValue">
              <input type="button" name="return" value="返回">
              <input type="reset" name="reset" value="重新輸入">
            </div>
          </td>
        </tr>
      </table>
      </form>
    </body>
    </html>

    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備2023014753號-2
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>