建立channelimages和channelsoft目錄,并把權限 " /> 高潮精品一区videoshd,欧美精品一区二,欧美国产日韩二区

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

新聞分類錄入、顯示系統

本系統可以錄入標題、內容、圖片、相關軟件,顯示時會根據是否有有圖片和相關軟件來判斷是否顯示該項內容,打開頁面顯示的是最新的一片文章,點擊目錄會顯示之前的文章。
    建立channelimages和channelsoft目錄,并把權限設為777。
*********************************
news表結構
*********************************
# Host: localhost Database : yourdb
# --------------------------------------------------------

#
# Table structure for table 'yourtable'
#

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
*********************************


【本文版權歸作者與奧索網共同擁有,如需轉載,請注明作者及出處】    


php技術新聞分類錄入、顯示系統,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 军事| 三门峡市| 平山县| 尚义县| 定远县| 自贡市| 宽城| 麦盖提县| 尼木县| 蓬莱市| 石家庄市| 乌拉特中旗| 冷水江市| 和田县| 铜梁县| 遵义县| 苏尼特左旗| 南投县| 米泉市| 莱芜市| 红安县| 金门县| 泊头市| 贺州市| 驻马店市| 景谷| 仁化县| 双江| 剑川县| 白银市| 三河市| 定安县| 富蕴县| 盐边县| 广宗县| 正镶白旗| 晋江市| 平湖市| 南和县| 曲靖市| 惠水县|