<!--#include file="connbbs.asp"-->
<!--#include file="connmx.asp"-->
 <% 
 
 dim rsmx,sqlmx,dweek,rsmx1,wday,sqlmx1
    dim mingxing,dmingxing,wmingxing,warticle,darticle
	dim  sql1,rs1
    dim nodaymx,noweekmx
	dim action
	dim dsavetime

 function killmx(membername) '明星删贴写库函数
   	set rsmx=server.createobject("adodb.recordset")
	sqlmx="select * from mingxing where username='"&membername&"'"
    rsmx.open sqlmx,connmx,1,3
	if rsmx.eof  then 
	rsmx.addnew   
	rsmx("username")=membername
	rsmx("darticle")=-1
	rsmx("warticle")=-1
	rsmx.update
	rsmx.close  
	set rsmx=nothing
	else   	
	rsmx("darticle")=rsmx("darticle")-1	
	rsmx("warticle")=rsmx("warticle")-1
 	rsmx.update
	rsmx.close
	set rsmx=nothing
	end if
	end function

	function savemx(membername) '明星发贴写库函数
	set rsmx=server.createobject("adodb.recordset")
	sqlmx="select * from mingxing where username='"&membername&"'"
    rsmx.open sqlmx,connmx,1,3
	if rsmx.eof  then 
	rsmx.addnew   
	rsmx("username")=membername
	rsmx("darticle")=1
	rsmx("warticle")=1
	rsmx("dsavedate")=date()
	 if weekday(date())=1 then
	rsmx("wsavedate")=date()
	else
	rsmx("wsavedate")=date()-weekday(date())+1
	end if
	rsmx.update
	rsmx.close  
	set rsmx=nothing
	else   
	rsmx("darticle")=rsmx("darticle")+1
	rsmx("warticle")=rsmx("warticle")+1
	rsmx.update
	rsmx.close
	set rsmx=nothing
	end if
	end function


  
 
 sub showmx() '明星显示函数
''''''''''''''''''''''''''''''''''初始化明星数据库'''''''''''''''''''''''''''''''''''''
           dim rsmx00,sqlmx00
    set rsmx00=server.createobject("adodb.recordset")
		sqlmx00="select * from mingxing"
		 rsmx00.open sqlmx00,connmx,1,3
   if  rsmx00.eof  then
     rsmx00.addnew
	rsmx00("username")="rexsp"
	rsmx00("darticle")=1
	rsmx00("warticle")=1
	rsmx00("dsavedate")=date()
 if weekday(date())=1 then
	rsmx00("wsavedate")=date()
	else
	rsmx00("wsavedate")=date()-weekday(date())+1
	end if
	rsmx00.update

	dim rs00,sql00
    set rs00=server.createobject("adodb.recordset")
		sql00="select * from user"
		 rs00.open sql00,connbbs,1,3
	rs00.addnew
	rs00("username")="rexsp"
	rs00("useremail")="yubo@x263.net"
	rs00("Article")=1
	rs00("UserPassword")="2f152e99a07068c4"
	rs00("sign")="她仿佛流星闪过，却照亮了我的一生"
	rs00("sex")=1
	rs00("homepage")="http://campus.nwpu.edu.cn/xsc"
	rs00("addDate")=now()
	rs00("logins")=1
	rs00("face")=ForumUrl&"/mingxing/rexsp.gif"
	rs00("width")=80
	rs00("height")=80
	rs00("oicq")="942365"
	rs00("lastlogin")=now()
	rs00("bbstype")=0
	rs00("lockuser")=0
	rs00("userclass")=1
	rs00("usergroup")="真水无香"
	rs00("userwealth")=100
	rs00("userEP")=100
	rs00("usercp")=100
	rs00("title")="明星制造"
    rs00("birthday")="1980-10-15"
	rs00("quesion")="age"
	rs00("answer")="1b9d012b9314357f"
	rs00("showre")=1
	rs00("icq")="107733071"
	rs00("msn")="rexsp@hotmail.com"
	rs00.update
	rs00.close
	sql00="select * from bbsnews"
    rs00.open sql00,connbbs,1,3
    rs00.addnew
    rs00("boardid")=0
    rs00("title")="我是明星我怕谁"
    rs00("content")="论坛正式启用明星插件，让我们一起努力把自己灌成明星吧！"
    rs00("username")="明星制造商"
    rs00("addtime")=now()
    rs00.update
	rs00.close
	set rs00=nothing
		
     end if
 		'do while not rsmx00.eof
		'if  DateDiff("d",rsmx00("dsavedate"),date())<>0 then
		'  rsmx00("darticle")=0
		 ' rsmx00("dsavedate")=date()
		'  end if
	    ' if   weekday(date())=1 and DateDiff("d",rsmx00("wsavedate"),date())=7 then
		 '   rsmx00("warticle")=0
		'	rsmx00("wsavedate")=date()
		'  end if
		'  rsmx00.movenext
		'  loop
		dim sqlupdate1,sqlupdate2
sqlupdate1="update mingxing set darticle=0,dsavedate='"&date()&"' where DateDiff('d',dsavedate,'"&date()&"')>0"
connmx.execute(sqlupdate1)
sqlupdate2="update mingxing set warticle=0,wsavedate='"&date()&"' where "&weekday(date())&"=1 and DateDiff('d',wsavedate,'"&date()&"')=7"
connmx.execute(sqlupdate2)
 
		  rsmx00.close
		  set rsmx00=nothing
		 
		  		  
 ''''''''''''''''''''''''''''''''''初始化明星数据库结束'''''''''''''''''''''''''''''''''

 ''''''''''''''''''''''''''''''''''取得今日明星参数'''''''''''''''''''''''''''''''''

		  set rsmx=server.createobject("adodb.recordset")
	sqlmx="select top 1 * from mingxing  order by darticle desc,warticle desc"
    rsmx.open sqlmx,connmx,0,1


	       dmingxing=rsmx("username")
	      darticle=rsmx("darticle")
	      dweek=rsmx("warticle")
		  dsavetime=rsmx("dsavedate")
          rsmx.close
	      set rsmx=nothing
	      
 ''''''''''''''''''''''''''''''''''取得今日明星参数结束'''''''''''''''''''''''''''''''''

  ''''''''''''''''''''''''''''''''''取得本周明星参数'''''''''''''''''''''''''''''''''

	   set rsmx1=server.createobject("adodb.recordset")
	  sqlmx1="select top 1 * from mingxing order by warticle desc,darticle desc"
	  rsmx1.open sqlmx1,connmx,0,1
dim wsavetime
	      wmingxing=rsmx1("username")
	      warticle=rsmx1("warticle")
	      wday=rsmx1("darticle")
		  wsavetime=rsmx1("wsavedate")
	      rsmx1.close
	      set rsmx=nothing
          connmx.close
	set connmx=nothing
 ''''''''''''''''''''''''''''''''''取得本周明星参数结束'''''''''''''''''''''''''''''''''
 


	sql="select  * from user where username='"&dmingxing&"'"
set rs=server.createobject("adodb.recordset") 
rs.open sql,connbbs,0,1 
dmingxing=rs("username") 
 
 
sql1="select * from user where username='"&wmingxing&"'"
set rs1=server.createobject("adodb.recordset") 
rs1.open sql1,connbbs,0,1 
wmingxing=rs1("username") 
 
%>
<table cellpadding=6 cellspacing=0 width="73%" align=center  bordercolor="<%=Tablebackcolor%>" border=1>
<tr>
<TD vAlign=top align=middle bgcolor=<%=Tablebodycolor%> >

<table border=0 width=100%>
<tr>
 
<td width=44% valign=top nowrap>
<strong>今日明星：</strong>
    <font color=#9999ff>照片-=></font>
<p align=left>姓名：<font color=blue><%=dmingxing%></font>
<br>社区等级：<%=rs("userclass")%>
<br>今日文章：<%=darticle%> 篇
<br>本周文章：<%=dweek%> 篇
<br>个人财产：<%=rs("userWealth")%> 元 
<br>OICQ：<%if rs("oicq")<>"" then%><%=htmlencode(rs("oicq"))%><%else%>没有QQ<%end if%>
</td>
<td width=50% valign=middle align=center>
<a href="#;" onclick="javascript:window.open('mingxin.asp?name=<%=dmingxing%>','mingxin','status=1,scrollbars=1,height=350,width=620,top=10,left=150')" ><img border=0 src="<%=rs("face")%>" title="统计起始时间：<%=dsavetime%>" width=80 height=80></a>
</td>
</table>
<%rs.close
set rs=nothing%>

</TD>
</TR>
 </table> 

<table cellpadding=6 cellspacing=0 width="82%" align=center  bordercolor="<%=Tablebackcolor%>" border=1 id="table1">
<tr>
<TD vAlign=top align=middle bgcolor=<%=Tablebodycolor%>>
<table border=0 width=100% id="table2">
<tr>
 
<td width=50% valign=top nowrap>
<strong>本周明星：</strong>
    <font color=#9999ff>照片-=&gt;</font>
<p align=left>姓名：<font color=blue><%=wmingxing%></font>
<br>社区等级：<%=rs1("userclass")%>
<br>本周文章：<%=warticle%> 篇
<br>今日文章：<%=wday%> 篇
<br>个人财产：<%=rs1("userWealth")%> 元 
<br>OICQ：<%if rs1("oicq")<>"" then%><%=htmlencode(rs1("oicq"))%><%else%>没有QQ<%end if%>
</td>
<td width=50% valign=middle align=center><a href="#;" onclick="javascript:window.open('mingxin.asp?name=<%=wmingxing%>','mingxin','status=1,scrollbars=1,height=350,width=620,top=10,left=150')" ><img border=0 title="统计起始时间：<%=wsavetime%>" src="<%=rs1("face")%>" width=80 height=80></a>
</td>
</table>
<%rs1.close
set rs1=nothing%>
</TD>
</TR>
 </table> 

<%
 connbbs.close
set connbbs=nothing
end sub%>