<% '**************************************************** ' Joekoe CMS 1.2 Free Power by Joekoe.com ' Email: cms@joekoe.com , service@joekoe.com ' Web: http://www.joekoe.com , http://www.topv.com ' Copyright (C) 2004 Joekoe.com All Rights Reserved. '****************************************************
const dim_11_len=50 const dim_12_len=50
class class_joekoe_cms public web_name,web_url,web_email,web_urls,web_dir,web_cookies,web_skin,web_dir_skin,web_upload,web_unit,web_health,web_tit,now_time,today_time,timer_start,pro_edition,num_rs,connstr public js_tim,js_mod,isconn,ishealth
function exec(esql,etype) if isconn=false then call conn_open() response.write vbcrlf&"// "&esql select case etype case 0 conn.execute(esql) case 1 set exec=conn.execute(esql) end select num_rs=num_rs+1 end function
sub conn_open() set conn=server.createobject("adodb.connection") set rs=server.createobject("adodb.recordset") conn.open connstr(31行的错误) isconn=true end sub
function popedom_p(popedom_var,popedom_n) if cint(popedom_n)>len(popedom_var) or len(popedom_var)<>50 then popedom_p=0 exit function end if popedom_p=int(mid(popedom_var,popedom_n,1)) end function
'-------------------------------------地址处理-------------------------------------- function url_true(puu,pus) dim pupload,pu pupload=puu pu=pus if instr(1,pu,"://")<>0 then url_true=pu else if pupload="" then pupload=web_upload if right(pupload,1)<>"/" then pupload=pupload&"/" url_true=pupload&pu end if end function
function own_http() dim ssort ssort=trim(request.servervariables("server_port")) own_http="http://"&trim(request.servervariables("server_name")) if ssort<>"80" then own_http=own_http&":"&ssort if right(own_http,1)<>"/" then own_http=own_http&"/" end function
sub own_dir() dim path_info,now_dir,ndd path_info=request.servervariables("path_info") now_dir=left(path_info,instrrev(path_info,"/")) web_dir=now_dir ndd=own_http() web_urls=left(ndd,len(ndd)-1)&now_dir end sub
'-----------------------------------时间格式处理------------------------------------ function time_type(tvar,tt) dim ttt,d_year,d_month,d_day,d_hour,d_minute,d_second ttt=tvar if ttt="" or isnull(ttt) then ttt=now_time if not(isdate(ttt)) then time_type="" exit function end if d_year=year(ttt) d_month=month(ttt) if len(d_month)<2 then d_month="0"&d_month d_day=day(ttt) if len(d_day)<2 then d_day="0"&d_day d_hour=hour(ttt) if len(d_hour)<2 then d_hour="0"&d_hour d_minute=minute(ttt) if len(d_minute)<2 then d_minute="0"&d_minute d_second=second(ttt) if len(d_second)<2 then d_second="0"&d_second select case tt case 1 '2000-10-10 23:45:45 time_type=d_year&"-"&d_month&"-"&d_day&" "&d_hour&":"&d_minute&":"&d_second case 11 '20001010234545 time_type=d_year&d_month&d_day&d_hour&d_minute&d_second case 2 '年(4)-月-日 时:分:秒 time_type=d_year&"年"&d_month&"月"&d_day&"日 "&d_hour&"时"&d_minute&"分"&d_second&"秒" case 3 '10-10 23:45 time_type=d_month&"-"&d_day&" "&d_hour&":"&d_minute case 4 '2003-10-10 time_type=d_year&"-"&d_month&"-"&d_day case 5 '2003年10月10日 time_type=d_year&"年"&d_month&"月"&d_day&"日" case else time_type=ttt end select end function
'-------------------------------------整数处理-------------------------------------- function int_true(nvar) int_true=true if not(isnumeric(nvar)) or instr(nvar,".")>0 then int_true=false end if end function
'-------------------------------------字符处理-------------------------------------- function code_form(strers) dim strer strer=trim(strers) if strer="" or isnull(strer) then code_form="" exit function end if strer=replace(strer,"'","""") code_form=strer end function
function code_word(strers) dim strer strer=trim(strers) if strer="" or isnull(strer) then code_word="" exit function end if strer=replace(strer,chr(39),"'") '单引号 strer=replace(strer," strer=replace(strer,"","</textarea>") code_word=strer end function
function code_js(strers,tt) dim strer strer=trim(strers) if strer="" or isnull(strer) then code_js="" exit function end if if ishealth then strer=code_health(strer) end if strer=replace(strer,"\","\\") strer=replace(strer,chr(39),"'") '单引号 'strer=replace(strer,chr(39),"\'") strer=replace(strer,chr(34),""") '双引号 'strer=replace(strer,chr(34),"\""") select case tt case 0 'strer=replace(strer,vbcrlf,"") '回车 strer=replace(strer,chr(10),"") strer=replace(strer,chr(13),"") case 1 'strer=replace(strer,vbcrlf,"\n") '回车 strer=replace(strer,chr(10),"\n") strer=replace(strer,chr(13),"") end select if right(strer,1)="\" then strer=strer&"n" end if code_js=strer end function
function code_html(strers,chtype,cutenum) dim strer strer=trim(strers) if strer="" or isnull(strer) then code_html="" exit function end if if ishealth then strer=code_health(strer) end if if cutenum>0 then strer=cuted(strer,cutenum) strer=replace(strer,"<","<") strer=replace(strer,">",">") strer=replace(strer,chr(39),"'") '单引号 strer=replace(strer,chr(34),""") '双引号 strer=replace(strer,chr(32)," ") '空格 pro_edition="Joe"&"koe"&" CM"&"S 1"&".2"&" Free" select case chtype case 1 strer=replace(strer,chr(9)," ") 'table 'strer=replace(strer,vbcrlf,"") '回车 strer=replace(strer,chr(10),"") strer=replace(strer,chr(13),"") case 2 strer=replace(strer,chr(9)," ") 'table 'strer=replace(strer,vbcrlf," ") '回车 strer=replace(strer,chr(10)," ") strer=replace(strer,chr(13),"") end select code_html=strer end function
function code_health(hnn) dim ti,tj,tdim,ht code_health=hnn tdim=split(web_health,":") for ti=0 to ubound(tdim) ht="**" 'for tj=1 to len(tdim(ti)) ' ht=ht&"*" 'next code_health=replace(code_health,tdim(ti),ht) next erase tdim end function
'------------------------------------字符分割-------------------------------------- function cuted(types,num) dim ctypes,cnum,ci,tt,tc,cc,cmod cmod=3 ctypes=types cnum=cint(num) cuted="" tc=0 cc=0 for ci=1 to len(ctypes) if cnum<0 then cuted=cuted&"..." exit for end if tt=mid(ctypes,ci,1) if int(asc(tt))>=0 then cuted=cuted&tt tc=tc+1 cc=cc+1 if tc=2 then tc=0 cnum=cnum-1 if cc>cmod then cnum=cnum-1 cc=0 else cnum=cnum-1 if cnum<=0 then cuted=cuted&"..." exit for end if cuted=cuted&tt end if next end function
'-----------------------------------随机N位数字------------------------------------- function rand_num(rnum) dim ri,rmax,rmin,rndnum rmax=10^(rnum)-1 rmin=10^(rnum-1) randomize rndnum=int((rmax-rmin+1)*rnd)+rmin for ri=1 to rnum-len(rndnum) rndnum="0"&rndnum next rand_num=rndnum end function
function rand_file(leftvar) dim temp1 temp1="" if var_null(leftvar)<>"" then temp1=left(leftvar,1) rand_file=temp1&time_type(now_time,11)&rand_num(2) end function
private sub class_initialize() now_time=time_type(now(),1) today_time=time_type(now(),4) js_tim="?"&now_time timer_start=timer() pro_edition="Joe"&"koe"&" CM"&"S 1"&".2"&" Free" num_rs=0 js_mod=false isconn=false ishealth=false call own_dir() end sub
'-------------------------------判断发言是否来自外部------------------------------- function post_chk() dim server_v1,server_v2 server_v1=request.servervariables("http_referer") server_v2=request.servervariables("server_name") if server_v1<>"" then 'mid(server_v1,8,len(server_v2))=server_v2 server_v2="http://"&server_v2 if left(server_v1,len(server_v2))=server_v2 then post_chk=true exit function end if end if post_chk=false end function
function chk() chk=false if trim(request.form("chk"))="yes" then chk=post_chk() end if end function
'------------------------------------IP SYS-------------------------------------- function ip_sys(st) '0=ip 1=sys if st=1 then ip_sys=request.servervariables("http_user_agent") exit function end if dim userip,userip2 userip=request.servervariables("http_x_forwarded_for") userip2=request.servervariables("remote_addr") if instr(userip,",")>0 then userip=left(userip,instr(userip,",")-1) if instr(userip2,",")>0 then userip2=left(userip2,instr(userip2,",")-1) if userip="" then ip_sys=userip2 else ip_sys=userip end if end function
sub web_title() dim temp1 temp1="<DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN"">" & _ vbcrlf&"" & _ vbcrlf&"" & _ vbcrlf&"" & _ vbcrlf&""&web_name&" - "&web_tit&"" & _ vbcrlf&"" 'vbcrlf&js_put("style/joekoe_config.js",0) response.write temp1 end sub
function js_put(j_var,j_type) '0 src 1 code select case cint(j_type) case 0 js_put=vbcrlf&"" case 1 js_put=vbcrlf&"" end select end function
function fix_num(f_num,f_type) dim fnum:fnum=f_num if not(isnumeric(fnum)) then fix_num=0:exit function select case f_type case 0 fix_num=int(fnum) case 1 if instr(fnum,".")=0 then fix_num=fnum else fix_num=int(fnum)+1 end if case 2 if instr(fnum,".")=0 then fix_num=fnum else if cint(mid(fnum,instr(fnum,".")+1,1))>=5 then fix_num=int(fnum)+1 else fix_num=int(fnum) end if end if end select end function end class
'**************************************************** ' Joekoe CMS 1.2 Free Power by Joekoe.com ' Email: cms@joekoe.com , service@joekoe.com ' Web: http://www.joekoe.com , http://www.topv.com ' Copyright (C) 2004 Joekoe.com All Rights Reserved. '**************************************************** %>