<!-- #include file="include/config.asp" -->
<!-- #include file="include/skin.asp" -->
<!-- #include file="include/conn.asp" -->

<%
'*******************************************************************
'
'     使用方法：1、在后台执行一下以下SQL语句：
'                  create table get_money 
'                  alter table get_money add column id autoincrement
'                  alter table get_money add column username text(50)
'               2、直接把该文件复制到根目录即可使用了！
'               3、如有问题请去论坛发贴提出，谢谢！
'
'
'*******************************************************************
dim isshow:isshow=int(mid(web_var(web_config,9),10,1))
dim atb:atb=" target=_blank"
tit="海岸红包"
index_url="user_main"
tit_fir=format_menu(index_url)

call web_head(0,0,2,0,0)

if login_mode="" then
  set rs=nothing
  call close_conn()
  response.cookies(web_cookies)("login_username")=""
  response.cookies(web_cookies)("login_password")=""
  call cookies_yes()
  response.redirect "login.asp"
  response.end
end if

select case action
  case "get_money"
    call get_money()
  case else
    call money_main()
end select

sub money_main()
if isshow=1 then
%>
<table border=0 width='98%' cellspacing=0 cellpadding=0 align=center>
<tr><td align=center height=15></td></tr>
<tr><td align=center height=50 class=red><font size=4><B><%response.write web_var(web_error,6)%></B></font></td></tr>
<tr><td align=center><img src='images/hongbao.gif' align=absmiddle border=0></td></tr>
<tr><td align=center height=50 class=blue><font size=4><B><% response.write web_var(web_config,1) %>奉送</B></font></td></tr>

<tr><td align=center height=100>
  <table border=0 align=center width='100%'>
    <tr><td align=center>
      <form action=?action=get_money method=post>
      <input type=hidden name=get_ok value='yes'>  
      <input type=submit value='还犹豫什么，赶快领取吧！'>
      </form>
    </td></tr>
  </table>  
</td></tr>
<tr><td align=center height=15></td></tr>
</table>
<%else
response.write"<table width=773><tr><td height=300 align=bottom><div align=center><font class=red size=4><B>对不起，本站暂停此项服务。请注意本站通知，谢谢合作！</div></B></font></td></tr></table>"
end if
end sub

sub get_money()
  dim money:money=int(web_var(web_num,44))'定义币的数量 
  Randomize     
  dim sql,sql1,rs,temp1
  temp1=chk_user()
  if trim(request.form("get_ok"))="yes" then 
     if temp1<>"yes" then 
      call error()
      exit sub
     end if 
      set rs=server.createobject("adodb.recordset")
      sql="select * from get_money"
      rs.open sql,conn,1,3
      rs.addnew
        rs("username")=login_username
      rs.update
      rs.close:set rs=nothing
      sql1="update user_data set emoney=emoney+"&money&" where username='"&login_username&"'"
      conn.execute(sql1)
      response.write "<script language=javascript>alert('您已经成功地领取了"&money&"个"&web_var(web_config,8)&"！\n\n点击返回。');location.href='get_money.asp';</script>" 
  else
     call money_main()
  end if   
end sub

function chk_user()
  dim rs1,sql2,user_chk
  chk_user="no"
  set rs1=server.createobject("adodb.recordset")
  sql2="select count(id) from get_money where username='"&login_username&"'"
  rs1.open sql2,conn,1,1
    if rs1(0)>0 then 
      chk_user="no"
    else
      chk_user="yes"    
    end if  
  rs1.close:set rs1=nothing
end function


sub error()
  response.write "<script language=javascript>alert('对不起，您已经领取过红包了，不能再领了！\n\n点击返回。');location.href='get_money.asp';</script>" 
end sub

call web_end(0)
%>