<!--#include file=conn.inc-->
<%
FUNCTION txtToURL(tekst)
Tekst_temp = tekst


Tekst_temp = Replace(Tekst_temp,"<","&lt;")
Tekst_temp = Replace(Tekst_temp,">","&gt;")
Tekst_temp = Replace(Tekst_temp,"chr(13)","<BR>")
Tekst_temp = Replace(Tekst_temp,"chr(10)","<BR>")
Tekst_temp = Replace(Tekst_temp,"#","<BR>")

Tekst_temp = Replace(Tekst_temp,Chr(13),"<BR>")
Tekst_temp = Replace(Tekst_temp,"[","<B>")
Tekst_temp = Replace(Tekst_temp,"]","</B>")

i = 1

While not InStr(i,Tekst_temp,"{") = 0 
start = CInt( InStr(1,Tekst_temp,"{") )
i = start
slutt = CInt( InStr(start,Tekst_temp,"}") )
hole = mid(Tekst_temp,(start),(slutt-start+1))
if InStr(hole,"$") then
	skille = CInt( InStr(start,Tekst_temp,"$") )
	navn = mid(Tekst_temp,(start+1),(skille-start-1))
	link = mid(Tekst_temp,(skille+1),(slutt-skille-1))
	if Left(link,4) = "www." then
	    link = "http://" & link
	end if 'www
	if not InStr(link,"@") = 0 then
	    link = "mailto:" & link
	end if '@
	out_var = "<A HREF=""" & link & """>" & navn & "</A>"
	Tekst_temp = Replace(Tekst_temp,hole,out_var,1,1)
else
	link = mid(Tekst_temp,(start+1),(slutt-start-1))
	if Left(link,4) = "www." then
	    link = "http://" & link
	end if 'www
	if not InStr(link,"@") = 0 then
	    link = "mailto:" & link
	end if '@
	link = "<A HREF=""" & link & """>"
	Tekst_temp = Replace(Tekst_temp,"{",link,1,1)
	Tekst_temp = Replace(Tekst_temp,"}","</A>",1,1)
end if
wend

txtToURL = Tekst_temp
END FUNCTION
name=request("name")
email=request("email")
oicq=request("oicq")
text=request("text")
home=request("home")
image=request("image")

if name="" or home="" or text="" or email="" then
response.write "请认真填写！"
else
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from book where (id is null)" 
rs.open sql,conn,1,3
rs.addnew
rs("昵称")=name
rs("email")=email
rs("OICQ")=oicq
rs("内容")=txtToURL(text)
rs("时间")=FormatDateTime(Date,1) & right(time(),8)
rs("image")=image
rs("home")=home
rs("ip")=request.servervariables("remote_addr")
rs.update
rs.close
set rs=nothing  
conn.close     
set conn=nothing
end if
response.redirect "index.asp"
%>