澳门新葡萄京官网首页新闻分类录入、显示系统

!–#include file=”top.inc”–%u_title=request.form(“u_title”)

本系统可以录入标题、内容、图片、相关软件,显示时会根据是否有有图片和相关软件来判断是否显示该项内容,打开页面显示的是最新的一片文章,点击目录会显示之前的文章。
建立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 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 trtd width=11% align=right
bgcolor=#CC0000font color=#FFFFFF标题:/font/td td
bgcolor=#E7E7E7input type=text name=title size=60 /td /tr trtd
align=right bgcolor=#CC0000font color=#FFFFFF类别:/font/td td
bgcolor=#E7E7E7input type=radio name=kind value=类型1 类型1input
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
trtd width=11% align=right bgcolor=#CC0000font
color=#FFFFFF内容:/font/td td bgcolor=#E7E7E7textarea name=content
cols=60 rows=10/textarea /td /tr trtd width=11% align=right
bgcolor=#CC0000font color=#FFFFFF图片:/font/td td
bgcolor=#E7E7E7input type=file name=pic size=60 /td /tr trtd width=11%
align=right bgcolor=#CC0000font color=#FFFFFF软件:/font/td td
bgcolor=#E7E7E7input type=file name=soft size=60 /td /tr trtd width=11%
align=right bgcolor=#CC0000/td td bgcolor=#E7E7E7div align=centerinput
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/pp ; echo bodyh2录入成功/h2/body/p; ?
********************************* end
of insert.php
*********************************
*********************************
新闻显示文件:news.php
********************************* html
head title显示类型1/title meta 目录类型 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;$a10;$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./abr; } 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 brcenterfont color=ff0000; print
$rows[2]; echo /fontbr$rows[5]/center; if (strlen($rows[4])0) echo
pimg src=channelimages/$rows[4] align=right; echo
str_replace(/r,br,str_replace( ,,$rows[3])); if
(strlen($rows[6])0) echo /pp align=righta
href=channelsoft/$rows[6]点击下载/a/p; ? /body /html
********************************* end
of news.php
*********************************

1.guestbook.php html head script language=JavaScript !– !– var
hellotext=为了您的最佳浏览效果请您使用IE4.0以上的版本和800*600分辨率
var thetext= var started=false var step=0 var times=1 function
welcometext() { times– if (times==0) { if (started==false) { started =
true; window.status = hellotext; setTimeout(anim(),1); } thetext =
hellotext; } } function showstatustext(txt) { thetext = txt;
setTimeout(welcometext(),4000) times++ } function anim() { step++ if
(step==7) {step=1} if (step==1) {window.status=’===’+thetext+’===’} if
(step==2) {window.status=’===’+thetext+’===’} if (step==3)
{window.status=’==’+thetext+’==’} if (step==4)
{window.status=’==’+thetext+’==’} if (step==5)
{window.status=’===’+thetext+’===’} if (step==6)
{window.status=’===’+thetext+’===’} setTimeout(anim(),200); } // —
welcometext(); function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+.location=’+selObj.options[selObj.selectedIndex].value+’);
if (restore) selObj.selectedIndex=0; } //– /script
title天地网络留言版/title meta content=text/html; charset=gb2312 /head
style type=text/css !– a:link {font-size: 9pt; color: #FFFFFF} —
/style body ? $PAGESIZE=5; $db=mysql_connect(localhost,root,);
mysql_select_db(lyanban,$db); $result=mysql_query(SELECT * FROM
message order by date desc,$db); $rowcount=mysql_num_rows($result);
$PAGES=CEIL($rowcount/$PAGESIZE); if($rowcount==0) {echo 目前没有留言!a
href=guestbook.htm欢迎您留言!/a;} if($rownum == ) { $rownum = 1; }
$AA=CEIL($rownum/5); $i=0 ; echo TABLE WIDTH=100%tddiv font size=2
color=#000000B共有留言:$rowcount 条共:$PAGES 页right现在是第 $AA
页/right/B/font/div/td; echo hr size=1 color=#ccccffwidth=75%; while
($myrow=mysql_fetch_array($result)){ $i++;
if(($i=$rownum)&&($i$rownum+5)){ echo table width=75% border=1
cellspacing=0 cellpadding=0 bordercolordark=#FFFFFF
bordercolorlight=#000000 background=15.JPG; echo trtd width=15%div font
size=2 color=#FFFFFF姓 名/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[username]/font/td/tr; echo trtd width=15%div font
size=2 color=#FFFFFF电子信箱/font/div/tdtd width=85%font size=2
color=#FFFFFFa href=mailto:$myrow[email]$myrow[email]/font/a/td/tr;
echo trtd width=15%div font size=2 color=#FFFFFF公司主页/font/div/tdtd
width=85%font size=2 color=#FFFFFFa href=$myrow[homepage]
target=_blank$myrow[homepage]/font/a/td/tr; echo trtd width=15%div
font size=2 color=#FFFFFF留言主题/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[topic]/font/td/tr; echo trtd width=15%div font
size=2 color=#FFFFFF留言内容/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[content]/font/td/tr; echo trtd width=15%div font
size=2 color=#FFFFFF留言时间/font/div/tdtd width=85%font size=2
color=#FFFFFF$myrow[date]/font/td/tr; echo /tablehr size=1
color=#ccccffwidth=75%;} } echo table width=100%trtd width=87%;
#判断是否有或 echo form name=hiddenform method=post
action=guestbook.php; echo div input type=hidden name=rownum value=;
echo input type=hidden name=rowcount value=$rowcount; #显示 if
($rownum=5) echo input type=submit value=
onclick=document.hiddenform.rownum.value=.($rownum-5).; #显示 if
($rownum+5=$rowcount) { echo input type=submit value=
onclick=document.hiddenform.rownum.value=.($rownum+5)./div; } echo
/form; echo /td; echo /tr; echo /table; echo table width=100% trtddiv
font color=#ffffff size=2a
href=guestbook.htm返回继续发言/a/font/div/td/tr/table; ? /body /html
2.show.php3 ? $username = htmlspecialchars(ltrim(stripslashes
(trim($name))));//本函式可去掉字串中的反斜线空格字元 $email =
htmlspecialchars(ltrim(stripslashes (trim($email)))); $homepage =
htmlspecialchars(ltrim(stripslashes (trim($homepage)))); $topic =
htmlspecialchars(ltrim(stripslashes (trim($topic)))); $content =
htmlspecialchars(ltrim(stripslashes (trim($content)))); //
$content=base64_encode($content); //send email //if ($ok)
mail($email,$topic,$content); if
(($username==)or($topic==)or(strlen($username)20)or(strlen($topic)20))
{echo 请填写必要的项目或着非法用户名!a
href=javascript:history.go(-1);返回/a; } //wrong email ? elseif
(($email!=)and(!eregi(^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$,$email)))
{ echo 请您填写正确的 E-Mail 地址/pp a
href=javascript:history.go(-1);返回/a; } //wrong homepage ? elseif
(($homepage!=)and(!eregi(()+[0-9a-z-]+.([0-9a-z-]+.)+[a-z]{2,3}$,$homepage)))
{echo 主页地址输入错误!a href=javascript:history.go(-1);返回/a;} else{
//联接数据库 mysql_connect(localhost,root,);
mysql_select_db(lyanban); $sql=select password from tb where
username=’$username’; $result=mysql_query($sql);
$nums=mysql_num_rows($result); if($nums!=1){ echo对不起!请先a
href=register.html注册/a!; } else{ //得到日期 YYYY-MM-DD HH:MM:SS
2000-01-01 00:00:00′ $t = date(Y.-.m.-.d. .H.:.i.:.s);
//将新用户插入数据库 mysql_query(insert into message values
(‘$username’,’$email’,’$homepage’,’$topic’,’$content’,’$t’)); echo div
font size=2 color=#000000谢谢您留言!您的留言已成功加入,a
href=guestbook.php返回/a/font/div; } } ? 3.zhuc.php(注册程序) ?
mysql_connect(localhost,root,) or die(无法连接数据库,请重试);
mysql_select_db(lyanban) or die(无法选择数据库,请重试); $query=select
password from tb where username=’$username’;
$result=mysql_query($query); $numrows=mysql_num_rows($result);
if($numrows!=0) {echo ‘已有人注册此名,请重新选择名字!a
href=javascript:history.go(-1);返回/a’;} else {$query=insert into
tb(username,password) values(‘$username’,’$password’);
mysql_query($query); echo ‘注册成功’; echo ‘A HREF=guestbook.htm
请登录!/A’;} ? 以下是两个配套的HTML: 1。留言网页 html head meta
content=text/html; charset=gb2312 meta name=GENERATOR content=Microsoft
FrontPage 4.0 meta name=ProgId content=FrontPage.Editor.Document
title天地网络留言版欢迎您留言!/title /head body bgcolor=#FFFFFF div
align=center center br font size=2天地网络留言版测试版/fontbr br form
method=post action=show.php3 table width=66% tr td width=50% height=1
div align=center font size=2 您的尊姓大名:/font/div /td td width=50%
height=1 div align=center input type=text name=name size=20 /div /td /tr
tr td width=50% height=1 div align=centerfont size=2
您的电子邮件地址:/font/div /td td width=50% height=1 div align=center
input type=text name=email size=20 /div /td /tr tr td width=50% height=1
div align=centerfont size=2 您的公司主页地址:/font/div /td td width=50%
height=1 div align=center input type=text name=homepage size=20 value=
/div /td /tr tr td width=50% height=1 div align=center font
size=2留言主题:/font/div /td td width=50% height=1 valign=middle div
align=center input type=text name=topic size=20 /div /td /tr tr td
width=50% height=1 div align=center font size=2留言内容:/font/div /td
td width=50% height=1 div align=center /div /td /tr tr td width=100%
colspan=2 height=66 p align=center textarea rows=10 name=content
cols=50/textarea /p /td /tr tr td width=50% height=18 div
align=center/div /td td width=50% height=18 div align=center/div /td /tr
tr td width=50% height=18 align=center p align=center input type=submit
value=发表留言 name=B1 /p /td td width=50% height=18 align=center div
align=center input type=reset value=全部重写 name=B2 /div /td /tr /table
/form /center /div p /p p /p /body /html 2.注册程序 html head
titleregiste/title meta content=text/html; charset=gb2312 /head body
bgcolor=#FFFFFF div align=center p/p p/p p用户注册/p form method=post
action=zhuc.php p用户名: input type=text name=username /p p密码: input
type=password name=password /p p input type=submit name=Submit
value=确定 input type=reset name=Submit2 value=重来 /p /form p/p /div
/body /html 如需要ZIP文件可给我来信。tandinet@163.net

‘ 检查标题是否被输入.if u_title = “” then%form method=”POST” action=”%=
request.servervariables(“script_name”)
%”!–当没有标题输入时显示输入框– p文件标题br input type=”text”
name=”u_title” size=”35″/p pFont Sizebr select size=”1″
name=”u_text_size” option selected value=”1″1/option option
value=”2″2/option option value=”3″3/option option value=”4″4/option
option value=”5″5/option option value=”6″6/option /select/p p第1段br
textarea rows=”2″ name=”u_paragraph1″ cols=”35″/textarea/p p第2段br
textarea rows=”2″ name=”u_paragraph2″ cols=”35″/textareainput
type=”submit” value=”提交” /p/form%end if%%if u_title “” then
u_title=request.form(“u_title”)
u_paragraph1=request.form(“u_paragraph1”)
u_paragraph2=request.form(“u_paragraph2”)
u_text_color=request.form(“u_text_color”)
u_text_size=request.form(“u_text_size”)
g_filename=replace(u_title,” “,”_”)

‘ 如果有一个用户输入了标题,则获取所有的用户输入的内容.set fso =
createobject(“scripting.filesystemobject”)Set act =
fso.CreateTextFile(server.mappath(“write2htm/”&g_filename & “-“&
month(date())& day(date())& year(date()) &”.htm”), true)’创建create the
text (html) file文件到服务器,并添加mmddyyyy
格式年月日.’写所有用户输入的text (html) 文件, .htm
扩展名文件可以很容易地转换成你网站最需要的.asp 或 .inc文件.
act.WriteLine “html” act.WriteLine chr(13) act.WriteLine “title”&
u_title &”/title” act.WriteLine chr(13) act.WriteLine “body
bgcolor=’#FFFFFF'” act.WriteLine chr(13) act.WriteLine “p
align=’center’font face=’arial’ size='”& u_text_size &”‘”
act.WriteLine chr(13) act.WriteLine u_title &”/p” act.WriteLine chr(13)
act.WriteLine “p align=’left’font face=’arial’ size='”&u_text_size&”‘”
act.WriteLine chr(13) act.WriteLine u_paragraph1 &”/p” act.WriteLine
chr(13) act.WriteLine “p align=’left’font face=’arial’ size='”&
u_text_size &”‘” act.WriteLine chr(13) act.WriteLine u_paragraph2
&”/p” act.WriteLine chr(13) act.WriteLine “p/pp/pp/p” act.WriteLine “p
align=’center’font face=’arial’ size='”& u_text_size &”‘”
act.WriteLine “此文件被创建!” act.WriteLine now() &”/p”act.Close

‘ 关闭文件.%您的页面已成功创建!请点击查看. a href=”write2htm/%=
g_filename &”-“& month(date())& day(date())& year(date()) %.htm”
target=”_blank”查看/abrbr%response.write “html” response.write chr(13)
response.write “title”& u_title &”/title” response.write chr(13)
response.write “body bgcolor=’#FFFFFF'” response.write chr(13)
response.write “p align=’center’font face=’arial’ size='”& u_text_size
&”‘” response.write chr(13) response.write u_title &”/p” response.write
chr(13) response.write “p align=’left’font face=’arial’
size='”&u_text_size&”‘” response.write chr(13) response.write
u_paragraph1 &”/p” response.write chr(13) response.write “p
align=’left’font face=’arial’ size='”& u_text_size &”‘” response.write
chr(13) response.write u_paragraph2 &”/p” response.write chr(13)
response.write “p/pp/pp/p” response.write “p align=’center’font
face=’arial’ size='”& u_text_size &”‘” response.write “此文件被创建!”
response.write now() &”/p”end if%!–#include file=”bottom.inc”–

发表评论

电子邮件地址不会被公开。 必填项已用*标注