Jump to content
xisto Community
Sign in to follow this  
dcy1405241470

About Asp,Help me!

Recommended Posts

This is a Asp source program

 

<!--#include file="conn.asp"-->

<%

function HTMLEncode(fString)

fString = replace(fString, ">", ">")

fString = replace(fString, "<", "<")

fString = Replace(fString, CHR(13), "")

fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")

fString = Replace(fString, CHR(10), "<BR>")

HTMLEncode = fString

end function

function UBBCode(strContent)

strContent = HTMLEncode(strContent)

dim re

Set re=new RegExp

re.IgnoreCase =true

re.Global=True

re.Pattern="(\[img\])(.[^\[]*)(\[\/IMG\])"

strContent=re.Replace(strContent,"<IMG SRC=""$2"" border=0>")

re.Pattern="(\[sound\])(.[^\[]*)(\[\/sound\])"

strContent=re.Replace(strContent,"<bgsound src=""$2"" border=0><img src=images/mid.gif width=16 height=16 alt=插入的音乐>")

re.Pattern="(\[b\])(.[^\[]*)(\[\/b\])"

strContent=re.Replace(strContent,"<b>$2</b>")

re.Pattern="(\[i\])(.[^\[]*)(\[\/i\])"

strContent=re.Replace(strContent,"<i>$2</i>")

re.Pattern="(\[u\])(.[^\[]*)(\[\/u\])"

strContent=re.Replace(strContent,"<u>$2</u>")

re.Pattern="(\[url\])(.[^\[]*)(\[\/URL\])"

strContent= re.Replace(strContent,"<A HREF=""$2"" TARGET=_blank>$2</A>")

re.Pattern="(\]*)\])(.[^\[]*)(\[\/URL\])"

strContent= re.Replace(strContent,"<A HREF=""$2"" TARGET=_blank>$3</A>")

re.Pattern="(\[email\])(.[^\[]*)(\[\/EMAIL\])"

strContent= re.Replace(strContent,"<img align=absmiddle src=images/email1.gif><A HREF=""mailto:$2"">$2</A>")

re.Pattern="(\]*)\])(.[^\[]*)(\[\/EMAIL\])"

strContent= re.Replace(strContent,"<img align=absmiddle src=images/email1.gif><A HREF=""mailto:$2"" TARGET=_blank>$3</A>")

re.Pattern="(\[fly\])(.[^\[]*)(\[\/fly\])"

strContent=re.Replace(strContent,"<MARQUEE scrollamount=3>$2</MARQUEE>")

re.Pattern = "^(http://forums.xisto.com/no_longer_exists/;]+)"

strContent = re.Replace(strContent,"<img align=absmiddle src=images/aurl.gif><a target=_blank href=$1>$1</a>")

re.Pattern = "(http://forums.xisto.com/no_longer_exists/;]+)$"

strContent = re.Replace(strContent,"<img align=absmiddle src=images/aurl.gif><a target=_blank href=$1>$1</a>")

re.Pattern = "[^>=""](http://forums.xisto.com/no_longer_exists/;]+)"

strContent = re.Replace(strContent,"<img align=absmiddle src=images/aurl.gif><a target=_blank href=$1>$1</a>")

set re=Nothing

UBBCode=strContent

end function

function findwhere(ip,islog)

'ON ERROR RESUME NEXT

if cstr(ip) = "" then

ip = Request.ServerVariables ("REMOTE_ADDR")

end if

ips=Split(ip,".")

ip1 = CInt(ips(0))

ip2 = CInt(ips(1))

ip3 = CInt(ips(2))

ip4 = CInt(ips(3))

if ip1=10 or ip1=61 or ip1=202 or ip1=210 then

ipfile=cstr(ip1) & ".txt"

else

ipfile="other.txt"

end if

Set fobj = Server.CreateObject("Scripting.FileSystemObject")

ipfile =server.mappath("ipaddr\" & ipfile)

Set ipf = fobj.OpenTextFile(ipfile)

minip1=0

maxip4=255

minip2=0

maxip5=255

DO While not ipf.AtEndOfStream

ipff=CStr(ipf.Readline)

ipat = Split(ipff,".")

ipwhere = Split(ipff,"__")

if ip1 = Cint(ipat(0)) then

if ip2 >= CInt(ipat(1)) and ip2 <= CInt(ipat(4)) and CInt(ipat(1)) => minip1 and CInt(ipat(4)) =< maxip4 and ip3 >= CInt(ipat(2)) and ip3 <= CInt(ipat(5)) and CInt(ipat(2)) => minip2 and CInt(ipat(5)) <= maxip5 then

minip1 =CInt(ipat(1))

maxip4 =CInt(ipat(4))

' if ip3 >= CInt(ipat(2)) and ip3 <= CInt(ipat(5)) and CInt(ipat(2)) => minip2 and CInt(ipat(5)) <= maxip5 then

minip2 =CInt(ipat(2))

maxip5 =CInt(ipat(5))

findwhere = ipwhere(2) & ipwhere(3)

' end if

end if

end if

Loop

if cstr(islog)="1" then

savelog(findwhere)

end if

ipf.close

end function

function IsValidEmail(email)

dim names, name, i, c

'Check for valid syntax in an email address.

IsValidEmail = true

names = Split(email, "@")

if UBound(names) <> 1 then

IsValidEmail = false

exit function

end if

for each name in names

if Len(name) <= 0 then

IsValidEmail = false

exit function

end if

for i = 1 to Len(name)

c = Lcase(Mid(name, i, 1))

if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric© then

IsValidEmail = false

exit function

end if

next

if Left(name, 1) = "." or Right(name, 1) = "." then

IsValidEmail = false

exit function

end if

next

if InStr(names(1), ".") <= 0 then

IsValidEmail = false

exit function

end if

i = Len(names(1)) - InStrRev(names(1), ".")

if i <> 2 and i <> 3 then

IsValidEmail = false

exit function

end if

if InStr(email, "..") > 0 then

IsValidEmail = false

end if

end function

%><%

'id=Request.QueryString("id")

If Request.QueryString("Page") = "" or Request.QueryString("Page") <= 0 then

Page = 1

Else

Page = CINT(Request.QueryString("Page"))

End If

set rs=server.createobject("adodb.recordset")

sql="select * from admin order by id desc"

rs.Open SQL,conn,1,1

mypage=rs("pagesize")

if session("admin")=rs("adminuser") and session("pwd")=rs("adminpwd") then

adminok="ok"

end if

webname=rs("webname")

web=rs("weburl")

master=rs("adminuser")

kind=rs("kind")

tboerUrl=rs("tboerUrl")

tboerWeb=rs("tboerWeb")

SoftName=rs("SoftName")

Powerby=rs("Powerby")

%>

<script language="javascript">

function popwin3(path)

{ window.open(path,"","height=450,width=400,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");

}</script>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title><%=webname%>留言本</title><script language="javaScript" type="text/javascript" SRC="http://forums.xisto.com/no_longer_exists/;

<link rel="stylesheet" type="text/css" href="style/<%=kind%>.css">

</head><body topmargin="0" leftmargin="0" background="images/bg.gif">

<div align="center"><table width="90%" align="center" cellspacing="0" cellpadding="1" border="0">

<tr><td><table width="100%" height=25 cellspacing="0" cellpadding="3" border="0" class="table003">

<tr><td valign="middle" align=left class="jnfont5"> <b>>> </b> [<a href=write.asp>签写留言</a>] | [<a href="<%=web%>"><acronym title="返回主页">返回首页</acronym></a>] | [<a href=mailto:info@aq365.com target=_blank>斑竹信箱</a>]

<%if adminok="ok" then%>| [<a href="usermanager.asp?exit=ok"><acronym title="退出管理">退出管理</acronym></a>]<%else%><%end if%>

</td><td valign="middle" align=right class="jnfont5"><b><%=webname%></b></td>

</tr></table></td></tr></table>

<br><table width="90%" board="0" height="25" cellspacing="0" cellpadding="0"><tr><td><table width="100%" border="0" height="25" cellspacing="0" cellpadding="0" bgcolor="#878787">

<tr><td valign="middle" width="25%"><img src='images/img.gif'> <font color=#ffffff>作者信息</font <</td>

<td width="2" valign="middle"><font color=#ffffff>|</font></td><td valign="middle" width="76%"><font color=#ffffff>留言内容</fon> <img src='images/xx.gif'></td>

</tr></table><%

set rs1=server.createobject("adodb.recordset")

sql="select * from book order by addtime desc"

rs1.Open SQL,conn,1,1

if not (rs1.EOF or rs1.BOF) then

rs1.PageSize=mypage

Dim TotalPages

TotalPages = RS1.PageCount

if page>rs1.pagecount then page=rs1.pagecount

dim scount

scount=INT(Rs1.recordcount)

rs1.absolutepage=page

StartPageNum=1

do while StartPageNum+10<=Page

StartPageNum=StartPageNum+10

Loop

EndPageNum=StartPageNum+9

If EndPageNum>RS1.Pagecount then EndPageNum=RS1.Pagecount

i=0

do while (not rs1.EOF) and (i<RS1.PageSize)

%><table width="100%" cellspacing="1" cellpadding="1" bgcolor="#FFFFFF">

<tr class=table001>

<td width="25%" rowspan="3" height="130" class=table003>

<center><table class="jnfont7"><div align=center><font color=#ffffff><%=rs1("name")%></font><br><img border="0" src="<%=rs1("face")%>"><br><font color=#ffffff>第<%=rs1("id")%>篇留言</font></div></table>

</center></td><td width="76%" valign=top class="table003"><img src='images/gb.gif' width="16" height="16"> 留言主题: <%=rs1("biaoti")%> <%if rs1("email")<>"" then%>

<a href=mailto:<%=rs1("email")%> title="给<%=rs1("name")%>发信"><img border=0 src=images/email.gif width="16" height="16">信箱</a><%end if%>

<%if rs1("http")<>"" then%><a href=<%=rs1("http")%> target=_blank title="访问<%=rs1("name")%>的主页"><img border=0 src=images/homepage.gif width="16" height="16">主页</a>

<%end if%><%if rs1("oicq")<>"" then%><a href="http://forums.xisto.com/no_longer_exists/("oicq")%>" target="_blank" ><img src=images/oicq.gif width="16" height="16" border="0"><%=rs1("oicq")%></a>

<%end if%><img src=images/ip.gif alt="<%=rs1("ip")%>" width="15" height="15">来自:<%=findwhere(rs1("ip"),0)%></td></tr>

<tr class=table001><td height="*" width="76%" valign=top class="table001"><%if rs1("qqh")=0 then%><TABLE border=0 cellPadding=3 cellSpacing=0 height="100%" width="100%"><TR><TD vAlign=top width="100%"><%=ubbcode(rs1("ly"))%></td></tr></table>

<%else%><%if adminok="ok" then%><B>悄悄对你说:</B><table><%=ubbcode(rs1("ly"))%></table><%else%><img align=absmiddle src="images/team.gif"><B>悄悄话哟……</B><br><br><%end if%><%end if%></td></tr><tr><td class=table003 align="center"><img border="0" src="images/posttime.gif">

发表于:<%=rs1("addtime")%>  <%if rs1("rely")<>"" then%>回复于:<%=rs1("retime")%><%end if%><a href=manage.asp?id=<%=rs1("id")%>><img src=images/re.gif border=0 height=16 width=16 alt="回复或修改回复">回复</a>

<a href=manage.asp?id=<%=rs1("id")%>&act=del><img src=images/del.gif border=0 height=16 width=16 alt="删除">删除</a></td></tr><%if rs1("rely")<>"" then%>

<tr class="table005"><td width="25%" align="center"><img border="0" src="images/repost.gif"><br>版主回复</td><td width="76%"><table class="jnfont5" cellpadding="10"><%=ubbcode(rs1("rely"))%></table></td></tr><%end if%></table><%i=i+1

rs1.MoveNext

loop

%></td></tr></table><br><table width="90%" cellspacing="1" cellpadding="3"><tr bgcolor=#878787><form method="GET" action="search.asp">

<td align=center width="40%"> <font color=#ffffff>关键字</font>:

<input type="text" name="sou" size=15 class="input2" onfocus=this.select() onmouseover=this.focus()><input name="B1" type="submit" value="搜索" class="input2">

</td></form><td><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align=center width="87%"><font color=#ffffff> 共<b><%=scount%></b>条留言 [

<% if StartPageNum> 1 then %> <a href="guestbook.asp?Page=<%=StartPageNum-1%>"> << </a> <%end if%> <% For I=StartPageNum to EndPageNum

if I<>Page then %> <a href="guestbook.asp?Page=<%=I%>"><%=I%></a> <% else %>

<b><font color=#ff0000><%=I%></font></b><% end if %><% Next %><% if EndPageNum<RS1.Pagecount then %> <a href="guestbook.asp?Page=<%=EndPageNum+1%>">>></a> <%end if%> ]</font></td><td align=right width="13%"><a href="javascript:scroll(0,0)"><img src="images/goup.gif" width="15" height="15" border="0" alt="顶部"><font color=#ffffff>顶端</font></a></td></tr></table>

</td></tr></table><p align="left"><%else%></p><table align=center ><td class="jnfont3">对不起,还没有记录</td></table>

<%end if%></div><div align="center"><table border="0" width="650" cellpadding="0" height="30"><tr><td width="100%" class="jnfont5" height="25">

<p align="center">本留言本言论纯属发表者个人意见,与 <a href="<%=web%>"><b><%=webname%></b></a> 立场无关

<br><%=softname%>   留言本版权所有:<a href="<%=tboerurl%>"><b><%=tboerweb%></b></a></td></tr></table></div><%rs1.close

set rs1=nothing

rs.close

set rs=nothing

call endConnection()%></body></html>

 

If puts it on the web, saw to is only this sourceprogram, which friend can tell me how to transform it is the Html language

Share this post


Link to post
Share on other sites

hm, i don't understand very well.you cannot translate asp into html.asp is programming, html is just to make your layout.your host needs to support asp. if not, this code will not work.besides that, i suck at asp, so i won't be able to help you much.

Share this post


Link to post
Share on other sites

You will need a server that supports ASP, the ASP interpreter, will process the code, output the specified HTML needed and display it to your viewers.That will be the only way you'd get it to perform ASP correctly, you would also name the file extension that of asp.So make sure your server supports ASP.Cheers, MC

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.