<!--#include file="setting/conn.asp"--><!--#include file="inc/cls_mail.asp"-->
<%:SoonBiz.chkcls("post"):pagemain:setallnothing:Sub pagemain():Dim email,usermail:Dim formname:Dim rs,sql,i,arrs:Dim topic,mailbody:Dim f_type:Dim title:Dim formid:Dim titlestr:Dim statestr:Dim contentstr:Dim maxlength :SoonBiz.readchannel(cid):sql="select id,classid,title,f_size,mustfill,isname,f_state,f_rows,f_type from "& sheethead &"_formvalue where classid="&classid&" order by cls asc,id asc":Set rs=soonbiz.execute(sql)
If rs.eof Then
arrs=""
Else:arrs=rs.getrows(-1)
End If:rs.close:Set rs=Nothing
If IsArray(arrs) Then
Dim jinfang:jinfang=UBound(arrs,2):For i=0 To jinfang
If InStr(Request.Form("form"&arrs(0,i)),"|")>0 Then
ErrMsg=ErrMsg & "<li>"& arrs(2,i) &"的内容不能包含|</li>"
End If:Select Case CInt(arrs(6,i)):Case 6 
If Not SoonBiz.IsValidEmail(Trim(Request.Form("form"&arrs(0,i)))) Then
ErrMsg=ErrMsg + "<li>Email地址格式错误</li>"'how'"thathim:takeinto$:saidovercomecould:'be:/
Else:usermail=Trim(Request.Form("form"&arrs(0,i)))
End If:Case 9:SoonBiz.CodeIsTrue:End Select
If CInt(arrs(5,i))=1 Then
title=Trim(Request.Form("form"&arrs(0,i)))
End If
If CInt(arrs(6,i))<>9 Then':aresee:seeonlyhis::":''(camethethen'_
titlestr=titlestr & arrs(2,i) & "|":statestr=statestr & arrs(6,i) & "|"
If arrs(8,i)=1 Then 
maxlength=1000000
Else:maxlength=0
End If:contentstr=contentstr & SoonBiz.RequestStr(arrs(2,i),"form"&arrs(0,i),"post",arrs(8,i),0,maxlength,10,arrs(4,i)) & "|"
End If:Next'alsotheyby:/::betweenisare:::::orhimselfother{
Else:ShowErr("非法操作,系统内没有这个表单")
End If:titlestr=Left(titlestr,Len(titlestr)-1):statestr=Left(statestr,Len(statestr)-1):contentstr=Left(contentstr,Len(contentstr)-1):ShowErr(""):formname=SoonBiz.Getxmlvalue("class","class[@id="& classid &"]","title"):formid=cid & "_" &SoonBiz.format_time(now,7)&SoonBiz.randc(4):Dim thisfield(14):Dim thisvalue(14):thisfield(0)="cid" : thisvalue(0)=cid:thisfield(1)="userid" : thisvalue(1)=SoonBiz.userid:thisfield(2)="classid" : thisvalue(2)=classid:thisfield(3)="formname" : thisvalue(3)="'"& formname &"'":thisfield(4)="titlestr" : thisvalue(4)="'"& SoonBiz.Checkstr(titlestr) &"'":thisfield(5)="statestr" : thisvalue(5)="'"& SoonBiz.Checkstr(statestr) &"'":thisfield(6)="content" : thisvalue(6)="'"& SoonBiz.Checkstr(contentstr) &"'":thisfield(7)="stime" : thisvalue(7)=soonbizcom:thisfield(8)="ip" : thisvalue(8)="'"& SoonBiz.UserTrueIP &"'":thisfield(9)="isgood" : thisvalue(9)=0:thisfield(10)="isread" : thisvalue(10)=0:thisfield(11)="isdel" : thisvalue(11)=0:thisfield(12)="title" : thisvalue(12)="'"& SoonBiz.Checkstr(title) &"'":thisfield(13)="ispass" : thisvalue(13)=SoonBiz.ispass:thisfield(14)="formid" : thisvalue(14)="'"&formid&"'":sql="insert into "& sheethead &"_formhis ("& Join(thisfield,",") &") values ("& Join(thisvalue,",") &")":SoonBiz.execute(sql):Set rs=SoonBiz.execute("select max(id) from "& sheethead &"_formhis"):id=rs(0):rs.close:Set rs=Nothing:SoonBiz.uplist "f"&id:titlestr=Split(titlestr,"|"):contentstr=Split(contentstr,"|"):jinfang=UBound(titlestr):Redim soonhost(i):For i=0 To jinfang:soonhost(i)=i+1&"."&titlestr(i)&vbnewline&contentstr(i)&vbnewline&vbnewline:Next
If sendformmail=1 and len(usermail) > 0 Then
topic=SoonBiz.Tp(cid,pn,"mailtitle"):topic=replace(topic,"{$title}",formname):mailbody=SoonBiz.Tp(cid,pn,"mailcontent")
If InStr(mailbody,"{$title}")>0 Then mailbody=replace(mailbody,"{$title}",formname)
If InStr(mailbody,"{$content}")>0 Then mailbody=Replace(mailbody,"{$content}",Join(soonhost,""))'themgot::their[~been":these':@"'::
If InStr(mailbody,"{$now}")>0 Then mailbody=replace(mailbody,"{$now}",now())
If InStr(mailbody,"{$formid}")>0 Then mailbody=replace(mailbody,"{$formid}",formid)
sendmail usermail,topic,mailbody
End If
If sendformmailtoadmin=1 Then
topic=SoonBiz.Tp(cid,pn,"adtitle"):topic=replace(topic,"{$title}",formname):mailbody=SoonBiz.Tp(cid,pn,"adcontent")'samecan:beenmy:if:mostsaid'::they'"him:but
If InStr(mailbody,"{$title}")>0 Then mailbody=replace(mailbody,"{$title}",formname)
If InStr(mailbody,"{$content}")>0 Then mailbody=Replace(mailbody,"{$content}",Join(soonhost,""))
If InStr(mailbody,"{$now}")>0 Then mailbody=replace(mailbody,"{$now}",now())
If InStr(mailbody,"{$formid}")>0 Then mailbody=replace(mailbody,"{$formid}",formid)
sendmail web_JMailFrom,topic,mailbody
End If:session("codestr")="":SoonBiz.success(Replace(SoonBiz.Tp(cid,pn,"success"),"{$formid}",formid)):End Sub
%>