<%@ Language="VBScript" %>
<SCRIPT src="ucajax.js" type=text/javascript></SCRIPT>
<!-- #include file="inc/dbconn.inc.asp" //-->
<%
'正在登录的用户 ========================================

action = Request("action")
subaction = Request("subaction")
LOGINID = Request("LOGINID")

' 已经登录的用户判断合法性 ========================================
if LOGINID <> "" then
	sql = "SELECT * FROM bg_sessions WHERE logtype='a' AND sesskey='"& LOGINID &"'"
	set rs = conn.Execute(sql)
	if not rs.EOF then
		'timeout?
		if(timer() < clng(rs("sdate"))+30*60) then
			'ip?
			if (rs("IP") = Request.ServerVariables("REMOTE_ADDR")) then
				dim res
				sql = "SELECT id,popedom,myright FROM bg_adminUser WHERE id="& rs("memberid")
				set res = conn.Execute(sql)
				LOGINUSER = res("id")
				LOGINUSERPOPEDOM = res("popedom")
				LOGINRIGHT = res("myright")
				res.Close
				set res = nothing
				
				conn.Execute("UPDATE bg_sessions SET sdate="& timer() &" WHERE logtype='a' AND sesskey='"& LOGINID &"'")
			else
				errorMsg = "口令错误，请重新登录！"
			end if
		else 
			errorMsg = "用户已经超时，请重新登录！"
		end if
	else
		errorMsg = "帐号不存在，请重新登录！"
	end if
	rs.Close
else
	errorMsg = "请登录！"
end if

if errorMsg = "" then
	LOGINPROPAGATEGET = "&LOGINID="& LOGINID
	LOGINPROPAGATEPOST = "<input type=""hidden"" name=""LOGINID"" value="""& LOGINID &""">"
	if action = "" then
		action = "welcome"
	end if
	if not ShowFunctions() then
		Response.Redirect "functions.asp?action=welcome&type=NoRight&LOGINID="& LOGINID
		response.end
	end if
	if InStr(",news,games,gameIssue,star,",action)>0 and (subaction="preEdit") then
  		onLoadStr = " onload=""InitContent();"""
	end if
end if
%>
<!-- #include file="inc/header.inc.asp" //-->
<%
if errorMsg = "" then
select case (LCase(action))
	case "article"
%>

<!-- #include file="inc/article.inc.asp" //-->
<%
   		   case "words"
		   if subaction="photo" then
%>
<!-- #include file="inc/photowords.inc.asp" //-->
<%elseif subaction="note" then%>
<!-- #include file="inc/words.inc.asp" //-->
<%elseif subaction="knowords" then%>
<!-- #include file="inc/knowords.inc.asp" //-->
<%end if%>
<%
   case "userpic"
%>

<!-- #include file="inc/userpic.inc.asp" //-->
<%
   case "group"
%>

<!-- #include file="inc/group.inc.asp" //-->
<%
   case "know"
%>

<!-- #include file="inc/know.inc.asp" //-->
<%
   case "message"
%>

<!-- #include file="inc/message.inc.asp" //-->
<%
   case "speaker"
%>

<!-- #include file="inc/speaker.inc.asp" //-->
<%
   case "newsclass"
%>

<!-- #include file="inc/newsClass.inc.asp" //-->
<%
   		   case "news"
%>
<!-- #include file="inc/news.inc.asp" //-->
<SCRIPT  type=text/javascript>
getAjax("aspcache.aspx?does=gg")
</SCRIPT>
<%
   		   case "newsmenu"
%>
<!-- #include file="inc/newsMenu.inc.asp" //-->
<%
   		   case "newsissue"
%>
<!-- #include file="inc/newsIssue.inc.asp" //-->
<%
   		   case "newsauditing"
%>
<!-- #include file="inc/newsAuditing.inc.asp" //-->
<SCRIPT  type=text/javascript>
getAjax("aspcache.aspx?does=gg")
</SCRIPT>
<%
   		   case "member"
%>
<!-- #include file="inc/member.inc.asp" //-->

<%
   		   case "vote"
%>
<!-- #include file="inc/vote.inc.asp" //-->
<%
   		   case "ad"
%>
<!-- #include file="inc/ad.inc.asp" //-->
<%
   		   case "links"
%>
<!-- #include file="inc/links.inc.asp" //-->

<%
   		   case "useradd"
%>
<!-- #include file="inc/userAdd.inc.asp" //-->
<%
   		   case "passmodify"
%>
<!-- #include file="inc/passModify.inc.asp" //-->
<%
   		   case "usermodify"
%>
<!-- #include file="inc/userModify.inc.asp" //-->
<%
   		   case "userdel"
%>
<!-- #include file="inc/userDel.inc.asp" //-->
<%
   		   case "guess"
%>
<!-- #include file="inc/guess.inc.asp" //-->
<%
           case else
%>
<!-- #include file="inc/welcome.inc.asp" //-->
<%
      end select
else
	response.write "<script lanauge=""javascript"">"& vbCrLf
	response.write "<!--//"& vbCrLf
	response.write "  alert('"& errorMsg &"')"& vbCrLf
	response.write "  parent.document.URL = 'index.asp'"& vbCrLf
	response.write "//-->"& vbCrLf
	response.write "</script>"& vbCrLf
end if
%>
<!-- #include file="inc/footer.inc.asp" //-->