<%

function emoney_notes(power,emoney,n_sort,iid,err_type,url)
  dim temp1
  emoney_notes=true
  if int(login_is_abate)>0 then exit function
  temp1=emoney_note(power,emoney,n_sort,iid)
  if temp1=true then exit function
  emoney_notes=false
  if err_type=1 then
    response.write joekoe_cms.js_put("alert(""您没有足够的权限或钱币进行刚才的操作！\n\n点击返回……"");location.href='"&url&"';",1)  'location.href='"&url&"';
    call web_clears(1)
  end if
end function

function emoney_note(power,emoney,n_sort,iid)
  dim nrs
  emoney_note=true
  if int(login_is_abate)>0 then exit function  
  if var_null(power)<>"" then
    if instr("."&power&".","."&login_modep&".")=0 then
      emoney_note=false
      exit function
    end if
  end if
  if int(emoney)<=0 then exit function
  if login_mode="" then
    emoney_note=false
    exit function
  end if
  sql="select count(id) from notes where username='"&login_username&"' and nsort='"&n_sort&"' and iid="&iid
  set nrs=joekoe_cms.exec(sql,1)
  if int(nrs(0))>0 then
    nrs.close
    set nrs=nothing
    exit function
  end if
  nrs.close
  set nrs=nothing
  if int(login_emoney)<int(emoney) then
    emoney_note=false
    exit function
  end if
  call joekoe_cms.exec("insert into notes(username,nsort,iid,emoney,tim) values('"&login_username&"','"&n_sort&"',"&iid&","&emoney&",'"&joekoe_cms.now_time&"')",0)
  call joekoe_cms.exec("update user_data set emoney=emoney-"&emoney&" where username='"&login_username&"'",0)
  login_emoney=login_emoney-emoney
end function

function glom_user()
  glom_user=false
  dim come_url,myurl
  come_url=lcase(trim(request.ServerVariables("HTTP_REFERER")))
  myurl=lcase(trim("http://" & Request.ServerVariables("SERVER_NAME") & request.ServerVariables("SCRIPT_NAME")))
  if var_null(come_url)="" then
    glom_user=true
  else
    if left(come_url,instrrev(come_url,"/"))<>left(myurl,instrrev(myurl,"/")) then
      glom_user=true
    end if
  end if
end function

%>