<% '打开本机SQL SERVER数据库 'set con=server.CreateObject("adodb.connection") 'con.open "driver={sql server};server=127.0.0.1;uid=sa;pwd=;database=Mis" '打开网站SQL SERVER数据库 set conn=server.CreateObject("adodb.connection") conn.open "driver={sql server};server=192.168.10.13;UID=asdf2xcvb;PWD=nskq$op^aka&ksj&aiA@QPALCX^MNI*Ujsiqjhui;database=fqdb;min pool size=250;max pool size=350;" 'conn.open "driver={sql server};server=192.168.10.13;UID=asdf2xcvb;PWD=Ujsiqjhui;database=fqdb;min pool size=250;max pool size=350;" '调整最小连接数和最大连接数 '打开ACCESS数据库 ' dim con,connstr ' connstr="DBQ="+server.mappath("db/mydb.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" ' set con=server.createobject("ADODB.CONNECTION") ' con.open connstr,1,1 %> <% function checkstr(num,n) select case n case 1'数字 if isnull(num)=false and isnumeric(num)=true then checkstr=int(num) else checkstr=0 end if case 2'字符 if isnull(num)=false and num<>"" then checkstr=Replace(Replace(Replace(Replace(Trim(num)," ",""), "'", ""), Chr(34), ""), ";", "") else checkstr="" end if case 3'检索条件 checkstr=Replace(Replace(Replace(Replace(Trim(num)," "," "), "'", "´"), Chr(34), """),vbcrlf,"
") case 4'替换 StrC = Replace(num,vbcrlf,"
") StrNl = replace(StrC," ","  ") checkstr=StrNl case 5 StrC = Replace(num,"
",vbcrlf) StrNl = replace(StrC,"  "," ") checkstr=StrNl case 6 if isnull(num)=false and isnumeric(num)=true then checkstr=cDbl(num) else checkstr=0 end if case 7 if isnull(num)=false and isnumeric(num)=true then checkstr=int(num*100)/100 else checkstr=0 end if end select end function '检查以,分隔的id字符串 function checkIdStr(str) set re = new Regexp re.pattern = "^(\d|\,)*$" if re.test(str)=true then checkIdStr = true else checkIdStr = false end function '写邮件发送日志 function maillog(msg) on error resume next set fso=Server.CreateObject("Scripting.FileSystemObject") set f=fso.OpenTextFile(Server.MapPath("/logs/mail.log"),8,true) f.write now() & " " & Request.ServerVariables("SCRIPT_NAME") & " " & msg & chr(13) & chr(10) f.Close set f=Nothing set fso=Nothing on error goto 0 end function '''''''''根据讲、课、班构造加密的用于下载的文件名的前半部分 function encode(ke,ban,jiang) n1=getRand str=n1^2 & "." & ke*(n1+3) & "." & ban*(n1+8) & "." & jiang*(n1+14) str1="" for i_encode=1 to len(str) str1=str1 & ASC(mid(str,i_encode,1)) next encode=str1 end function ''''''''得到一个10-99的随机数 function getRand() Randomize getRand=Int((99 - 10 + 1) * Rnd + 10) end function ''''''''针对encode函数的解密函数 function decode(str) on error resume next str1="" for i_decode=1 to len(str) step 2 str1=str1 & Chr(mid(str,i_decode,2)) next ns=split(str1,".") n0=sqr(ns(0)) n1=ns(1)/(n0+3) n2=ns(2)/(n0+8) n3=ns(3)/(n0+14) decode=n1 & "." & n2 & "." & n3 if err.number<>0 then Response.write("参数错误") Response.End end if end function '* 改变试题所在的试卷/作业题的总分数及及格分 Function ChangeSum(strID) dim rstTest,rstExam,strSql,intSum,intRight,sngPercent set rstTest=server.CreateObject("adodb.recordset") strSql="Select Top 1 allnum,rightnum,question from TestPage " strSql=strSql & "Where (question LIKE '%" & strID & ",%') OR (question LIKE '%," & strID & "%')" rstTest.open strSql,conn,1,3 '* 没有加入此题的试卷则退出 if (rstTest.eof or rstTest.bof) then exit function set rstExam=server.CreateObject("adodb.recordset") strSql="Select Sum(num) from ExamMain Where ID In (" & rstTest("question") & ")" rstExam.open strSql,conn,3 if (rstExam.eof or rstExam.bof) then exit function intSum=Round(rstExam(0)/2) '* 得到总分数 sngPercent=rstTest("rightnum")/rstTest("allnum") '* 计算及格分数的百分比 intRight=Round(intSum*sngPercent) '* 得到及格分数 '* 设置新的总分数和及格分 rstTest("allnum")=intSum rstTest("rightnum")=intRight rstTest.update if not (rstTest is nothing) then rstTest.close set rstTest=nothing end if if not (rstExam is nothing) then rstExam.close set rstExam=nothing end if End Function '判断是否包含中文字符 function isChinese(str) strlist="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_+-*/@#%&" for i=1 to len(str) if instr(strlist,mid(str,i,1))=0 then isChinese=true exit for else isChinese=false end if next end function '把中文数字转换成阿拉伯数字 function ChinesetoNum(str) strlist1="1234567890-" strlist2="壹贰叁肆伍陆柒捌玖零" strlist3="一二三四五六七八九" numlist="1234567890-" tempstr="" for i=1 to len(str) n=0 n=instr(strlist1,mid(str,i,1)) if n=0 then n=instr(strlist2,mid(str,i,1)) if n=0 then n=instr(strlist3,mid(str,i,1)) if n>0 then tempstr=tempstr&mid(numlist,n,1) else tempstr=tempstr&mid(str,i,1) next ChinesetoNum=tempstr end function Function ReplaceSaveRemoteFile(ConStr,strInstallDir,SaveTf,TistUrl) If ConStr="$False$" or ConStr="" or strInstallDir="" Then ReplaceSaveRemoteFile=ConStr Exit Function End If Dim TempStr,TempStr2,TempStr3,Re,Matches,Match,Tempi,TempArray,TempArray2 Set Re = New Regexp Re.IgnoreCase = True Re.Global = True Re.Pattern ="]>" Set Matches =Re.Execute(ConStr) For Each Match in Matches If TempStr<>"" then TempStr=TempStr & "$Array$" & Match.Value Else TempStr=Match.Value End if Next If TempStr<>"" Then TempArray=Split(TempStr,"$Array$") TempStr="" For Tempi=0 To Ubound(TempArray) Re.Pattern ="src\s*=\s*.+?\.(gif|jpg|bmp|jpeg|psd|png|svg|dxf|wmf|tiff)" Set Matches =Re.Execute(TempArray(Tempi)) For Each Match in Matches If TempStr<>"" then TempStr=TempStr & "$Array$" & Match.Value Else TempStr=Match.Value End if Next Next End if If TempStr<>"" Then Re.Pattern ="src\s*=\s*" TempStr=Re.Replace(TempStr,"") End If Set Matches=Nothing Set Re=Nothing If TempStr="" or IsNull(TempStr)=True Then ReplaceSaveRemoteFile=ConStr Exit function End if TempStr=Replace(TempStr,"""","") TempStr=Replace(TempStr,"'","") TempStr=Replace(TempStr," ","") ' ' response.write TempStr ' response.End() ' Dim RemoteFileurl,SavePath,PathTemp,DtNow,strFileName,strFileType,ArrSaveFileName,RanNum,Arr_Path DtNow=Now() If SaveTf=True then SavePath=strInstallDir'Cl.UpLoadDir & "Editor/" & year(DtNow) &"-"& month(DtNow) & "/" ' Arr_Path=Split(SavePath,"/") ' PathTemp="" ' For Tempi=0 To Ubound(Arr_Path) ' If Tempi=0 Then ' PathTemp=Arr_Path(0) & "/" ' ElseIf Tempi=Ubound(Arr_Path) Then ' Exit For ' Else ' PathTemp=PathTemp & Arr_Path(Tempi) & "/" ' End If ' 'If CheckDir(PathTemp)=False Then ' ' If MakeNewsDir(PathTemp)=False Then ' ' SaveTf=False ' ' Exit For ' ' End If ' 'End If ' Next End If '去掉重复图片开始 TempArray=Split(TempStr,"$Array$") TempStr="" For Tempi=0 To Ubound(TempArray) If Instr(Lcase(TempStr),Lcase(TempArray(Tempi)))<1 Then TempStr=TempStr & "$Array$" & TempArray(Tempi) End If Next TempStr=Right(TempStr,Len(TempStr)-7) TempArray=Split(TempStr,"$Array$") '去掉重复图片结束 '转换相对图片地址开始 TempStr="" For Tempi=0 To Ubound(TempArray) TempStr=TempStr & "$Array$" & TempArray(Tempi) 'DefiniteUrl(TempArray(Tempi),TistUrl) Next TempStr=Right(TempStr,Len(TempStr)-7) TempStr=Replace(TempStr,Chr(0),"") TempArray2=Split(TempStr,"$Array$") ' ' response.write TempStr ' response.End() ' TempStr="" '转换相对图片地址结束 '图片替换/保存 Set Re = New Regexp Re.IgnoreCase = True Re.Global = True For Tempi=0 To Ubound(TempArray2) RemoteFileUrl=TempArray2(Tempi) If RemoteFileUrl<>"$False$" And SaveTf=True Then'保存图片 ArrSaveFileName = Split(RemoteFileurl,".") strFileType=Lcase(ArrSaveFileName(Ubound(ArrSaveFileName)))'文件类型 If strFileType="asp" or strFileType="asa" or strFileType="aspx" or strFileType="cer" or strFileType="cdx" or strFileType="exe" or strFileType="rar" or strFileType="zip" then UploadFiles="" ReplaceSaveRemoteFile=ConStr Exit Function End If Randomize RanNum=Int(900*Rnd)+100 strFileName = year(DtNow) & right("0" & month(DtNow),2) & right("0" & day(DtNow),2) & right("0" & hour(DtNow),2) & right("0" & minute(DtNow),2) & right("0" & second(DtNow),2) & ranNum & "." & strFileType Re.Pattern =TempArray(Tempi) If SaveRemoteFile(SavePath & strFileName,RemoteFileUrl)=True Then PathTemp=Replace(SavePath &strFileName,"{%uploaddir%}","/") ConStr=Re.Replace(ConStr,PathTemp) Re.Pattern=strInstallDir & "/" UploadFiles=UploadFiles & "|" & Re.Replace(SavePath &strFileName,"") Else PathTemp=RemoteFileUrl ConStr=Re.Replace(ConStr,PathTemp) 'UploadFiles=UploadFiles & "|" & RemoteFileUrl End If ElseIf RemoteFileurl<>"$False$" and SaveTf=False Then'不保存图片 Re.Pattern =TempArray(Tempi) ConStr=Re.Replace(ConStr,RemoteFileUrl) UploadFiles=UploadFiles & "|" & RemoteFileUrl End If Next Set Re=Nothing If UploadFiles<>"" Then UploadFiles=Right(UploadFiles,Len(UploadFiles)-1) End If ReplaceSaveRemoteFile=ConStr End function Function SaveRemoteFile(LocalFileName,RemoteFileUrl) SaveRemoteFile=True dim Ads,Retrieval,GetRemoteData On Error Resume Next Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP") With Retrieval .Open "post", "/editor/upload.asp?action=save", False '.setRequestHeader "Content-type","application/x-www-form-urlencoded" .Send RemoteFileUrl response.write RemoteFileUrl response.End() If .Readystate<>4 then SaveRemoteFile=False Exit Function End If 'GetRemoteData = .ResponseBody End With Set Retrieval = Nothing end Function %> <% function showtime(stime,n) if isdate(stime)=true then select case n case 1'yy-mm-dd showtime=right(year(stime),2)&"-"&month(stime)&"-"&day(stime) case 2'mm-dd showtime=month(stime)&"-"&day(stime) case 3'mm/dd showtime=month(stime)&"/"&day(stime) case 4'hh:mm showtime=hour(stime)&":"&minute(stime) case 5'yy-mm-dd hh:mm showtime=right(year(stime),2)&"-"&month(stime)&"-"&day(stime)&" "&hour(stime)&":"&minute(stime) case 6'hh点mm分ss秒 showtime=hour(stime)&"点"&minute(stime)&"分"&Second(stime)&"秒" case 7'hh点mm分 showtime=hour(stime)&"点"&minute(stime)&"分" case 8'mm分ss秒 showtime=minute(stime)&"分"&Second(stime)&"秒" case 9'yyyy.mm.dd showtime=year(stime)&"."&month(stime)&"."&day(stime) case 10'yyyy年mm月dd日 showtime=formatdatetime(stime,vblongdate) case 11 showtime=month(stime)&"-"&day(stime)&" "&hour(stime)&":"&minute(stime) case 12 'yyyy年mm月dd日 hh:mm,月日等不足2位,前面补足0 showtime=year(stime)&"-"&right("0"&month(stime),2)&"-"&right("0"&day(stime),2)&" "&right("0"&hour(stime),2)&":"&right("0"&minute(stime),2) case 13'yyyyy-mm-dd showtime=right(year(stime),4)&"-"&month(stime)&"-"&day(stime) end select else response.Write "错误的日期" end if end function function showstr(str,n) str1=left(trim(str),n) if len(str)>n then str2="..." showstr=str1&str2 end function function showlessonname(lesson_id) if IsNumeric(lesson_id)=true then set l_rs=server.CreateObject("adodb.recordset") l_sql="select lesson from lessonset where lesson_id="&lesson_id&"" l_rs.open l_sql,conn,3 if not(l_rs.bof or l_rs.eof) then showlessonname=l_rs("lesson") else showlessonname="错误的课程名"&lesson_id&"" l_rs.close set l_rs=nothing else showlessonname="错误的课程名"&lesson_id&"" end if end function function showlessondown(class_id) if IsNumeric(class_id)=true then set l_rs=server.CreateObject("adodb.recordset") l_sql="select lesson from lessonset where lesson_id=(select lesson_id from classset where class_id="&class_id&")" l_rs.open l_sql,conn,3 if not(l_rs.bof or l_rs.eof) then showlessondown=l_rs("lesson") else showlessondown="错误的课程名"&class_id&"" l_rs.close set l_rs=nothing else showlessondown="错误的课程名"&class_id&"" end if end function function showclassname(classnum) dim sql,rs select case classnum case 1 showclassname="精讲班" case 2 select case up_id 'case 564:showclassname="习题班" 'case 731:showclassname="习题班" 'case 565:showclassname="习题班" 'case 586:showclassname="习题班" 'case 567:showclassname="习题班" 'case 889:showclassname="习题班" 'case 775:showclassname="习题班" 'case 660:showclassname="习题班" 'case 568:showclassname="习题班" case 700:showclassname="模考班" 'case 825:showclassname="考题预测班" 'case 1091:showclassname="考题预测班" case else:showclassname="串讲班" end select case 3 showclassname="冲刺班" case 4 showclassname="基础班" case 5 showclassname="习题班" case 6 showclassname="模考班" case 7 showclassname="保过班" case 8 showclassname="面授班" case 9 showclassname="面授强化班" case 10 showclassname="面授点题班" case 11 showclassname="海淀面授班" case 12 showclassname="朝阳面授班" case 13 showclassname="精华班" case 14 showclassname="真题解析班" case 15 showclassname="实验班" case 16 showclassname="面授VIP班" case 17 showclassname="法条班" case 18 showclassname="真题班" case 19 showclassname="全程班" case 20 showclassname="考题预测班" case 21 showclassname="单项班" case 22 showclassname="模块班" case 23 showclassname="现场班" case else sql="select class_type_name from hqfs_class_type where classnum=" & classnum set rs=server.CreateObject("adodb.recordset") rs.open sql,conn,3 if not(rs.eof and rs.bof) then showclassname=rs("class_type_name") end if end select end function function showclassnum(class_id) if IsNumeric(class_id)=true then set l_rs=server.CreateObject("adodb.recordset") l_sql="select classnum from classset where class_id="&class_id&"" l_rs.open l_sql,conn,3 if not(l_rs.bof or l_rs.eof) then showclassnum=showclassname(l_rs("classnum")) else showclassnum="错误的班别名"&class_id&"" l_rs.close set l_rs=nothing else showclassnum="错误的班别名"&class_id&"" end if end function function showchinesenum(num) if IsNumeric(num)=true then n=num\100 x=num\10 y=num mod 10 select case y case 1 sstr="一" case 2 sstr="二" case 3 sstr="三" case 4 sstr="四" case 5 sstr="五" case 6 sstr="六" case 7 sstr="七" case 8 sstr="八" case 9 sstr="九" end select if x>=10 then x=x mod 10 select case x case 1 tstr="十" case 2 tstr="二十" case 3 tstr="三十" case 4 tstr="四十" case 5 tstr="五十" case 6 tstr="六十" case 7 tstr="七十" case 8 tstr="八十" case 9 tstr="九十" case 0 if n>=1 and y>0 then tstr="零" end select select case n case 1 hstr="一百" case 2 hstr="二百" case 3 hstr="三百" case 4 hstr="四百" case 5 hstr="五百" case 6 hstr="六百" case 7 hstr="七百" case 8 hstr="八百" case 9 hstr="九百" end select showchinesenum=hstr&tstr&sstr end if end function function showcataid(num) select case num case 1 showcataid="考试" case 2 showcataid="作业" case 3 showcataid="练习" end select end function function showusername(user_id) if IsNumeric(user_id)=true then set u_rs=server.CreateObject("adodb.recordset") u_sql="select username from edu_userinfo where id="&user_id&"" u_rs.Open u_sql,conn,3 if not(u_rs.EOF or u_rs.BOF) then showusername=u_rs("username") u_rs.Close set u_rs=nothing end if end function function showpassword(user_id) if IsNumeric(user_id)=true then set u_rs=server.CreateObject("adodb.recordset") u_sql="select password from edu_userinfo where id="&user_id&"" u_rs.Open u_sql,conn,3 if not(u_rs.EOF or u_rs.BOF) then showpassword=u_rs("password") u_rs.Close set u_rs=nothing end if end function function show_r_name(user_id) if IsNumeric(user_id)=true then set u_rs=server.CreateObject("adodb.recordset") u_sql="select username from edu_userinfo where id="&user_id&"" u_rs.Open u_sql,conn,3 if not(u_rs.EOF or u_rs.BOF) then show_r_name=u_rs("username") u_rs.Close set u_rs=nothing end if end function function show_r_money(user_id) if IsNumeric(user_id)=true and user_id<>0 then set u_rs=server.CreateObject("adodb.recordset") u_sql="select r_money from edu_userinfo where id="&user_id&"" u_rs.Open u_sql,conn,3 if not(u_rs.EOF or u_rs.BOF) then show_r_money=u_rs("r_money") u_rs.Close set u_rs=nothing end if end function function show_admin_name(id) if(id<>"" and isNumeric(id) and id<>0) then sql = "select name from admin where id="&id set rs_getuser = conn.execute(sql) if not(rs_getuser.bof or rs_getuser.eof) then show_admin_name=rs_getuser(0) end if end function %> <% nscid=checkstr(request("nscid"),1) tid=checkstr(request("tid"),1) uid=checkstr(request("uid"),1) if nscid>0 then content=content & " and subchild=" &nscid if tid>0 then content=content&" and lesson_top="&tid&"" if uid>0 then content=content&" and lesson_up="&uid&"" set rs=server.CreateObject("adodb.recordset") if nscid>0 then sql="select title from edu_cataid where id="&nscid&" and isshow=1" rs.open sql,conn,3 if not(rs.bof or rs.eof) then classname=replace(replace(replace(rs("title"),"历年试题","历年真题"),"考试文件","政策法规"),"复习方法","备考经验") rs.close end if if oid<>0 then rs.open "select title from edu_cataid where id="&oid&" and isshow=1",conn,3 if not(rs.bof or rs.eof) then classname2=rs("title") end if %> 造价员考试动态页
您现在的位置:环球网校 >> 造价员 >> <%=classname%>