安全中国首页 > 文章中心 > 黑客编程
 
安全中国网友投稿专用上传FTP空间:
Ftp服务器:download.anqn.com
Ftp端口:21
用户名:anqn
密 码:anqn.com
 

安全脚本程序的编写技术

更新时间:2008-7-4 0:14:18
责任编辑:流火
热 点:

2.1.3 脚本解析

   下面是我以前写的一段asp脚本,做了一些修改,把他贴出来,让大家看看我加入了设置,那里做的不够好。我在这里就不多说了,有兴趣可以到 我的论坛来大家讨论。

<!--#include file="conn.asp"-->
<%
dim errmsg
if request.form("username")="" then
ErrMsg="用户名不能为空"
foundError=True
else
UserName=request.form("UserName")
end if

if request.form("password")="" then
ErrMsg="密码不能为空"
foundError=True
else
PassWord=request.form("PassWord")
end if
if FoundError=true then
showAnnounce(ErrMsg)
else
set rstmp=server.createobject("adodb.recordset")
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
rstmp.open "Select * from User Where userName=’" & UserName & "’",conn,3,3
if rstmp.bof then
session.contents("UserName")=UserName
rstmp.addnew
rstmp("username")=username
rstmp("userpassword")=password
rstmp("logins")=1
rstmp("online")=1
rstmp.update
response.redirect("index.asp")
elseif PassWord<>rstmp("userpassword") then
ErrMsg="密码错啦"
foundError=True
showAnnounce(ErrMsg)
else
session.contents("UserName")=UserName
rstmp("logins")=rstmp("logins")+1
rstmp("online")=1
rstmp.update
rstmp.close
Set rstmp=nothing
response.redirect("index.asp")
end if

else
if session.contents("UserName")<>"" then
rstmp.open "Select * from User Where userName=’"&session.contents("UserName")&"’",conn,3,3
rstmp("logins")=rstmp("logins")+1
rstmp("online")=1
rstmp.update
rstmp.close
Set rstmp=nothing
conn.close
set conn=nothing
response.redirect("index.asp")
end if
end if
end if
%>
<html>

<head>
<title></title>
<link rel="stylesheet" type="text/css" href="forum.css">
</head>

<body>
<%
function showAnnounce(ErrMsg)
on error resume next
response.write "<p align=center><font color=’red’><strong><Big>哈哈</big></strong></font><BR><font 
color=’#0000FF’>"+ErrMsg+"</font><BR>"+chr(13)+chr(10)
%>
<tr> 
<td width="100%"> 
<p align="center"><br> 
<form action="login.asp" method="post"> 
输入<INPUT name=username size=8 class=’smallInput’> 
<BR>哈哈<INPUT name=password size=8 class=’smallInput’ type=password>
</td> 
</tr> 
<tr> 
<td width="100%"> 
<p align="center"><br> 
<INPUT type="submit" name="B12" class=’buttonface’ value=μ???>
<font color="#FF0000"><br> <br> 
*</font>错了
</td> </form> 
</tr> 
<%
end function
%> 

###---checklogin.asp
<%
dim adname
dim passwd

adname=Request.Form("adname")
passwd=Request.Form("passwd")

if adname="" then
response.redirect "login.asp"
end if
if passwd="" then
response.redirect "login.asp"
end if

if adname="focus-admin" and passwd="1" then 
response.redirect "manage.asp"
else
response.redirect "login.asp"
end if
%>
###---checklogin.asp----end
###---manage.asp
<%

dim where
dim where1
dim refererURL
dim refererURL2
dim refererURL3
refererURL=phyURL&"login.as"
refererURL2=phyURL&"edit.asp"
refererURL3=phyURL&"manage.a"
refererURL4=phyURL&"savearti"
where=Request.ServerVariables("HTTP_REFERER")
where=left(where,(len(phyURL)+8)) 
if where<>refererURL and where<> refererURL2 and where<>refererURL3 and where<>refererURL4 then
Response.Redirect "login.asp"
end if

const MaxPerPage=20 
dim totalPut 
dim CurrentPage
dim TotalPages
dim i,j

if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if

%>
###---manage.asp-----end
    2.2 cookie的问题
    2.2.1 概念介绍
    按照Netscape官方文档中的定义,Cookie是在HTTP协议下,服务器或脚本可以维护客户工作站上信息的一种方式。Cookie是由Web服务器保存在用户浏览器上的小广西文件,它可以包含有关用户的信息(如身份识别号码、密码、用户在Web站点购物的方式或用户访问该站点的次数)。无论何时用户链接到服务器,Web站点都可以访问Cookie信息。

上一页 1 2 3 4 5 下一页

 
相关文章
一日一文章
 
一日一软件
一日一动画