一種我未用過的方法,但現在覺得很爽
1
<%@language=vbscript codepage=936 %>
2
<%
3
option explicit
4
response.buffer=true
5
dim conn
6
dim connstr
7
dim db
8
db="yipinjia.asp"
9
Set conn = Server.CreateObject("ADODB.Connection")
10
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
11
conn.Open connstr
12
13
%>
14
15
<%
16
Rem 判斷發言是否來自外部
17
Function ChkPost()function ChkPost()
18
dim server_v1,server_v2
19
chkpost=false
20
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
21
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
22
if mid(server_v1,8,len(server_v2))<>server_v2 then
23
chkpost=false
24
else
25
chkpost=true
26
end if
27
end function
28
%>

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17


18

19

20

21

22

23

24

25

26

27

28
