⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 postcon.asp

📁 在线考试系统的设计与实现
💻 ASP
字号:
<html>
<head>
<title>文章发表情况!</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 
border=0>
  <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">&gt;&gt;</font>欢迎您,<b><%if session("loginname")="" then %>请先登录!<%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">用户注册</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">现在时间:<%=now()%></td>
          <td width="11%" height="2"> 
            <div align="right"><img src="images/home.gif" width="14" height="14" align="absmiddle">返回首页</div>
          </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
		  <!--#include file="postconbody.asp"-->
<!--#include file="db.inc" -->
<%
'取得计数文件名及路径
Function getcounterfilename()
dim fullpath,pointposition
fullpath=Request.ServerVariables("PATH_TRANSLATED")
Pointposition=InstrRev(fullpath,".")
getcounterfilename=Mid(fullpath,1,pointposition)&"cnt"
set obj=createobject("scripting.filesystemobject")
'判断计数文件是否存在,如果没有,则创建
if obj.fileexists(getcounterfilename)=false then
set creat=obj.createtextfile(getcounterfilename,true)
creat.writeline("0")
creat.close
end if
end function
'密码转换函数
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
'验证用户名与密码
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&"'"
'进行数据库操作
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()
'读取计数,并将计数加1
set obj=createobject("scripting.filesystemobject")
set read=obj.opentextfile(counterfilename,1,0,0)
hitrate=read.readline
read.close
hitrate=clng(hitrate)+1
'将新的计数写入计数文件
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>恭喜!文章发表成功了</b>!</div>
    </td>
  </tr>
  <tr>
    <td bgcolor="#f4faed" height="20"> 
      <div align="center">如果你想查看,请点击右边的论坛主页!(<font color="#FF0000"><a href="index.asp">论坛主页</a></font>)</div>
    </td>
  </tr>
  <tr>
    <td bgcolor="#a9d46d" height="20">&nbsp;</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>出错了!信息如下!</b></div>
    </td>
  </tr>
  <tr>
    <td bgcolor="#f4faed">
<li>可能是你还没有注册!</li><br><li>可能是你还没有登录!</li><br><li>可能是你用户名或密码输入有误!</li></td>
  </tr>
  <tr>
    <td height="20" bgcolor="#a9d46d">&nbsp;</td>
  </tr>
</table>
<%
end if
%>
<!--#include file="footer.asp"-->
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -