<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-16  評論-8  文章-30  trackbacks-0
    轉載自CSDN.net的論壇   _Shakespeare(網絡騎士) / 撰文

    發布文章、或者新聞、或者產品說明,這一類的圖片、文字均有的資料,要求的是,根據文章的需要隨時插入圖片、并且由其自己指定對齊方式。文字進庫,圖片上傳?

    adddata.php文件的代碼:
      1<html>
      2<head>
      3<title>增加數據</title>
      4<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
      5</head>
      6
      7<body bgcolor="#FFFFFF">

      8
      9

     10<?

     11@$link=mysql_pconnect("localhost","root","rpass007") or
     12
    die ("登陸服務器失敗,請稍候再試");
     13
    mysql_select_db($db);
     14
    $date=date('Y-m-d H:i:s');
     15
    if((($db=="foltyx"&&$tb=="wlg_master")||($db=="foljrbd"&&$tb=="tpxw"))||($db=="foljrxt"&&($tb=="shpx"||$tb=="tswl")))//for tyx jrbd jrxt
     16
    {
     17
            if(chop($imagein)!="none")
     18
                  {
     19
                  $picuppath="/home/fol/php/admin/";         //define up pic path
     20
                  $dirname="picup";
     21
                  if(!(chdir($picuppath)))
     22
                     {
     23
                        die("can not change path!");
     24
                     }
     25
                  if(!(file_exists("$dirname")))
     26
                     {
     27
                        if(!(mkdir($dirname,0777))) die("can not make dir!");
     28
                        if(!(chmod($dirname,0777))) die("can not change dir mode!");
     29
                     }
     30
                  if(!(chdir($dirname))) die("can not change dir!");
     31
                  $dirpath=$dirname."/";
     32
                  $imagepath=$picuppath.$dirpath;                      //path end
     33

     34
            $image="";
     35
            $imagename="";
     36
            $imagetype="";
     37
            $nowtime=time();
     38

     39
                      $imagename=$imagein_name ;                         //old pic name for db
     40
                      $imagetail=strrchr($imagename,".");                //get pic name type name
     41
                      $imagename=$nowtime.$imagetail;
     42
                      if(!copy($imagein,$imagepath.$imagename)) die("up pic false"); //up pic end
     43
                      $size=getimagesize($imagename);                        //get size array,for now in uppic,so just imagename else dirpaht
     44
                      $imgwidth=$size[0];
     45
                      $imgheight=$size[1];
     46
                      $imgsize=$size[3];
     47
                      unlink($imagename);                                     //delete pic in remote
     48

     49
                    $image=base64_encode(fread(fopen($imagein,"r"),10000000));     //inset db begin
     50
                    $imagetype=$imagein_type ;
     51
                    $imgtype=$imagetype;
     52
                    unlink($imagein);
     53

     54
                   $imgoldname=$imagename;
     55
                   $imgname=$imagename;
     56
                   $imgbody=$image;
     57
    if($db=="foljrbd"&&tb=="tpxw"){//there is no summary in tpxw of foljrbd,so 
     58
    $result =mysql_query("insert into $tb (title,content,date,author,origin,imgoldname,imgtype,imgname,imgwidth,imgheight,imgsize,imgbody) values('$title','$content','$date','$author','$origin','$imgoldname','$imgtype','$imgname','$imgwidth','$imgheight','$imgsize','$imgbody')",$link);
     59
    }
     60
    else{//tpxw of foljrbd
     61
    $result =mysql_query("insert into $tb (title,summary,content,date,author,origin,imgoldname,imgtype,imgname,imgwidth,imgheight,imgsize,imgbody) values('$title','$summary','$content','$date','$author','$origin','$imgoldname','$imgtype','$imgname','$imgwidth','$imgheight','$imgsize','$imgbody')",$link);
     62
    }
     63
                   }
     64
                   else die("請上傳圖片");
     65
    }//end of pic or pic with no summary
     66
    elseif($db=="foljrbd"&&$tb=="cjzt"){//beggin of cjzt of fol jrbd
     67
    $result =mysql_query("insert into $tb (title,content,date,author,origin,topic) values('$title','$content','$date','$author','$origin','$topic')",$link);
     68
    }//end of cjzt of fol jrbd
     69
    elseif($db=="foljrsx"&&$tb=="pshzl")//for jrsx
     70
    {
     71
            if(chop($imagein)!="none")
     72
                  {
     73
                  $picuppath="/home/fol/php/jrsx/";         //define up pic path
     74
                  $dirname="article";
     75
                  if(!(chdir($picuppath)))
     76
                     {
     77
                        die("can not change path!");
     78
                     }
     79
                  if(!(file_exists("$dirname")))
     80
                     {
     81
                        if(!(mkdir($dirname,0777))) die("can not make dir!");
     82
                        if(!(chmod($dirname,0777))) die("can not change dir mode!");
     83
                     }
     84
                  if(!(chdir($dirname))) die("can not change dir!");
     85
                  $dirpath=$dirname."/";
     86
                  $imagepath=$picuppath.$dirpath;                      //path end
     87

     88
            $image="";
     89
            $imagename="";
     90
            $imagetype="";
     91
            $nowtime=time();
     92

     93
                      $imagename=$imagein_name ;                         //old pic name for db
     94
                      $imagetail=strrchr($imagename,".");                //get pic name type name
     95
                      $imagename=$nowtime.$imagetail;
     96
                      if(!copy($imagein,$imagepath.$imagename)) die("up pic false"); //up pic end
     97
                      //unlink($imagename);                                     //delete pic in remote
     98

     99
                    //$image=base64_encode(fread(fopen($imagein,"r"),10000000));     //inset db begin
    100
                    $imagetype=$imagein_type ;
    101
                    $imgtype=$imagetype;
    102
                    unlink($imagein);
    103

    104
                   $imgoldname=$imagename;
    105
                   $imgname=$imagename;
    106
                   $imgbody=$image;
    107
    $result =mysql_query("insert into $tb (title,content,date,author,origin,artcloldname,artcltype,artclname) values('$title','$content','$date','$author','$origin','$imgoldname','$imgtype','$imgname')",$link);
    108
                   }
    109
                   else die("請上傳論文");
    110
    }//end of art
    111
    elseif($db=="foljrxt"&&($tb=="ztjz"||$tb=="alfx")){
    112
    $result =mysql_query("insert into $tb (title,summary,content,date,author,origin) values('$title','$summary','$content','$date','$author','$origin')",$link);
    113
    }
    114
    else{
    115
    $result =mysql_query("insert into $tb (title,content,date,author,origin) values('$title','$content','$date','$author','$origin')",$link);
    116
    }
    117
    if (mysql_affected_rows()==1)
    118
    {
    119        ?>

    120        添加成功,請返回!
    121        <p><href="add.php?db=<? echo $db ?>&tb=<? echo $tb ?>">返回</a> </p>

    122        <?
    123}
    124
    else
    125
    {
    126        ?>

    127        添加不成功,請稍候再試!
    128        <p><href="add.php?db=<? echo $db ?>&tb=<? echo $tb ?>">返回</a> </p>

    129        <?
    130}
    131?>

    132
    133</body>

    134</html>
    135
    136

    add.php文件的內容:
      1<html>
      2<head>
      3<title>增加數據</title>
      4<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
      5</head>
      6
      7<body bgcolor="#FFFFFF">

      8<?
      9if($db=="foljrbd"&&$tb=="cjzt"){
     10?>

     11<form name="form1" method="post" action="addcjzt.php" enctype="multipart/form-data">
     12  <table width="50%" border="0" align="center">
     13    <tr>
     14      <td align="center">
     15        <p>請選擇需要增加內容的專題:</p>
     16        <p>&nbsp;</p>
     17      </td>
     18    </tr>
     19    <tr>
     20      <td align="center">金融報道&gt;&gt;財經專題&gt;&gt;
     21        <select name="topic">
     22<?   @$link=mysql_pconnect("localhost","root","rpass007")
     23
                         or die("登陸失敗,稍后重試");
     24
        mysql_select_db("fol") or die("unable to select database");
     25
        $query="select topic,tpcname from foljrbd_cjzt order by id desc";
     26
        $result=mysql_query($query,$link);
     27
        while (list($topic,$tpcname)=mysql_fetch_row($result))
     28
                            {
     29                        ?>

     30          <option value="<? echo $topic ?>">
     31          <? echo $tpcname ?>
     32          </option>
     33<?
     34}
     35?>

     36        </select>
     37      </td>
     38    </tr>
     39    <tr>
     40      <td align="right">
     41        <input type="hidden" name="db" value="<? echo $db ?>">
     42                <input type="hidden" name="tb" value="<? echo $tb ?>">
     43        <input type="submit" name="Submit" value="填加">
     44      </td>
     45    </tr>
     46    <tr>
     47      <td>
     48        <p>&nbsp;</p>
     49        <p><href="mkspecial.php?db=<? echo $db ?>&tb=<? echo $tb ?>">建立新的專題</a></p>
     50      </td>
     51    </tr>
     52    <tr>
     53      <td>&nbsp;</td>
     54    </tr>
     55  </table>
     56</form>
     57<?
     58}
     59

     60
    elseif($db=="foljrsx"&&$tb=="pshzl")//beggin of pshzl of foljrsx
     61
    {
     62?>

     63<align="center"><font size="4">論文上傳</font> </p>
     64<form name="form1"   ENCTYPE="multipart/form-data" method="post" action="adddata.php?db=<? echo $db ?>&tb=<? echo $tb ?>">
     65  <div align="center">
     66    <table width="75%" border="0">
     67      <tr>
     68        <td>論文標題:
     69          <input type="text" name="title" size="40">

     70          作者:
     71          <input type="text" name="author">

     72        </td>
     73      </tr>
     74      <tr>
     75        <td>
     76          <align="left">論文簡介:
     77            <textarea name="content" cols="90" rows="10"></textarea>

     78          </p>
     79        </td>
     80      </tr>
     81      <tr>
     82        <td>
     83          <div align="left">論文:
     84            <input type="file" name="imagein">

     85          </div>
     86        </td>
     87      </tr>
     88
     89      <tr>

     90        <td>
     91          <div align="center">   </div>
     92        </td>
     93      </tr>
     94      <tr>
     95        <td>
     96          <div align="center"><font size="4">
     97            <input type="submit" name="submit" value="提交">
     98             
     99            <input type="reset" value="清空" name="reset">

    100            </font></div>
    101        </td>
    102      </tr>
    103    </table>
    104  </div>
    105</form>
    106<?
    107}//end of pshzl of foljrsx
    108

    109
    else
    110
    {
    111?>

    112<align="center"><font size="4">錄入數據</font> </p>
    113<form name="form1"   ENCTYPE="multipart/form-data" method="post" action="adddata.php?db=<? echo $db ?>&tb=<? echo $tb ?>">
    114  <div align="center">
    115    <table width="75%" border="0">
    116      <tr>
    117        <td>文章標題:
    118          <input type="text" name="title" size="40">

    119          作者:
    120          <input type="text" name="author">

    121        </td>
    122      </tr>
    123      <? if((($db=="foltyx"&&$tb=="wlg_master")||($db=="foljrsx"&&$tb=="pshzl"))||($db=="foljrxt"&&($tb!="hbyh"&&$tb!="tzlc")))
    124
    {
    125?>

    126      <tr>
    127        <td>
    128          <align="left">簡短介紹:
    129            <textarea name="summary" cols="80" rows="3"></textarea>

    130          </p>
    131        </td>
    132      </tr>
    133      <?
    134      }
    135?>

    136      <tr>
    137        <td>
    138          <align="left">文章內容:
    139            <textarea name="content" cols="90" rows="10"></textarea>

    140          </p>
    141        </td>
    142      </tr>
    143      <tr>
    144        <td>
    145          <div align="left">出處:
    146            <input type="text" name="origin" size="80">

    147          </div>
    148        </td>
    149      </tr>
    150      <? if((($db=="foltyx"&&$tb=="wlg_master")||($db=="foljrbd"&&$tb=="tpxw"))||($db=="foljrxt"&&($tb=="shpx"||$tb=="tswl")))
    151
    {
    152?>

    153      <tr>
    154        <td>
    155          <div align="left">圖片:
    156            <input type="file" name="imagein">

    157          </div>
    158        </td>
    159      </tr>
    160      <?
    161      }
    162?>

    163      <tr>
    164        <td>
    165          <div align="center">   </div>
    166        </td>
    167      </tr>
    168      <tr>
    169        <td>
    170          <div align="center"><font size="4">
    171            <input type="submit" name="submit" value="提交">
    172             
    173            <input type="reset" value="清空" name="reset">

    174            </font></div>
    175        </td>
    176      </tr>
    177    </table>
    178  </div>
    179</form>
    180<?
    181}
    182?>

    183</body>
    184</html>
    185

    具體的數據表的建立方式可以從執行語句中看到
    附:這是我和一個研究生為學校的一個網站寫的后臺管理程序的處理后臺管理上傳的東西,不當之處還請指出來
    posted on 2005-05-13 15:20 楚客 閱讀(421) 評論(0)  編輯  收藏 所屬分類: 轉載
    主站蜘蛛池模板: 亚洲欧洲无码AV电影在线观看| 亚洲精品人成电影网| 精品国产麻豆免费人成网站| 久久久久亚洲Av无码专| 在线免费观看污网站| 中文日本免费高清| 亚洲中文字幕精品久久| 久久亚洲高清综合| 国语成本人片免费av无码| japanese色国产在线看免费| 亚洲熟妇av一区二区三区下载| yy6080亚洲一级理论| 久久精品国产免费观看| 免费在线观看自拍性爱视频| 亚洲精品欧洲精品| 亚洲一区无码精品色| 四虎国产精品免费久久| 国产成人免费ā片在线观看老同学| 亚洲国产精品一区二区久| 亚洲 自拍 另类小说综合图区| 91av免费观看| 思思久久99热免费精品6| 7777久久亚洲中文字幕| 国产亚洲婷婷香蕉久久精品| 在线成人a毛片免费播放| 精品无码人妻一区二区免费蜜桃| 99亚洲精品卡2卡三卡4卡2卡| 亚洲av无码专区在线播放| 免费人成在线观看网站品爱网日本| 18级成人毛片免费观看| jizz免费观看| 亚洲精品日韩一区二区小说| 亚洲一区二区三区四区在线观看| 亚洲男人在线无码视频| 国产成人免费高清在线观看| 久草视频免费在线观看| 无码囯产精品一区二区免费 | 亚洲AV无码精品色午夜果冻不卡| 国产免费av片在线播放| 亚洲人成网站免费播放| 青青草无码免费一二三区|