<!--#include file="template.asp"-->
<!--#include file="skins.asp"-->
<%
'//生成首页
function c_index()
   html=cw_redtemp(cf_root&"skins/"&cf_skin,tp_index)           '读取模板
   html=cw_include(html)                        '读取引用文件
   html=cw_system(html)                         '解析系统标签
   html=replace(html,"{cw:webtitle}",cf_title)  '首页标题
   html=replace(html,"{cw:webkey}",cf_key)      '首页关键词
   html=replace(html,"{cw:webdesc}",cf_desc)    '首页描述
   html=Cw_loop(html)                           '解析循环标签   
   html=cw_function(html)                       '解析参数标签
   html=cw_if(html)                             '解析IF标签
   call cw_html(html,cf_root,"index.html")        '生成文件
   response.write("首页 <a href='../' target='_blank'>index.html</a> 静态成功！<br>")
end function
'//生成单页
function c_pages(fid,pages)     
   set cs=server.createobject("adodb.recordset")
   csq="select * from cw_pages where id in("&fid&")"
   cs.open csq,conn,1,1
   if not cs.eof then
   page=pages
   if page="" then page=1
   cs.pagesize=5
   cs.absolutepage=page
   for si=1 to cs.pagesize
     if cs.eof or cs.bof then exit for
       html=cw_redtemp(cf_root&"skins/"&cf_skin,cs("temp"))
       html=cw_include(html)     
       html=cw_system(html)   
       html2=replace(html,"{cw:show_id}",cs("id"))	   
       html2=replace(html2,"{cw:show_title}",cs("title"))
       html2=replace(html2,"{cw:show_url}",cs("html"))
       html2=replace(html2,"{cw:show_content}",cs("content"))
       html2=replace(html2,"{cw:show_key}",cs("keyword"))
       html2=replace(html2,"{cw:show_desc}",cs("description"))	   
       html2=cw_loop(html2)
       html2=cw_function(html2)
       html2=cw_if(html2)
       call cw_html(html2,cf_root&cs("root"),cs("html"))
       response.Write("单页 "&cs("title")&" <a href='"&cf_root&cs("root")&cs("html")&"' target='_blank'>"&cf_root&cs("root")&cs("html")&"</a> 静态成功！<br>")	   
   cs.movenext
   next
   if page+1=<cs.pagecount then
	     response.Write("等待3秒后将继续生成！<br>")
	     response.Write("<meta http-equiv='refresh' content='3;URL=cw_create.asp?html=7&fid="&fid&"&page="&page+1&"&action=2' />")
	   else
	     response.Write("静态完毕！<br>")
	   end if
   end if
   cs.close
   set cs=nothing 
end function
'//生成所有列表
function c_list(lid,pages,act,tab)
   set cl=server.createobject("adodb.recordset")
   clq="select * from "&tab&" where id in("&lid&")"
   cl.open clq,conn,1,1
   if not cl.eof then
   page=pages
   if page="" then page=1
   cl.pagesize=3
   cl.absolutepage=page  
   for si=1 to cl.pagesize
       html=cw_redtemp(cf_root&"skins/"&cf_skin,cl("temp"))
       html=cw_include(html)  
       html=cw_system(html) 
       if cl.eof or cl.bof then exit for
       html2=replace(html,"{cw:class_id}",cl("id"))
       html2=replace(html2,"{cw:class_title}",cl("title"))
       html2=replace(html2,"{cw:class_key}",cl("keyword"))
       html2=replace(html2,"{cw:class_desc}",cl("description"))
       html2=replace(html2,"{cw:class_allid}",cw_classid(tab,cl("id")))	
       html2=replace(html2,"{cw:class_url}",cf_root&cl("html"))
       html2=replace(html2,"{cw:class_pic}",cf_root&cl("pic"))	
	   html2=replace(html2,"{cw:class_followid}",cl("followid"))
	   if cl("followid")<>0 then
	      fid=cw_class("followid",tab,cl("followid"))
		  if fid<>0 then
		   html2=replace(html2,"{cw:class_position}"," &gt; <a href='"&cf_root&cw_class("html",tab,fid)&"'>"&cw_class("title",tab,fid)&"</a> &gt; <a href='"&cf_root&cw_class("html",tab,cl("followid"))&"'>"&cw_class("title",tab,cl("followid"))&"</a> &gt; <a href='"&cf_root&cl("html")&"'>"&cl("title")&"</a>")
		  else		  
           html2=replace(html2,"{cw:class_position}"," &gt; <a href='"&cf_root&cw_class("html",tab,cl("followid"))&"'>"&cw_class("title",tab,cl("followid"))&"</a> &gt; <a href='"&cf_root&cl("html")&"'>"&cl("title")&"</a>") 	
		  end if  
	   else
	     html2=replace(html2,"{cw:class_position}"," &gt; <a href='"&cf_root&cl("html")&"'>"&cl("title")&"</a>") 	  
	   end if 
       dpage=cw_pag(html2,cl("pages"))
       if dpage=0 then dpage=1
         for pa=1 to dpage 	   
         html3=html2
	     if cl("islist")=1 then'频道不解析分页
           html3=Cw_page(html3,cl("pages"),pa)
	     end if
         html3=Cw_loop(html3)
         html3=cw_function(html3)
         html3=cw_if(html3)
	   if pa>1 then'替换标题中的分页数
	      html3=replace(html3,"{cw:class_page}","(第"&pa&"页)") 
	   else
	      html3=replace(html3,"{cw:class_page}","")
	   end if
       if pa=1 then
         call cw_html(html3,cf_root&cl("html"),"index.html")
		 if cl("islist")=1 then
         response.Write("列表 "&cl("title")&" <a href='"&cf_root&cl("html")&"index.html' target='_blank'>"&cf_root&cl("html")&"index.html</a> 静态成功！<br>")
		 else
		 response.Write("频道 "&cl("title")&" <a href='"&cf_root&cl("html")&"index.html' target='_blank'>"&cf_root&cl("html")&"index.html</a> 静态成功！<br>")
		 end if
       else
         call cw_html(html3,cf_root&cl("html"),"index_"&pa&".html")
         response.Write("列表 "&cl("title")&" <a href='"&cf_root&cl("html")&"index_"&pa&".html' target='_blank'>"&cf_root&cl("html")&"index_"&pa&".html</a> 静态成功！<br>")
       end if	   
      next
	  pcs=cl.recordcount-(page-1)*cl.pagesize'当前页记录总数，si当前页第si条记录
	  if cint(act)>0 then
        if si=pcs then response.Write("静态完毕！")
	  end if
   cl.movenext  
   next
      if cint(act)>0 then
      if page+1=<cl.pagecount then
	     response.Write("等待3秒后将继续生成！<br>")
	     response.Write("<meta http-equiv='refresh' content='3;URL=cw_create.asp?html=89&lid="&lid&"&page="&page+1&"&action="&act&"&tab="&tab&"' />")
	  end if
	  end if
   end if
   cl.close
   set cl=nothing
end function

'//生成所有信息
function c_show(sid,h,pages,act,tab)
   set rsc=server.createobject("adodb.recordset")
   if h=1 then sq="select * from "&tab&" where classid in("&sid&") and ispass=1"
   if h=2 then sq="select * from "&tab&" where id in("&sid&") and ispass=1" 
   rsc.open sq,conn,1,1
   if not rsc.eof then
     f1=rsc.fields.count-1 
     page=pages
   if page="" then page=1
   rsc.pagesize=10
   rsc.absolutepage=page   
      html=cw_redtemp(cf_root&"skins/"&cf_skin,cw_class("show",tab&"_class",rsc("classid")))
      html=cw_include(html)
	  html=cw_system(html)
   for si=1 to rsc.pagesize
      if rsc.eof or rsc.bof then exit for
      html2=replace(html,"{cw:show_classname}",cw_class("title",tab&"_class",rsc("classid")))
      html2=replace(html2,"{cw:show_classid}",cw_class("id",tab&"_class",rsc("classid")))
      html2=replace(html2,"{cw:show_classurl}",cf_root&cw_class("html",tab&"_class",rsc("classid")))
	  html2=replace(html2,"{cw:show_desc}",left(cw_nohtml(rsc("content")),80))
	  if tab<>"cw_news" then  html2=Cw_showuser(html2,rsc("userid"))
	  if tab="cw_news" then
	    if rsc("tags")<>"" then
		  html2=Replace(html2,"{cw:show_key}",rsc("tags"))
		  tag=split(rsc("tags"),",")
		  for ta=0 to ubound(tag)
		    tag_s=tag_s&"<a href='"&cf_root&"search/?sid=1&key="&server.URLEncode(tag(ta))&"' target='_blank'>"&tag(ta)&"</a>&nbsp;&nbsp;"
		  next
		  html2=replace(html2,"{cw:show_tags}",tag_s)
		  tag_s=""
	    else
	      html2=replace(html2,"{cw:show_tags}","")
		  html2=Replace(html2,"{cw:show_key}","")
	    end if
	  end if
	  if tab="cw_info" then
	    if rsc("qq")<>"" then
	    html2=replace(html2,"{cw:show_qq2}","<a target='_blank' href='http://wpa.qq.com/msgrd?v=3&uin="&rsc("qq")&"&site=qq&menu=yes'><img border='0' src='http://wpa.qq.com/pa?p=2:"&rsc("qq")&":51' alt='点击联系我' align='absmiddle' /></a>")
		html2=replace(html2,"{cw:show_qq}",rsc("qq"))
		else
		html2=replace(html2,"{cw:show_qq}","")
		html2=replace(html2,"{cw:show_qq2}","")
		end if
	  end if
	  if tab="cw_news" or tab="cw_hous" or tab="cw_info" or tab="cw_shop" then
        if rsc("pic")<>"" then
		 html2=replace(html2,"{cw:show_img}","<img src='"&cf_root&rsc("pic")&"' alt='"&rsc("title")&"' />")
        else
		 html2=replace(html2,"{cw:show_img}"," ")
        end if
	  end if
	  if cw_class("followid",tab&"_class",rsc("classid"))=0 then
            html2=replace(html2,"{cw:show_position}"," &gt; <a href='"&cf_root&cw_class("html",tab&"_class",rsc("classid"))&"'>"&cw_class("title",tab&"_class",rsc("classid"))&"</a> &gt; 正文") 
	  else
	     fid=cw_class("followid",tab&"_class",rsc("classid"))
		 if fid=1 then
                   html2=replace(html2,"{cw:show_position}"," &gt; <a href='"&cf_root&cw_class("html",tab&"_class",fid)&"'>"&cw_class("title",tab&"_class",fid)&"</a> &gt; <a href='"&cf_root&cw_class("html",tab&"_class",rsc("classid"))&"'>"&cw_class("title",tab&"_class",rsc("classid"))&"</a>") 
		 else
		 fid2=cw_class("followid",tab&"_class",fid)
		 html2=replace(html2,"{cw:show_position}"," &gt; <a href='"&cf_root&cw_class("html",tab&"_class",fid2)&"'>"&cw_class("title",tab&"_class",fid2)&"</a> &gt; <a href='"&cf_root&cw_class("html",tab&"_class",fid)&"'>"&cw_class("title",tab&"_class",fid)&"</a> &gt; <a href='"&cf_root&cw_class("html",tab&"_class",rsc("classid"))&"'>"&cw_class("title",tab&"_class",rsc("classid"))&"</a>")
		 end if
	  end if  
      for i=0 to f1
         if rsc(i)<>"" then
		    html2=replace(html2,"{cw:show_"&rsc.fields(i).name&"}",rsc(i))
		 else
		    html2=replace(html2,"{cw:show_"&rsc.fields(i).name&"}"," ")
		 end if
      next	  
      html2=Cw_loop(html2)
      html2=cw_function(html2)
      html2=cw_if(html2)
      call cw_html(html2,cf_root&cw_class("html",tab&"_class",rsc("classid")),rsc("id")&".html") 
	if session("user")="" or session("admin")<>"" then
	  response.Write("信息 <a href='../"&cw_class("html",tab&"_class",rsc("classid"))&rsc("id")&".html' target='_blank'>"&cf_root&cw_class("html",tab&"_class",rsc("classid"))&rsc("id")&".html</a> 静态成功！<br>")
    end if
   rsc.movenext   
    next
	   if cint(act)>0 then
	   if page+1=<rsc.pagecount then
	     response.Write("等待3秒后将继续静态！<br>")
	     response.Write("<meta http-equiv='refresh' content='3;URL=cw_create.asp?html=87&sid="&sid&"&page="&page+1&"&action="&act&"&tab="&tab&"' />")
	   else
	     if session("admin")<>"" then response.Write("静态完毕！<br>")'用户生成不提示
	   end if
	   end if
   else
      response.Write("没有需要静态的信息!")
   end if
   rsc.close
   set rsc=nothing
end function
'//生成其它列表页
cf_hr="hr/"
function c_olist(ltype)
  select case ltype
  case "cw_hr"
     c_tp=tp_hr_list  '模板skins.asp
	 c_ht=cf_hr
	 c_tt="人才简历"
  end select
  c_pg=20
  data=cw_redtemp(cf_root&"skins/"&cf_skin,c_tp)
  data=cw_include(data)
  data=cw_system(data)
  data=replace(data,"{cw:class_title}",c_tt)
  data=replace(data,"{cw:class_position}"," &gt; <a href='"&cf_root&c_ht&"'>"&c_tt&"</a>")
  data=replace(data,"{cw:class_key}",c_tt)
  data=replace(data,"{cw:class_desc}",c_tt)
  dpage=cw_pag(data,c_pg)
  if dpage=0 then dpage=1
  for pa=1 to dpage
  html=data
  html=Cw_page(html,c_pg,pa)
  html=Cw_loop(html)
  html=cw_function(html)
  html=cw_if(html)  
  if pa>1 then'替换标题中的分页数
	 html=replace(html,"{cw:class_page}","(第"&pa&"页)") 
  else
	html=replace(html,"{cw:class_page}","")
  end if
  if pa=1 then
     call cw_html(html,cf_root&c_ht,"index.html")
	 response.Write("列表 "&c_tt&" <a href='"&cf_root&c_ht&"' target='_blank'>"&cf_root&c_ht&"index.html</a> 静态成功！<br>")
  else
     call cw_html(html,cf_root&c_ht,"index_"&pa&".html")
	 response.Write("列表 "&c_tt&" <a href='"&cf_root&c_ht&"index_"&pa&"' target='_blank'>"&cf_root&c_ht&"index_"&pa&".html</a> 静态成功！<br>")
  end if
  next
  response.Write("静态完毕！")
end function
'//静态其它内容页
function c_oshow(tab,ty,cid,act,pages)'表，批量/指定ID,ID，返回的Create的action，当前页
   set rsc=server.createobject("adodb.recordset")
   if ty=0 then
      sq="select * from "&tab&" order by id asc"
   else
      sq="select * from "&tab&" where id in("&cid&") order by id asc"
   end if
   rsc.open sq,conn,1,1   
   if not rsc.eof then
   select case tab
   case "cw_hr"
     c_tp=tp_hr_show
	 c_ht=cf_hr
	 c_tt="人才简历"
   end select
     f1=rsc.fields.count-1 
     page=pages
   if page="" then page=1
   rsc.pagesize=10
   rsc.absolutepage=page   
   data=cw_redtemp(cf_root&"skins/"&cf_skin,c_tp)
   data=cw_include(data)
   data=cw_system(data)   
   for si=1 to rsc.pagesize
      if rsc.eof or rsc.bof then exit for	  
	  html=data    
      html=replace(html,"{cw:show_classname}",c_tt)
      html=replace(html,"{cw:show_classurl}",cf_root&c_ht)		  
	  select case tab
	  case "cw_hr"
		 html=replace(html,"{cw:show_nianling}",year(now())-year(rsc("chusheng")))
		 html=replace(html,"{cw:show_pic}",cf_root&rsc("pic"))
		 html=replace(html,"{cw:show_key}",rsc("xingming")&"的简历")
		 html=replace(html,"{cw:show_desc}",rsc("xingming")&"的简历")
		 html=replace(html,"{cw:show_username}",cw_class("user","cw_user",rsc("userid")))
	  end select	    
	  html=replace(html,"{cw:show_position}"," &gt; <a href='"&cf_root&c_ht&"'>"&c_tt&"</a> &gt "&rsc("xingming")&"的简历")	
      for i=0 to f1
         if rsc(i)<>"" then
		    html=replace(html,"{cw:show_"&rsc.fields(i).name&"}",rsc(i))
		 else
		    html=replace(html,"{cw:show_"&rsc.fields(i).name&"}"," ")
		 end if
      next	  
      html=Cw_loop(html)
      html=cw_function(html)
      html=cw_if(html)
    call cw_html(html,cf_root&c_ht,rsc("id")&".html")
	if session("admin")<>"" then
	     response.Write("信息 <a href='"&cf_root&c_ht&rsc("id")&".html' target='_blank'>"&cf_root&c_ht&rsc("id")&".html</a> 静态成功！<br>")
    end if
    rsc.movenext
    next
	if cint(act)>0 then
	   if page+1=<rsc.pagecount then
	     response.Write("等待3秒后将继续生成！<br>")
	     response.Write("<meta http-equiv='refresh' content='3;URL=cw_create.asp?html=16&page="&page+1&"&action="&act&"&tab="&tab&"' />")
	   else
	     if session("admin")<>"" then response.Write("静态完毕！<br>")'用户静态不提示
	   end if
	   end if
   else
      response.Write("没有需要生成的信息！")
   end if
   rsc.close
   set rsc=nothing
end function
'//Sitemap
function c_sitemap()
   html2=cw_redtemp(cf_root&"skins/"&cf_skin,tp_map)
   html2=cw_include(html2)
   html2=cw_system(html2)
   html2=Cw_loop(html2)                           '解析循环标签
   html2=cw_function(html2)                       '解析参数标签
   html2=cw_if(html2)                             '解析IF标签
   call cw_html(html2,cf_root,"sitemap.html")        '生成文件
   response.Write("<a href='../sitemap.html' target='_blank'>Sitemap.html</a> 生成成功！<br>")
   html=cw_redtemp(cf_root&"skins/"&cf_skin,tp_xml)
   html=cw_include(html)
   html=cw_system(html)
   html=Cw_loop(html)                
   html=cw_function(html)                    
   html=cw_if(html) 
   call cw_html(html,cf_root,"sitemap.xml")     
   response.Write("<a href='../sitemap.xml' target='_blank'>Sitemap.xml</a> 静态成功！<br>")
end function
'//删除文件夹
Function Delfolder(folder)
folder=cw_root&folder&"/"
if lhtml<>request("lhtml") then
  Set fso = CreateObject("Scripting.FileSystemObject")
  if (fso.FolderExists(Server.MapPath(folder))) then'判断目录是否存在
     fso.DeleteFolder(folder)
  end if
  set fso=nothing
end if
End Function

'//删除图片
Function Delimg(pic)
if pic<>"" then
  if pic<>request("pic") then
        spic="../"&pic
		Set fso = CreateObject("Scripting.FileSystemObject")
		fso.DeleteFile(server.MapPath(spic))
		Set fso = nothing
  end if
end if
End Function

'检查是否外部提交
Function Check_Post
	Check_Post=False
	Dim t0,t1
	t0=Cstr(Request.ServerVariables("HTTP_REFERER"))
	t1=Cstr(Request.ServerVariables("SERVER_NAME"))
	IF Mid(t0,8,Len(t1))<>t1 Then Check_Post=True
End Function
'获取内容中所有图片
Function Get_ImgSrc(t0,id)
	t1=""
	t3="http://"&Request.ServerVariables("Server_name")
	IF Len(t0)>0 Then
		Set Regs=New RegExp
		Regs.Pattern="<IMG[^>]+src=""([^"">]+)""[^>]*>"
		Regs.Ignorecase=True
		Regs.Global=True
		Set Matches=Regs.Execute(t0)
		IF Matches.Count>0 Then
			For Each Match In Matches
			     picurl=Replace(Match.SubMatches(0),t3&"/","")'替换图片路径中的域名
				 picurl=Replace(picurl,"http://","")
				IF Left(picurl,7)<>"http://" Then
				    if id=0 then
					t1=t1&"<option value="""&picurl&""">"&picurl&"</option>"
					else
					t1=t1&picurl&","
					end if
				End IF
			Next
		End IF
	End IF
	Get_ImgSrc=t1
	Set Matches=Nothing
	Set Regs=Nothing
End Function
'//登录过滤危险字符
function login_check(str)
'过滤危险字符                            
    str=server.HTMLEncode(str)
    str=replace(str,"'","‘")
    str=replace(str,chr(39),"’")
    str=replace(str,",","，")
    str=trim(str)
    str=replace(str,vbcrlf,"<br>")
    str=replace(str,chr(13),"<br>")
    login_check=str
end function
'//用户积分
function cw_jf(j,f)
set jf=server.CreateObject("adodb.recordset")
jfq="select id,jf from cw_user where id="&session("userid")
jf.open jfq,conn,1,3
if not jf.eof then
  if j="+" then
  jf("jf")=jf("jf")+f
  else
  jf("jf")=jf("jf")-f
  end if
  jf.update
end if
jf.close
set jf=nothing
end function
'//获取当前URL，主要用于登录
function cw_url()
u_name=Request.ServerVariables("QUERY_STRING")
a_name=Request.ServerVariables("SCRIPT_NAME")
if u_name<>"" then
a_name=a_name&"?"&u_name
end if
cw_url=a_name
end function
'//验证发布间隔
function cw_yz(s)
If Request.Servervariables("request_method")="POST" Then '判断是否是从表单提交数据
  If DateDiff("s",Session("LastSearchTime"),Now())<s Then 
     Response.Write("<script>alert('对不起，你的操作间隔太快！');history.back();</script>") 
     Response.End() 
  Else 
     Session("LastSearchTime")=Now() 
  End If 
End If 
end function
'//用户名反查ID
function cw_userid(user)
  set us=server.CreateObject("adodb.recordset")
  usq="select * from cw_user where user='"&user&"'"
  us.open usq,conn,1,1
  if not us.eof then
    cw_userid=us("id")
  else
    cw_userid=0
  end if
  us.close
  set us=nothing
end function

'查询回帖相关
function cw_rebbs(id,zd)
cw_rebbs=""
On error resume next
set cr=server.CreateObject("adodb.recordset")
crq="select top 1 "&zd&" from cw_bbs_reply where bbsid="&id&" order by id desc"
cr.open crq,conn,1,1
if not cr.eof then
  cw_rebbs=cr(0)
end if
cr.close
Call Cw_err("Cw_rebbs")
set cr=nothing
end function

'贴子统计查询
function cw_bbscount(id,lei)  
  allid=cw_classid("cw_bbs_class",id)'并取得子ID
  set bc=server.CreateObject("adodb.recordset")
  if lei=1 then bcq="select * from cw_bbs where classid in("&allid&")"
  if lei=2 then bcq="select * from cw_bbs where classid in("&allid&") and format(adddate,'yyyy-mm-dd')='"&cw_date(now(),"yyyy-mm-dd")&"'"
  bc.open bcq,conn,1,1
  if err then
     cw_bbscount=err.description
	 err.clear
	 exit function
  end if
  cw_bbscount=bc.recordcount
  bc.close
  set bc=nothing
end function
'回帖统计
function cw_bbsreply(id)
  set br=server.CreateObject("adodb.recordset")
  brq="select * from cw_bbs_reply where ispass=1 and bbsid="&id
  br.open brq,conn,1,1
  cw_bbsreply=br.recordcount
  br.close
  set br=nothing
end function

'//登录验证
Public Function Cw_login()
  uid=session("userid")
  uin=session("user")
  If uid="" or uin="" Then
  response.Write("<script>alert('您还没有登录或登录超时！');location.href='"&cf_root&"user/login.asp';</script>")
  End If
End Function

'//验证码
Public Function Cw_yzm()
  If trim(Request.Form("yzm"))<>Session("iCode") Then
	response.Write("<script>alert('验证码输入错误!');history.back();</script>")
	response.End()
  End If
End function
'//敏感词过滤
Function cw_keyword(con)
  data=replace(cf_keyword,"，",",")
  strFilter = Split(data, ",")
  str=con
  For i=0 To UBound(strFilter)
    str=Replace(str, strFilter(i),String(Len(strFilter(i)),"*****"))
  Next
  cw_keyword=str
End Function
'//Jmail邮箱验证码
Function Cw_jmailyzm(e)
   e_email=e
   e_yzm=Cw_rnd(5)
   Session("email_yzm")=e_yzm
   e_tit=cf_name&"-邮箱验证码"
   e_con="亲家的用户：<br />您的邮箱验证码是："&e_yzm&"（不区分大小写），请在3分钟内进行验证，过期验证码将失效！"
   If isjmail=1 Then
     jm=Cw_jmail(cf_smtp,cf_email,cf_name,cf_jmailUser,cf_jmailPass,e_email,e_tit,e_con)
     If jm=0 Then Response.Write("0发送成功！")
     If jm=1 Then Response.Write("1系统错误！")
     If jm=2 Then Response.Write("1发送失败！")
   Else
     Response.Write("1系统错误！")
   End If
   Response.End()
End Function

'论坛等级
Function Cw_gr(jf)
  if jf>2000 then
  gr=20
  else
    if jf>1500 then
	gr=19
	else
	  if jf>1200 then
	  gr=18
	  else
	    if jf>1000 then
		gr=17
		else
		  if jf>900 then
		  gr=16
		  else
		    if jf>800 then
			gr=15
			else
			  if jf>700 then
			  gr=14
			  else
			    if jf>600 then
				gr=13
				else
				  if jf>500 then
				  gr=12
				  else
				    if jf>400 then
					gr=11
					else
					  if jf>300 then
					  gr=10
					  else
					    if jf>250 then
						gr=9
						else
						  if jf>200 then
						  gr=8
						  else
						    if jf>150 then
							gr=7
							else
							  if jf>100 then
							  gr=6
							  else
							    if jf>80 then
								gr=5
								else
								  if jf>50 then
								  gr=4
								  else
								    if jf>20 then
									gr=3
									else
									  if jf>10 then
									  gr=2
									  else
									    if jf>1 then
										gr=1
										else
										  if jf<1 then
										  gr=0
										  end if
										end if
									  end if
									end if
								  end if
								end if
							  end if
							end if
						  end if
						end if
					  end if
					end if
				  end if
				end if
			  end if
			end if
		  end if
		end if
	  end if
	end if
  end if
  Conn.execute("update cw_user set grade="&gr&" where id="&session("userid"))
End Function

Function Cw_grade(gr)  
  Select Case gr
  case 0
    de="婴幼儿"
  case 1
    de="幼儿园"
  case 2
    de="学前班"
  case 3
    de="小学一年级"
  case 4
    de="小学二年级"
  case 5
    de="小学三年级"
  case 6
    de="小学四年级"
  case 7
    de="小学五年级"
  case 8
    de="小学六年级"
  case 9
    de="初中一年级"
  case 10
    de="初中二年级"
  case 11
    de="初中三年级"
  case 12
    de="高中一年级"
  case 13
    de="高中二年级"
  case 14
    de="高中三年级"
  case 15
    de="大学一年级"
  case 16
    de="大学二年级"
  case 17
    de="大学三年级"
  case 18
    de="大学四年级"
  case 19
    de="硕士研究生"
  case 20
    de="博士研究生"
  End Select
  Cw_grade="<img src='"&cf_root&"images/grade/"&gr&".gif' height='16' align='absmiddle' /><br />等级："&de
End Function
%>