functions.asp

来自「是个不错的文件代码,希望大家好好用,」· ASP 代码 · 共 371 行

ASP
371
字号
<%
'****************************************************
' 玫瑰情缘 2006v3.0      power by www.meigui8.cn
' email: 556248@qq.com  , 100053555@qq.com
' web: http://www.meigui8.cn
' copyright (c) 2006 meigui8.cn all rights reserved.
'****************************************************
'================================================
'作  用:查看用户信息
'参  数:
'	uuser : 用户名称
'	ut    : 是否弹出窗口显示
'   un    : 是否对用户名称进行截取
'================================================
function format_user_view(uuser,ut,un)
  if var_null(uuser)="" then
    format_user_view="<font class=gray>-----</font>"
    exit function
  end if
  dim uname
  uname=uuser
  if un=1 then uname=joekoe_cms.cuted(uuser,5)
  format_user_view="<a href='user_view.asp?username="&server.urlencode(uuser)&"' alt='查看 "&uuser&" 的详细资料'"
  if ut=1 then format_user_view=format_user_view&" target=_blank"
  format_user_view=format_user_view&">"&uname&"</a>"
end function

'================================================
'作  用:查看用户信息
'参  数:
'	varss : 用户名称
'	ctt   : 是否对用户名称进行截取
'   ct    : 名称显示颜色标记
'================================================
function format_user_name(varss,ctt,ct)
  dim cnum,vars,classt
  cnum=5
  if int(ctt)=0 then cnum=0
  vars=varss
  if var_null(vars)="" then
    format_user_name="<font class=gray>-----</font>"
    exit function
  end if
  if var_null(ct)<>"" and ct<>"" then classt=" class="&ct
  format_user_name="<a href='user_view.asp?username="&server.urlencode(vars)&"' alt='查看 "&vars&" 的详细资料' target=_blank"&classt&">"&joekoe_cms.code_html(vars,1,cnum)&"</a>"
end function

'================================================
'作  用:定义用户图像
'参  数:
'	f_vars: 图像地址
'	f_w   : 图像宽度
'   f_h   : 图像高度
'================================================
function format_user_face(f_vars,f_w,f_h)
  if var_null(f_vars)="" or f_vars="" then
    format_user_face="images/face/0.gif"
    exit function
  end if
  format_user_face="<img src='"&f_vars&"' border=0 width="&f_w&" height="&f_h&">"
end function

'================================================
'作  用:推荐信息给好友
'参  数:
'	t1: 信息分类
'	t2: 信息主题
'   t3: 信息链接地址
'================================================
function commend_friend(t1,t2,t3)
  commend_friend="<a href='javascript:;' onclick=""javascript:open_win('commend.asp?nsort="&server.urlencode(t1)&"&topic="&server.urlencode(t2)&"&url="&server.urlencode(t3)&"','commend',500,380,'no');"">→&nbsp;推荐给我的好友</a>"
end function

'================================================
'作  用:举报错误信息与链接
'参  数:
'	t1: 信息分类
'	t2: 信息主题
'   t3: 报错信息编号
'	t4: 报错信息分类
'   t5: 信息链接地址
'================================================
function commend_err(t1,t2,t3,t4,t5)
  commend_err="<a href='javascript:;' onclick=""javascript:open_win('err.asp?nsort="&server.urlencode(t1)&"&topic="&server.urlencode(t2)&"&eid="&server.urlencode(t3)&"&n_sort="&server.urlencode(t4)&"&url="&server.urlencode(t5)&"','commend',500,325,'no');"">→&nbsp;报告错误链接</a>"
end function

'================================================
'作  用:定义网站图片
'参  数:
'	snum: 图片名称前缀
'================================================
function img_small(snum)
  img_small="<img border=0 src='images/small/"&snum&".gif' align=absmiddle>&nbsp;"
end function

function img_skin(snum)
  img_skin="<img border=0 src='"&joekoe_cms.web_dir_skin&"small/"&snum&".gif' align=absmiddle>&nbsp;"
end function

'================================================
'作  用:定义网站em贴图
'参  数:
'	em_frm : 写入方式
'	em_word: 写入位置
'================================================
function jk_em(em_frm,em_word)
  dim temp1,j
  for j=0 to 15
    temp1=temp1&"<img src='"&joekoe_cms.web_dir&"images/icon/em"&(j+1)&".gif' border=0 align=absmiddle onclick=""javascript:jk_insert_em('[em"&(j+1)&"]','"&em_frm&"','"&em_word&"');"" style=""cursor: hand"">&nbsp;&nbsp;"
  next
  temp1=temp1&"&nbsp;&nbsp;<font class=gray>[&nbsp;<a href='###' onclick=""javascript:open_win('em.asp?"&em_frm&","&em_word&",em','em',300,360,'no');"">更多em贴图…</a>&nbsp;]</font>"
  jk_em=temp1
end function

'================================================
'作  用:定义网站随机表情
'参  数:
'	inum : 首选表情图片名称前缀
'================================================
function jk_icon(inum)
  dim temp1,j
  for j=0 to 9
    temp1=temp1&"<img border=0 src='"&joekoe_cms.web_dir&"images/icon/"&j&".gif'>&nbsp;<input class=bg_td type=radio value='"&j&"' name=icon"
    if int(inum)=int(j) then temp1=temp1&" checked"
    temp1=temp1&">&nbsp;"
  next
  jk_icon=temp1
end function

'================================================
'作  用:定义商城购物虚拟币支付
'参  数:
'	p_emoney: 商品虚拟币支付价格
'	p_nsort : 商品分类
'   p_id    : 商品编号
'	put     : 是否可以使用虚拟币支付
'================================================
function note_emoney_pay(p_emoney,p_nsort,p_id,put)
  dim tmp1
  if int(p_emoney)>0 then
    tmp1="<a href='emoney_pay.asp?nsort="&p_nsort&"&id="&p_id&"' target=_blank><img src='"&joekoe_cms.web_dir_skin&"small/emoney.gif' border=0 width=14 alt='"&joekoe_cms.web_unit&"支付' align=absmiddle></a>&nbsp;<font class=red2>"&p_emoney&"</font> "&joekoe_cms.web_unit
  else
    tmp1="<img src='"&joekoe_cms.web_dir_skin&"small/emoney.gif' border=0 alt='"&joekoe_cms.web_unit&"支付' align=absmiddle>&nbsp;<font class=gray>不可用</font>"
  end if
  if put=1 then tmp1=tmp1
  note_emoney_pay=tmp1
end function

'================================================
'作  用:虚拟币支付
'参  数:
'	p_is_emoney : 是否可以使用虚拟币支付
'	p_emoney    : 商品虚拟币支付价格
'   p_id        : 商品编号
'================================================
function shop_emoney_pay(p_is_emoney,p_emoney,p_id)
  dim nemoney
  nemoney=0
  if p_is_emoney then nemoney=p_emoney
  shop_emoney_pay=note_emoney_pay(nemoney,n_sort,p_id)
end function

'---------------------------------网站用户图例--------------------------------
function img_user()
  dim a,udim,ui,udim2
  a="网站用户图例:"
  udim=dim_user
  for ui=0 to ubound(udim)
    udim2=split(udim(ui),":")
    a=a&vbcrlf&"&nbsp;<img border=0 src='"&joekoe_cms.web_dir_skin&"small/icon_"&udim2(0)&".gif' align=absmiddle>&nbsp;"&udim2(1)
  next
  a=a&vbcrlf&"&nbsp;<img border=0 src='"&joekoe_cms.web_dir_skin&"small/icon_other.gif' align=absmiddle>&nbsp;游客"
  if isarray(udim) then erase udim
  if isarray(udim2) then erase udim2
  img_user=a
end function

function get_abc(var_s)
  '65-90 a-z
  '97-122 a-z
  '48-58 0-9
  '45 -
  dim tmp,vars:vars=trim(var_s)
  if vars="" or isnull(vars) then get_abc="-":exit function
  vars=left(vars,1)
  tmp=int(asc(vars))
  if tmp>=48 and tmp<=57 then get_abc=vars:exit function
  if (tmp>=65 and tmp<=90) or (tmp>=97 and tmp<=122) then get_abc=ucase(vars):exit function
  tmp=tmp+65536
  if(tmp>=45217 and tmp<=45252) then get_abc="a":exit function
  if(tmp>=45253 and tmp<=45760) then get_abc="b":exit function
  if(tmp>=45761 and tmp<=46317) then get_abc="c":exit function
  if(tmp>=46318 and tmp<=46825) then get_abc="d":exit function
  if(tmp>=46826 and tmp<=47009) then get_abc="e":exit function
  if(tmp>=47010 and tmp<=47296) then get_abc="f":exit function
  if(tmp>=47297 and tmp<=47613) then get_abc="g":exit function
  if(tmp>=47614 and tmp<=48118) then get_abc="h":exit function
  if(tmp>=48119 and tmp<=49061) then get_abc="j":exit function
  if(tmp>=49062 and tmp<=49323) then get_abc="k":exit function
  if(tmp>=49324 and tmp<=49895) then get_abc="l":exit function
  if(tmp>=49896 and tmp<=50370) then get_abc="m":exit function
  if(tmp>=50371 and tmp<=50613) then get_abc="n":exit function
  if(tmp>=50614 and tmp<=50621) then get_abc="o":exit function
  if(tmp>=50622 and tmp<=50905) then get_abc="p":exit function
  if(tmp>=50906 and tmp<=51386) then get_abc="q":exit function
  if(tmp>=51387 and tmp<=51445) then get_abc="r":exit function
  if(tmp>=51446 and tmp<=52217) then get_abc="s":exit function
  if(tmp>=52218 and tmp<=52697) then get_abc="t":exit function
  if(tmp>=52698 and tmp<=52979) then get_abc="w":exit function
  if(tmp>=52980 and tmp<=53640) then get_abc="x":exit function
  if(tmp>=53641 and tmp<=54480) then get_abc="y":exit function
  if(tmp>=54481 and tmp<=62289) then get_abc="z":exit function
  get_abc="-"
end function

'----------------------------站内搜索----------------------------
sub web_search()
  response.write vbcrlf&"  <table border=0>" & _
                 vbcrlf&"  <form action='search.asp' method=get onsubmit=""javascript:frm_submitonce(this);"">" & _
                 vbcrlf&"  <tr>" & _
                 vbcrlf&"  <td>"&img_small("search")&"</td>" & _
                 vbcrlf&"  <td>&nbsp;<input type=text name=keyword size=20 maxlength=20 title='多个关键字请用 空格 格开' class=bg_search></td>" & _
                 vbcrlf&"  <td>&nbsp;<select name=sea_type>" & _
                 vbcrlf&"<option value='forum'>论坛</option>" & _
                 vbcrlf&"<option value='news'>新闻</option>" & _
                 vbcrlf&"<option value='article'>文栏</option>" & _
                 vbcrlf&"<option value='down'>下载</option>" & _
                 vbcrlf&"<option value='paste'>图片</option>" & _
                 vbcrlf&"<option value='flash'>flash</option>" & _
                 vbcrlf&"<option value='website'>网站</option>" & _
                 vbcrlf&"<option value='shop_product'>商城</option>" & _
                 vbcrlf&"</select></td>" & _
                 vbcrlf&"  <td>&nbsp;<input type=checkbox name=celerity value='yes'></td>" & _
                 vbcrlf&"  <td>快速搜索&nbsp;</td>" & _
                 vbcrlf&"  <td valign=top><input type=image src='images/small/web_sea.gif' border=0></td>" & _
                 vbcrlf&"  <td>&nbsp;&nbsp;<a href='search.asp?action=help' title='多功能搜索'>搜索帮助?</a></td>" & _
                 vbcrlf&"  </tr>" & _
                 vbcrlf&"  </form>" & _
                 vbcrlf&"  </table>"
end sub

'-----------------------------版权信息----------------------------
sub web_copy()
dim tmp
  tmp=cms_skin.getdb("copyright")
  tmp=replace(tmp,"{$web_url}",joekoe_cms.web_url) 
  tmp=replace(tmp,"{$web_name}",joekoe_cms.web_name)
  tmp=replace(tmp,"{$pro_editon}",joekoe_cms.pro_edition)
  response.write(vbcrlf&tmp)
end sub

'================================================
'作  用:用户系统信息
'参  数:
'	svar : 用户系统信息
'================================================
function user_sys_type(svar)
  if svar="" or var_null(svar)="" then
    user_sys_type="未知的系统信息"
    exit function
  end if
  dim sys_dim,temp1,sys2,s1,tmp
  sys_dim=split(svar,";")
  if int(ubound(sys_dim))<2 then
    user_sys_type="未知的系统信息"
    exit function
  end if
  sys2=sys_dim(2)
  s1=len(sys2)
  tmp=mid(sys2,s1,1)
  if tmp=")" then sys2=mid(sys2,1,s1-1)
  temp1="操作系统:"&sys2
  temp1=temp1&",浏览器:"&sys_dim(1)
  temp1=replace(temp1,"msie","internet explorer")
  temp1=replace(temp1,"nt 5.0","2000")
  temp1=replace(temp1,"nt 5.1","xp")
  temp1=replace(temp1,"nt 5.2","2003")
  if isarray(sys_dim) then erase sys_dim
  user_sys_type=temp1
end function

'----------------------------------论坛图片--------------------------
function forum_img_topic()
  dim tmp
  tmp=cms_skin.getdb("forum_end")
  tmp=replace(tmp,"{$web_skin}",joekoe_cms.web_dir_skin)
  forum_img_topic=tmp&cms_skin.skukong
end function

function base_forum_is(b_re_counter,b_istop,b_islock,b_isgood,b_isvote,b_vote_num)
  dim temp_b
  temp_b="isok"
  if b_isvote=1 then
    if b_islock=1 then
      temp_b="isvotelock"
    else
      temp_b="isvote"
    end if
  else
    select case b_istop
    case 1
      temp_b="istop"
    case 2
      temp_b="istops"
    case else
      if b_isgood=1 then
        temp_b="isgood"
      else
        if b_islock=1 then
          temp_b="islock"
        else
          if b_re_counter>=10 then temp_b="ishot"
        end if
      end if
    end select
  end if
  base_forum_is="<img src='"&joekoe_cms.web_dir_skin&"forum/"&temp_b&".gif' border=0>"
end function

'================================================
'作  用:用户系统rank等级
'================================================
function rank_img(t_ltimes,ltimes,ttype)
 dim times,h_ltime,m_ltime,n_ltime,nh_ltime,nm_ltime,rank_temp,rank,i,temp,nrank_time
 rank_temp=0
 h_ltime=ltimes \ 60
 m_ltime=ltimes mod 60
 do while h_ltime >= 5*rank_temp^2+15*rank_temp
  rank_temp=rank_temp+1
 loop
 rank=rank_temp-1
 n_ltime=(5*rank_temp^2+15*rank_temp)*60-ltimes
 nh_ltime=n_ltime \ 60
 nm_ltime=n_ltime mod 60
 times=rank
 do while times > 0
  if times \ 16 >0 then
   for i=1 to times \ 16
    temp=temp&"<img border=0 src="&joekoe_cms.web_dir&"images/rank/sun.gif>"
   next
   times=times mod 16
  end if
  if times \ 4 >0 then
   for i=1 to times \ 4
    temp=temp&"<img border=0 src="&joekoe_cms.web_dir&"images/rank/moon.gif>"
   next
   times=times mod 4
  end if
  if times \ 1 >0 then
   for i=1 to times \ 1
    temp=temp&"<img border=0 src="&joekoe_cms.web_dir&"images/rank/star.gif>"
   next
   times=times mod 1
  end if
 loop
 select case cint(ttype)
 case 1
   rank_img="<td colspan=2 class=gray>  <span title='rank: "&rank&"'>"&temp&"</span>  今日在线 <font class=red>"&t_ltimes&" </font>分钟, 总在线 <font class=red>"&ltimes&"</font> 分钟, rank:<font class=red>"&rank&"</font></td>"
   rank_img=rank_img&"<tr class=bg_td><td><td colspan=2 class=gray>    离下次升级还有 <font class=red>"&n_ltime&"</font> 分钟,合计 <font class=red>"&formatnumber(nh_ltime,0)&"</font> 小时 <font class=red>"&nm_ltime&"</font> 分钟</font></td></tr>"
 case else
   rank_img= "<span title='rank: "&rank&"'>"&temp&"</span>"
 end select
end function
'****************************************************
' 玫瑰情缘 2006v3.0      power by www.meigui8.cn
' email: 556248@qq.com  , 100053555@qq.com
' web: http://www.meigui8.cn
' copyright (c) 2006 meigui8.cn all rights reserved.
'****************************************************
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?