char.asp
上传用户:comthink
上传日期:2021-05-06
资源大小:1280k
文件大小:10k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

HTML/CSS

  1. <%
  2. Rem ==========通用函数设定=========
  3. '页面错误提示信息
  4. sub txl_error()
  5. %>
  6. <table width="<%=txl_body(0)%>" cellpadding="0" cellspacing="0" align="center" style="border:1px <%=txl_body(9)%> solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 1px;">  
  7. <tr> 
  8. <td  bgcolor=<%=txl_body(10)%>><br>
  9. <table cellpadding=3 cellspacing=1 align=center class=tableborder1 style="width:75%">
  10. <tr>
  11. <th width="100%" height=25 colspan=2  align=center>同学录错误信息</th>
  12. </tr>
  13. <tr>
  14. <td width="100%" class=tablebody1 colspan=2><b>产生错误的可能原因:</b><br><br>
  15. <li>您是否仔细阅读了<a href="help.asp">帮助文件</a>,可能您还没有登陆或者不具有使用当前功能的权限。
  16. <%=errmsg%></td>
  17. </tr>
  18. <tr>
  19. <td class=tablebody2 valign=middle colspan=2 align=center><a href="<%=Request.ServerVariables("HTTP_REFERER")%>"><<返回上一页</a></td>
  20. </tr>
  21. </table><br>
  22. </td>
  23. </tr>
  24. </table>
  25. <%
  26. end sub
  27. sub txl_suc()
  28. %>
  29. <table width="<%=txl_body(0)%>" cellpadding="0" cellspacing="0" align="center" style="border:1px <%=txl_body(9)%> solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 1px;">  
  30. <tr> 
  31. <td  bgcolor=<%=txl_body(10)%>><br>
  32. <table cellpadding=3 cellspacing=1 align=center class=tableborder1 style="width:75%">
  33. <tr>
  34. <th height=25 width="100%" align=center>同学录成功信息</th>
  35. </tr>
  36. <tr>
  37. <td width="100%" class=tablebody1><b>操作成功:</b><br><br><%=sucmsg%></td>
  38. </tr>
  39. <tr align=center>
  40. <td width="100%" class=tablebody2><a href="<%=Request.ServerVariables("HTTP_REFERER")%>"> << 返回上一页</a></td>
  41. </tr>
  42. </table><br>
  43. </td>
  44. </tr>
  45. </table>
  46. <%
  47. end sub
  48. rem 过滤BadWord字符
  49. function ChkBadWords(fString)
  50.     dim bwords,ii
  51.     if not(isnull(BadWords) or isnull(fString)) then
  52.     bwords = split(BadWords, "|")
  53.     for ii = 0 to ubound(bwords)
  54.         fString = Replace(fString, bwords(ii), string(len(bwords(ii)),"*")) 
  55.     next
  56.     ChkBadWords = fString
  57.     end if
  58. end function
  59. Rem 过滤HTML代码
  60. function HTMLEncode(fString)
  61. if not isnull(fString) then
  62.     fString = replace(fString, ">", "&gt;")
  63.     fString = replace(fString, "<", "&lt;")
  64.     fString = Replace(fString, CHR(32), "&nbsp;")
  65.     fString = Replace(fString, CHR(9), "&nbsp;")
  66.     fString = Replace(fString, CHR(34), "&quot;")
  67.     fString = Replace(fString, CHR(39), "&#39;")
  68.     fString = Replace(fString, CHR(13), "")
  69.     fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
  70.     fString = Replace(fString, CHR(10), "<BR> ")
  71.     fString=ChkBadWords(fString)
  72.     HTMLEncode = fString
  73. end if
  74. end function
  75. Rem 过滤表单字符
  76. function HTMLcode(fString)
  77. if not isnull(fString) then
  78.     fString = Replace(fString, CHR(13), "")
  79.     fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
  80.     fString = Replace(fString, CHR(10), "<BR>")
  81.     HTMLcode = fString
  82. end if
  83. end function
  84. Rem 判断是否来自外部
  85. function ChkPost()
  86. dim server_v1,server_v2
  87. chkpost=false
  88. server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
  89. server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
  90. if mid(server_v1,8,len(server_v2))<>server_v2 then
  91. chkpost=false
  92. else
  93. chkpost=true
  94. end if
  95. end function
  96. Rem 判断用户来源
  97. function address(sip)
  98. dim str1,str2,str3,str4
  99. dim num
  100. dim country,city
  101. dim irs
  102. if isnumeric(left(sip,2)) then
  103. if sip="127.0.0.1" then sip="192.168.0.1"
  104. str1=left(sip,instr(sip,".")-1)
  105. sip=mid(sip,instr(sip,".")+1)
  106. str2=left(sip,instr(sip,".")-1)
  107. sip=mid(sip,instr(sip,".")+1)
  108. str3=left(sip,instr(sip,".")-1)
  109. str4=mid(sip,instr(sip,".")+1)
  110. if isNumeric(str1)=0 or isNumeric(str2)=0 or isNumeric(str3)=0 or isNumeric(str4)=0 then
  111. else
  112. num=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
  113. sql="select Top 1 country,city from address where ip1 <="&num&" and ip2 >="&num&""
  114. set irs=server.createobject("adodb.recordset")
  115. irs.open sql,conn,1,1
  116. if irs.eof and irs.bof then 
  117. country="亚洲"
  118. city=""
  119. else
  120. country=irs(0)
  121. city=irs(1)
  122. end if
  123. irs.close
  124. set irs=nothing
  125. end if
  126. address=country&city
  127. else
  128. address="未知"
  129. end if
  130. end function
  131. function iif(expression,returntrue,returnfalse)
  132. if expression=0 then
  133. iif=returnfalse
  134. else
  135. iif=returntrue
  136. end if
  137. end function
  138. function iiif(express,expression,returntrue,returnfalse)
  139. if express>expression then
  140. iiif=returnfalse
  141. else
  142. iiif=returntrue
  143. end if
  144. end function
  145. function iimg(expression,returnfalse,returntrue)
  146. if expression="" or isnull(expression) then
  147. iimg=returnfalse
  148. else
  149. iimg=returntrue
  150. end if
  151. end function
  152. Rem 过滤SQL非法字符
  153. function checkStr(str)
  154. if isnull(str) then
  155. checkStr = ""
  156. exit function 
  157. end if
  158. checkStr=replace(str,"'","''")
  159. end function
  160. Rem 用户在线
  161. sub foot()
  162. endtime=timer()
  163. %>
  164. <table width="<%=txl_body(0)%>" cellpadding="0" cellspacing="0" align="center" style="border:1px <%=txl_body(9)%> solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px;">
  165.   <tr> 
  166.     <td width="<%=txl_body(0)%>" height="32" background="<%=txl_info(7)%>bj.gif"> </td>
  167.   </tr>
  168.   <tr> 
  169.     <td width="<%=txl_body(0)%>" bgcolor="<%=txl_body(9)%>"><%=txl_body(24)%></td>
  170.   </tr>
  171.   <tr>
  172.     <td width="<%=txl_body(0)%>" height="50" align=center bgcolor="<%=txl_body(10)%>"><%=Version%><br><%=Copyright%> , 页面执行时间:<%=FormatNumber((endtime-startime)*1000,3)%>毫秒</td>
  173.   </tr>
  174. </table>
  175. </body>
  176. </html>
  177. <%
  178. CloseDatabase
  179. end sub
  180. sub head()
  181. %>
  182. <html>
  183. <head>
  184. <META http-equiv=Content-Type content=text/html; charset=gb2312>
  185. <meta name=keywords content="霸州一中,luobo">
  186. <title><%=txl_info(0)%>--<%=htmlencode(stats)%></title>
  187. <!--#include file="txl_css.asp"-->
  188. <!--#include file="txl_js.asp"-->
  189. </head>
  190. <body topmargin=0 onmousemove="HideMenu()">
  191. <div id=menuDiv style='Z-INDEX: 2; VISIBILITY: hidden; WIDTH: 1px; POSITION: absolute; HEIGHT: 1px; BACKGROUND-COLOR: #9cc5f8'></div>
  192. <table width="<%=txl_body(0)%>" cellpadding="0" cellspacing="0" align="center" style="border:1px <%=txl_body(9)%> solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 1px;">  
  193.   <tr> 
  194.     <td width="<%=txl_body(0)%>"><%=txl_body(22)%></td>
  195.   </tr>
  196.   <tr> 
  197.     <td width="<%=txl_body(0)%>" height="9" background=<%=txl_info(6)&txl_skinpic(0)%>></td>
  198.   </tr>
  199.   <tr> 
  200.     <td width="780" height="22" background=<%=txl_info(6)&txl_skinpic(1)%>>&nbsp;&nbsp;
  201. <%if not founduser then%>
  202. <a href="login.asp">登陆</a> <img src=<%=txl_info(7)%>spacer.gif align=absmiddle> 
  203. <a href="register.asp">注册</a> <img src=<%=txl_info(7)%>spacer.gif align=absmiddle> 
  204. <%end if%>
  205. <a href="index.asp">班级首页</a> <img src=<%=txl_info(7)%>spacer.gif align=absmiddle> <a
  206.    href="g_index.asp" onMouseOver='ShowMenu(gbooklist,80)'>班级留言</a> <img src=<%=txl_info(7)%>spacer.gif align=absmiddle> <a
  207.    href="b_index.asp" onMouseOver='ShowMenu(bbslist,80)'>班级论坛</a> <img src=<%=txl_info(7)%>spacer.gif align=absmiddle> <a
  208.    href="p_index.asp" onMouseOver='ShowMenu(photolist,80)'>班级相册</a> <img src=<%=txl_info(7)%>spacer.gif align=absmiddle> <a
  209.    href="c_index.asp" onMouseOver='ShowMenu(cardlist,80)'>班级名片</a> <img src=<%=txl_info(7)%>spacer.gif align=absmiddle> <a
  210.    href="u_index.asp" onMouseOver='ShowMenu(userlist,80)'>个人菜单</a> <img src=<%=txl_info(7)%>spacer.gif align=absmiddle> 
  211. <a target="_blank" href="chat/index.htm">聊天室</a> <img src=<%=txl_info(7)%>spacer.gif align=absmiddle> 
  212. <a href="help.asp">在线帮助</a> 
  213. <%if supermaster then%>
  214.  <img src=<%=txl_info(7)%>spacer.gif align=absmiddle> <a href="admin_index.asp">管理</a>
  215. <%end if%>
  216. <%if founduser then%>
  217.  <img src=<%=txl_info(7)%>spacer.gif align=absmiddle>  <a href="logout.asp">退出</a> </td>
  218. <%end if%>
  219.   </tr>
  220. </table>
  221. <%
  222. if Cint(GroupSetting(0))=1 and (instr(scriptname,"register.asp")=0 and instr(scriptname,"login.asp")=0) then
  223. Errmsg=Errmsg+"<br>"+"<li>您没有浏览本同学录的权限,请<a href=login.asp>登陆</a>后浏览或者同管理员联系。"
  224. call head_var("错误信息","")
  225. call txl_error()
  226. call foot()
  227. response.end
  228. end if
  229. end sub
  230. sub head_var(GetTitle,GetUrl)
  231. %>
  232. <table width="<%=txl_body(0)%>" cellpadding=3 cellspacing=0 align=center style="border:1px <%=txl_body(9)%> solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 1px;"> 
  233. <tr>
  234. <td height=30 valign=middle bgcolor=<%=txl_body(10)%>> <img src=<%=txl_info(7)%>dot01.gif border=0> <a href=index.asp>班级首页</a> → <a href=<%=GetUrl%>><%=GetTitle%></a> → <%=HTMLEncode(stats)%></td>
  235. </tr>
  236. </table>
  237. <%
  238. end sub
  239. '统计短信
  240. function newincept()
  241. rs=conn.execute("Select Count(id) From Message Where flag=0 and issend=1 and delR=0 And incept='"& membername &"'")
  242.     newincept=rs(0)
  243. set rs=nothing
  244. if isnull(newincept) then newincept=0
  245. end function
  246. function inceptid(stype)
  247. set rs=conn.execute("Select top 1 id,sender From Message Where flag=0 and issend=1 and delR=0 And incept='"& membername &"'")
  248. if stype=1 then
  249. inceptid=rs(0)
  250. else
  251. inceptid=rs(1)
  252. end if
  253. set rs=nothing
  254. end function
  255. Rem 判断数字是否整形
  256. function isInteger(para)
  257.        on error resume next
  258.        dim str
  259.        dim l,i
  260.        if isNUll(para) then 
  261.           isInteger=false
  262.           exit function
  263.        end if
  264.        str=cstr(para)
  265.        if trim(str)="" then
  266.           isInteger=false
  267.           exit function
  268.        end if
  269.        l=len(str)
  270.        for i=1 to l
  271.            if mid(str,i,1)>"9" or mid(str,i,1)<"0" then
  272.               isInteger=false 
  273.               exit function
  274.            end if
  275.        next
  276.        isInteger=true
  277.        if err.number<>0 then err.clear
  278. end function
  279. %>