一个投票系统中的数据库连接文件,不懂,不懂,不懂是干嘛用的?求救。。。

tianxiadiwang 2009-06-12 09:06:44
<!--#include file="../admin/setting.asp" -->
<%
filtrate=true'是否防止重复投票,当为true是启用防止重复投票
myday=1'设置重复投票的天数

mydata=""&zf11db_All&"" '数据库路经

'=======================================================
dim conn
dim rs
rs="DBQ="+server.mappath(mydata)+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};Pwd=netroom;"
set conn=server.createobject("ADODB.CONNECTION")
conn.open rs

'目的:SQL注入攻击预防装置[字符型] 这句话是什么意思?
function strtext(str)
strtext=replace(str,chr(34),""")
end function

function strSql(str)
strSql=replace(str,"'","''")
end function

function flashSql(str)
flashSql=replace(str,"chr(124)","|")
end function

'目的:SQL注入攻击预防装置[数字型] 这句话是什么意思?

function intSql(Numeric)
if IsNumeric(Numeric) then
intSql=Numeric
else
intSql=0
end if
end function

function inthit(Numeric)
If(Numeric="") Then
inthit=1
else
if IsNumeric(Numeric) and Numeric>=1 then
inthit=Numeric
else
inthit=1
end if
End if
end function

Function validpersonal(username,password)
sql="select * from admin where name='"& strSql(username) &"' and pass ='"& strSql(password) &"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
If(rs.eof) Then
validpersonal=false
else
validpersonal=true
End if
End Function

'判断发言是否来自外部
function ChkPost()
dim server_v1,server_v2
chkpost=false
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(server_v1,8,len(server_v2))<>server_v2 then
chkpost=false
else
chkpost=true
end if
end function
%>
问题:文件中的那么多函数都是干什么用的?摆脱一个一个的给讲解一下了,谢谢,详细一点。。。最好讲解一下这个文件的总体作用。。。
...全文
53 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
tianxiadiwang 2009-06-17
  • 打赏
  • 举报
回复
呵呵
落伍者 2009-06-14
  • 打赏
  • 举报
回复
建议楼主看几本基础的书,顺便将论坛的精华贴扫一遍。


[签名]每个月总有那么几天,您的网络会受到黑客的攻击?坐立不安,烦躁无力,使用我和human开发的“月月舒”防火墙,超轻超薄,易于携带,提供由内到外的全方位保护,即使流量再大,也可以冲浪自如,再也不用担心侧漏啦。
http://webtrados.008.net 网络小筑,常来坐坐。
tianxiadiwang 2009-06-14
  • 打赏
  • 举报
回复
是吗?不过电子版的省RMB嘻嘻嘻。。。各位大侠,再帮忙看看。。。
tianxiadiwang 2009-06-14
  • 打赏
  • 举报
回复
好,谢谢,你的关照。。。
emon123 2009-06-13
  • 打赏
  • 举报
回复
目的:SQL注入攻击预防装置[字符型] 这句话是什么意思?
这个是防止用户Sql注入攻击的方法,也就是替换数据库中敏感字符的方法。比如replace(str,"chr(124)","|") ,也就是将Str字符串中出现的asc码为124的字符替换成|符号。下面的也是同理。
wkzb008 2009-06-13
  • 打赏
  • 举报
回复
到我的空间去看看资料吧wkzb008.ys168.com
wkzb008 2009-06-13
  • 打赏
  • 举报
回复
楼主改好好学学vb了,其实asp不是一门语言,学好它还的从vb和ado编程做起,
上面那是vb函数,过滤恶意字符用的,防止黑客sql注入攻击。
薪水 2009-06-13
  • 打赏
  • 举报
回复
帮顶~~~
  • 打赏
  • 举报
回复
问的全是基础的问题,不看书,就想做程序

难怪没人愿意回答你!
tianxiadiwang 2009-06-13
  • 打赏
  • 举报
回复
大侠帮忙看看啊。。。
ChinaXtHuLang 2009-06-13
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 tianxiadiwang 的回复:]
嘻嘻嘻,我是不喜欢查书,爱百度。。。不过我还真的没有什么好的资料,郁闷。。。谁能给推荐一些好的资料,最好是电子版的。谢了。。。
[/Quote]
既然要电子版的。就直接百度搜索ASP编程电子书啊。。还有就是。你已经说了你不喜欢查书。我想你看电子版的更加看不进去。。
为什么呢??看电子版的会使你更加想别的去。。还有就是看电子版的对着电脑。你会很容易瞌睡。

哈哈。就这了。
tianxiadiwang 2009-06-13
  • 打赏
  • 举报
回复
嘻嘻嘻,我是不喜欢查书,爱百度。。。不过我还真的没有什么好的资料,郁闷。。。谁能给推荐一些好的资料,最好是电子版的。谢了。。。
sutan123cool 2009-06-13
  • 打赏
  • 举报
回复
我给一个简单的投票程序:
<div id="div05_02">
<div class="div05_01_01">高考调查</div>

<form id="form2" name="form2" method="post" action="dc.asp" style=" font-size:12px;color:#254E89;">
<p style="text-align:center;" >你希望我们要改进什么样的内容?</p>

<div style="margin:12px; text-align:left;"> <input type="radio" name="radio" id="radio" value="a" />
高考的各科知识讲解</div>
<div style="margin:12px; text-align:left;">
<input type="radio" name="radio" id="radio" value="b" />
未来几年的就业形式</div>
<div style="margin:12px; text-align:left;">
<input type="radio" name="radio" id="radio" value="c" />
高考报名的填报技巧</div>
<div style="margin:12px; text-align:left;">
<input type="radio" name="radio" id="radio" value="d" />
高考试题的答题技巧</div>
<div style="margin:12px; text-align:left;">
<input type="radio" name="radio" id="radio" value="e" />
高考心理调整及复习方法</div>
<div style="margin-top:10px;text-align:center;">
<input type="submit" name="button2" id="button2" value="提交" />
<a href="display.asp" style="text-decoration:none;">查看调查结果</a></div>
</form>
</div>


str=request.Form("radio" )
if request.ServerVariables("REMOTE_ADDR")<>request.Cookies("ip") then'获得ip地址进行判断就可以防止重复投票了
response.Cookies("ip")=request.ServerVariables("REMOTE_ADDR")
response.Cookies("ip").expires=#january 01,2010#
select case str
case "a"
sql="update diaocha set jj=jj+1"
case "b"
sql="update diaocha set xs=xs+1"
case "c"
sql="update diaocha set tbjq=tbjq+1"
case "d"
sql="update diaocha set dt=dt+1"
case "e"
sql="update diaocha set tz=tz+1"
end select
Set Rs=Server.CreateObject("ADODB.Recordset")
Rs.open sql,conn,1,3
alert("提交成功,谢谢你的合作!")
call goback()
else
alert("你已经参与过了调查!")
call goback()
end if

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧