Active Server Pages

掲示板のサンプル・ソース

<%@ LANGUAGE = VBSCRIPT %>

<%
' 23 jan 04
rclass = Request.QueryString("class")
if rclass = "" then rclass = "var"

rgroup = Request.QueryString("group")
topad = "/" & rgroup & "/index.html"
if rgroup = "" then topad = "/index.html"

rpage = Request.QueryString("page")
if rpage = "" then rpage = 0
rpage = int(rpage) ' 27 jan 04
if rpage < 0 then rpage = 0
front = rpage - 5
rear = rpage + 5

Dim bookshelf
Dim readingability
Dim foundation

Set bookshelf = CreateObject("Scripting.FileSystemObject")
Set readingability = bookshelf.OpenTextFile(Server.MapPath("/cgi-bin/bbs/firstplace.log"),1 ,True)

Do Until readingability.AtEndOfStream = True
firstplac = readingability.ReadLine
foundation = split (firstplac , ",")

if foundation(0) = rclass then
kurasu = foundation(0)
title = foundation(1)
hozonkensu = foundation(2)
gazosaizu = foundation(3)
chakushin = foundation(4)
mailto = foundation(5)
modoruurl = foundation(6)
riyosha= foundation(7)
end if
Loop

Set readingability = Nothing
Set bookshelf = Nothing

if modoruurl <> "" then topad = modoruurl

' Dim bookshelf
' Dim serialstory
enrollment = 0

Set bookshelf = CreateObject("Scripting.FileSystemObject")
Set serialstory = bookshelf.GetFolder(Server.MapPath("/cgi-bin/" & rclass))

For Each separate in serialstory.Files
enrollment = enrollment + 1
Next

dim glance
dim shou
dim daai
ReDim glance(enrollment)
ReDim shou(enrollment)
ReDim daai(enrollment)
enrollment = 0

For Each separate in serialstory.Files
m = instr (separate.Name , ".")
if m<1 then
glance(enrollment) = separate.Name
'' Response.Write(separate.Name & "<br>")
enrollment = enrollment + 1
end if
Next

Set serialstory = Nothing
Set bookshelf = Nothing

enrollment = enrollment - 1
M = 0
while M < enrollment
G = glance(M)
N = M
for K = M to enrollment
I = glance(K)
if I > G then
G = I
N = K
end if
next
H = glance(M)
glance(M) = glance(N)
glance(N) = H
''Response.Write(glance(M) & "<br>")
M = M + 1
wend

' 24 jan 04
summit = "9000"
Set bookshelf = CreateObject("Scripting.FileSystemObject")
Set readingability = bookshelf.OpenTextFile(Server.MapPath("/cgi-bin/bbs/" & rclass & "r.log"),1 ,True)
summit = readingability.ReadLine
Set readingability = Nothing
Set bookshelf = Nothing

existence = 0
smallest = 0
greatest = 0

for K=0 to enrollment
if glance(K) < summit then
shou(smallest) = glance(K)
smallest = smallest + 1
else
daai(greatest) = glance(K)
greatest = greatest + 1
existence = 1
end if
next

sequence = 0
for K=0 to smallest - 1
glance(sequence) = shou(K)
sequence = sequence + 1
next

if existence = 1 then
for K=0 to greatest - 1
glance(sequence) = daai(K)
sequence = sequence + 1
next
end if

dim decision(15)
enumerate = 0
articles = 0
for K=0 to enrollment
if rpage <= enumerate then
decision(articles) = glance(K)
articles = articles + 1
end if
enumerate = enumerate + 1
if enumerate >= rear then exit for
next

ecgi = "notice.asp"
if front >= 0 then frontxt = "<A HREF=" & chr(&H22) & ecgi & "?page=" & front & "&group=" & rgroup & "&class=" & rclass & chr(&H22) & ">前ページ</A>  " & chr(10)
if enrollment > rear then reartxt = "<A HREF=" & chr(&H22) & ecgi & "?page=" & rear & "&group=" & rgroup & "&class=" & rclass & chr(&H22) & ">次ページ</A>  " & chr(10)

exhibit = ""
place = 1

for J = 0 to 4

if decision(J) = "" then exit for

photo = ""
bcolor = "#FFFFFF"
fcolor = "#000000"
mest = ""
homepage = ""

Set bookshelf = CreateObject("Scripting.FileSystemObject")
Set readingability = bookshelf.OpenTextFile(Server.MapPath("/cgi-bin/" & rclass & "/" & decision(J)),1 ,True)

Do Until readingability.AtEndOfStream = True
messe = readingability.ReadLine
''exhibit = exhibit & messe & "<BR>" & chr(10)
one = instr(messe, "Date:")
two = instr(messe, "From:")
thr = instr(messe, "Subject:")
col = instr(messe, "Color:")
pic = instr(messe, "Picture:")
hom = instr(messe, "Homepage:")

if one = 1 or two = 1 or thr = 1 or col = 1 or pic = 1 or hom = 1 then
q = instr(messe, " ")
four = left(messe, q-1)
five = mid(messe, q+1)
else
mest = mest & messe & "<BR>" & chr(10)
end if

if one = 1 then hizu = five
if two = 1 then
q = instr(five, "<")
qq = q
nama = left(five , q-1)
six = mid(five , q+1)
rec = instr(six, ">accept")
six = ""
end if
if thr = 1 then subj = five
if col = 1 then
q = instr(five, ":")
bcolor = left(five , q-1)
fcolor = mid(five , q+1)
end if
if pic = 1 then photo = five
if hom = 1 then homepage = five

Loop

Set readingability = Nothing
Set bookshelf = Nothing

if place = 0 then
position = "ALIGN=right"
place = 1
else
position = "ALIGN=left"
place = 0
end if

exhibit = exhibit & "<TABLE BORDER=4 CELLSPACING=4 " & position & ">" & chr(10)
exhibit = exhibit & "<TR><TD BGCOLOR=" & chr(&H22) & bcolor & chr(&H22) & ">" & chr(10)
exhibit = exhibit & "<B>#" & decision(J) & subj & "</B><BR>" & chr(10)
exhibit = exhibit & "<I>" & hizu & "</I><BR>" & chr(10)

homp = ""
if homepage <> "" then homp = "さんの<A HREF=" & chr(&H22) & homepage & chr(&H22) & ">ページ</A>" & chr(10)

if rec > 1 then
exhibit = exhibit & "<A HREF=" & chr(&H22) & "interpret.cgi?number=" & fname & "&group=" & rgroup & "&class=" & rclass & chr(&H22) & ">" & nama & "</A> " & homp & "<BR>" & chr(10)
else
exhibit = exhibit & nama & homp & "<BR>" & chr(10)
end if

if photo <> "" then
photo = mid(photo, 6)
' Dim bookshelf
Dim objFIL
Set bookshelf = CreateObject("Scripting.FileSystemObject")
Set objFIL = bookshelf.GetFile(Server.MapPath(photo))
fsize = objFIL.Size
Set objFIL = Nothing
Set bookshelf = Nothing

gazosaiz = gazosaizu * 1000
if fsize < gazosaiz then exhibit = exhibit & "<BR><IMG SRC=" & chr(&H22) & photo & chr(&H22) & ">" & chr(10)
end if

exhibit = exhibit & "<FONT color=" & chr(&H22) & fcolor & chr(&H22) & ">" & mest & "</FONT>" & chr(10)

fsizel = int(fsize / 1000)
if photo <> "" and fsize >= gazosaiz then exhibit = exhibit & "<P><A HREF=" & chr(&H22) & photo & chr(&H22) & ">画像 " & fsizel & "KB</A>" & chr(10)

exhibit = exhibit & "</TD></TR></TABLE><BR Clear=All><BR>" & chr(10)

next

%>

<HTML><HEAD>
<META NAME="ROBOTS" CONTENT="NONE">
<meta http-equiv="Content-Type" content="text/html; charset=x-sjis">
<TITLE>A bulletin board. Any news?</TITLE>
</HEAD>
<BODY BGCOLOR="#FFEEEE" VLINK="#00CC66">

<TABLE BORDER=0 CELLSPACING=0 WIDTH="100%">
<TR><TD>
<IMG SRC="/club/ANYNEWS.GIF" alt="どんなニュース?">
</TD><TD ALIGN=Right>
<form action="question.cgi" method="get">
<INPUT TYPE="hidden" NAME="group" VALUE="<%=rgroup%>">
<INPUT TYPE="hidden" NAME="class" VALUE="<%=rclass%>">
<input type="text" name="word" VALUE="<%=rword%>" size="30">
<input type="submit" value="Question">
</form>
</TD></TR>
</TABLE>
<span STYLE=" font-size: 14pt ; font-weight: bold ; ">
 掲示板:<%=title%>
</span>

<P ALIGN=Right>

<%=frontxt%>
<%=reartxt%>

<A HREF="board.cgi?group=<%=rgroup%>&class=<%=rclass%>">新規登録</A>  
<A HREF="clean.cgi?group=<%=rgroup%>&class=<%=rclass%>">削除編集</A>  
<A HREF="havealook.cgi?group=<%=rgroup%>&class=<%=rclass%>">タイトル</A>  
<A HREF="<%=topad%>">トップページ</A>
</P>

<%=exhibit%>

<P ALIGN=Right>

<%=frontxt%>
<%=reartxt%>

<A HREF="board.cgi?group=<%=rgroup%>&class=<%=rclass%>">新規登録</A>  
<A HREF="clean.cgi?group=<%=rgroup%>&class=<%=rclass%>">削除編集</A>  
<A HREF="havealook.cgi?group=<%=rgroup%>&class=<%=rclass%>">タイトル</A>  
<A HREF="<%=topad%>">トップページ</A>
</P>

</BODY>
</HTML>

January 28, 2004
The following clause.
ソフトウェア