<%
'****************************************************
' Joekoe CMS 1.2 Free      Power by Joekoe.com
' Email: cms@joekoe.com , service@joekoe.com
' Web: http://www.joekoe.com , 
' Copyright (C) 2004 Joekoe.com All Rights Reserved.
'****************************************************
'****************************************************

dim val_rnd,val_is_true
val_rnd=joekoe_cms.rand_num(4)
val_is_true=true
session("web_cookies_name")=joekoe_cms.web_cookies
session("web_dir")=joekoe_cms.web_dir
if int(format_mid_num(34))=1 then val_is_true=false

function val_chk(vsort)
  if not val_is_true then
    val_chk=true
    exit function
  end if
  dim valcode,valc
  val_chk=false
  valcode="jk"&trim(request.form("valcode"))
  valc=trim(request.cookies(joekoe_cms.web_cookies)("vc_"&vsort))
  if valcode<>"" and valcode<>"jk" and cstr(valcode)=cstr(valc) then
    val_chk=true
  end if
end function

sub val_chk_end(vsort)
  if not val_is_true then exit sub
  response.cookies(joekoe_cms.web_cookies)("vc_"&vsort)=empty
end sub

function val_code_num(vsort,vt)
  if not val_is_true then
    val_code_num="<input type=hidden name=valcode value=''>"
    exit function
  end if
  response.cookies(joekoe_cms.web_cookies)("vc_"&vsort)="jk"&val_rnd
  if vt=0 then
    val_code_num=val_rnd
    exit function
  end if
  val_code_num="<input type=hidden name=valcode value='"&val_rnd&"'>"
end function

function val_code(vsort)
  if not val_is_true then
    val_code="<table border=0 cellspacing=0 cellpadding=0><tr>" & _
  	     "<td><font class=red2>验证码机制已关闭</font></td>" & _
	     "</tr></table>"
    exit function
  end if
  response.cookies(joekoe_cms.web_cookies)("vc_"&vsort)="jk"&val_rnd
  val_code="<table border=0 cellspacing=0 cellpadding=0><tr>" & _
  	   "<td><input type=text name=valcode size=15 maxlength=10>&nbsp;<font class=red>*</font>&nbsp;</td>" & _
	   "<td>"&getcode1(vsort)&"</td>" & _
	   "</tr></table>"
end function

Function getcode1(vsort)
	Dim test
	On Error Resume Next
	Set test=Server.CreateObject("Adodb.Stream")
	Set test=Nothing
	If Err Then
		getcode1= val_rnd	
	Else
		getcode1= "<img src='rnd_num.asp?sort="&vsort&"'>"
	End If
End Function

'****************************************************
' Joekoe CMS 1.2 Free      Power by Joekoe.com
' Email: cms@joekoe.com , service@joekoe.com
' Web: http://www.joekoe.com , 
' Copyright (C) 2004 Joekoe.com All Rights Reserved.
'****************************************************
%>