?? postcon.asp
字號(hào):
<html>
<head>
<title>文章發(fā)表情況!</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<BODY vLink=#333333 aLink=#333333 link=#333333 bgColor=#ffffff leftMargin=0
topMargin=0><LINK href="forum.css" type=text/css
rel=stylesheet>
<TABLE cellSpacing=0 cellPadding=1 width="95%" align=center bgColor=#777777
<TBODY>
<TR>
<TD>
<TABLE style="COLOR: #000000" cellSpacing=0 cellPadding=4 width="100%"
border=0 bgcolor="#a9d46d">
<TBODY>
<tr>
<td width="27%" height="2"><font color="#FF0000">>></font>歡迎您,<b><%if session("loginname")="" then %>請(qǐng)先登錄!<%end if%><%=session("loginname")%></b></td>
<td width="62%" height="2"><img src="images/reg.gif" width="16" height="16" align="absmiddle"><a href="reg.asp">用戶注冊(cè)</a>|<img src="images/login.gif" width="16" height="16"><a href="login.asp">用戶登錄</a>|<img src="images/update.gif" width="16" height="16"><a href="usermodify.asp">修改資料</a>|<img src="images/message.gif" width="21" height="14">現(xiàn)在時(shí)間:<%=now()%></td>
<td width="11%" height="2">
<div align="right"><img src="images/home.gif" width="14" height="14" align="absmiddle">返回首頁(yè)</div>
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<!--#include file="postconbody.asp"-->
<!--#include file="db.inc" -->
<%
'取得計(jì)數(shù)文件名及路徑
Function getcounterfilename()
dim fullpath,pointposition
fullpath=Request.ServerVariables("PATH_TRANSLATED")
Pointposition=InstrRev(fullpath,".")
getcounterfilename=Mid(fullpath,1,pointposition)&"cnt"
set obj=createobject("scripting.filesystemobject")
'判斷計(jì)數(shù)文件是否存在,如果沒(méi)有,則創(chuàng)建
if obj.fileexists(getcounterfilename)=false then
set creat=obj.createtextfile(getcounterfilename,true)
creat.writeline("0")
creat.close
end if
end function
'密碼轉(zhuǎn)換函數(shù)
Function encryptpwd(passwd)
dim leghth, i, newpasswd
dim temp
dim head, tail
passwd=left(passwd,10)
length=len(passwd)
newpasswd=""
for i=1 to length
temp=mid(passwd,i,1)
temp=asc(temp)
head=temp mod 16
tail=temp\16
temp=(head*16)+tail
if cint(temp)<100 and cint(temp)>10 then
temp="0"&temp
else
if cint(temp)<10 then
temp="00"&temp
end if
end if
newpasswd=newpasswd&temp
next
encryptpwd=newpasswd
end function
'處理用戶輸入的信息
author=request.form("username")
password=request.form("password")
password=encryptpwd(password)
title=request.form("title")
title=replace(title,"'","''",1)
title=replace(title,"<","〈",1)
title=replace(title,">","〉",1)
title=replace(title,chr(13)&chr(10),"<br>",1)
content=request.form("content")
content=replace(content,"'","''",1)
content=replace(content,"<","〈",1)
content=replace(content,">","〉",1)
content=replace(content,chr(13)&chr(10),"<br>",1)
face=request.form("face")
posttime=now()
pyear=year(date)
pmonth=month(date)
pday=day(date)
phour=hour(time)
pmin=minute(time)
psec=second(time)
artid=cstr(pyear&pmonth&pday&phour&pmin&psec)
lastpeop="---"
answcnt=cint(0)
lookcnt=cint(0)
flag=true
'驗(yàn)證用戶名與密碼
set record=conn.Execute("select * from user where username='"&author&"' and psw='"&password&"'")
if NOT record.eof then%>
<%
conn.execute "update user set artnum=artnum+1 where username='"&author&"' and psw='"&password&"'"
'進(jìn)行數(shù)據(jù)庫(kù)操作
conn.execute "insert into article(articleid,title,author,faceid,content,flag,posttime) values('"&artid&"','"&title&"','"&author&"','"&face&"','"&content&"',"&flag&",'"&posttime&"')"
conn.execute "insert into list(articleid,title,author,lastpeop,faceid,posttime,answcnt,lookcnt) values('"&artid&"','"&title&"','"&author&"','"&lastpeop&"','"&face&"','"&posttime&"','"&answcnt&"','"&lookcnt&"')"
conn.close
set conn=nothing
counterfilename=getcounterfilename()
'讀取計(jì)數(shù),并將計(jì)數(shù)加1
set obj=createobject("scripting.filesystemobject")
set read=obj.opentextfile(counterfilename,1,0,0)
hitrate=read.readline
read.close
hitrate=clng(hitrate)+1
'將新的計(jì)數(shù)寫入計(jì)數(shù)文件
set write=obj.createtextfile(counterfilename,-1,0)
write.writeline hitrate
write.close
%>
<table width="70%" border="0" align="center" bgcolor="#777777" cellpadding="1" cellspacing="1">
<tr>
<td bgcolor="#a9d46d" height="20">
<div align="center"><b>恭喜!文章發(fā)表成功了</b>!</div>
</td>
</tr>
<tr>
<td bgcolor="#f4faed" height="20">
<div align="center">如果你想查看,請(qǐng)點(diǎn)擊右邊的論壇主頁(yè)!(<font color="#FF0000"><a href="index.asp">論壇主頁(yè)</a></font>)</div>
</td>
</tr>
<tr>
<td bgcolor="#a9d46d" height="20"> </td>
</tr>
</table>
<%else%>
<table width="70%" border="0" align="center" bgcolor="#777777" cellpadding="1" cellspacing="1">
<tr>
<td height="20" bgcolor="#a9d46d">
<div align="center"><b>出錯(cuò)了!信息如下!</b></div>
</td>
</tr>
<tr>
<td bgcolor="#f4faed">
<li>可能是你還沒(méi)有注冊(cè)!</li><br><li>可能是你還沒(méi)有登錄!</li><br><li>可能是你用戶名或密碼輸入有誤!</li></td>
</tr>
<tr>
<td height="20" bgcolor="#a9d46d"> </td>
</tr>
</table>
<%
end if
%>
<!--#include file="footer.asp"-->
</body>
</html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -