<!--#include file="subconn.asp"-->
<!--#include file="function.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理首页</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<%
Dim Errmsg
Dim FoundErr
Select case Request("method")
case "login_left"
	Call login_left()
case "login_top"
	Call login_top()
case "login_right"
	Call login_right()
case "Login_in"
	Call Login_in()
case "CheckLogin"
	Call CheckLogin()
case "logout"
	Call logout()
case else
	Call login_main()
end Select

sub logout()
	session.Abandon
	response.write "<script>top.location.href='index.asp'</script>"
End sub

Sub CheckLogin()

	if Trim(Request("verify"))="" or isnull(Request("verify")) then
		Errmsg = Errmsg+"<li>请输入附加码。<li><b>返回后请刷新登陆页面后重新输入正确的信息。</b>"
		FoundErr = true
	elseif session("verifycode")="" then
		Errmsg = Errmsg+"<br><li>请不要重复提交，如需重新登陆请返回登陆页面。<li><b>返回后请刷新登陆页面后重新输入正确的信息。</b>"
		FoundErr = true
	elseif Trim(Request("verify"))<>session("verifycode") then
		Errmsg = Errmsg+"<br><li>你输入的附加码和系统产生的不符。"
		FoundErr = true
	end if
	session("verifycode")=""

	if Trim(Request("username")) = "" or Trim(Request("password")) = "" then
		Errmsg = Errmsg+ "<br><li>请输入登陆用户名或密码。<li><b>返回后请刷新登陆页面后重新输入正确的信息。</b>"
		FoundErr = true
	else
		username = checkStr(Request("username"))
		password = checkStr(Request("password"))
	end if

	if FoundErr then
		Call Err_List(Errmsg,2)
		exit sub
	end if
	
	IP = Request.ServerVariables("LOCAL_ADDR")

	Sql = "Select * from userinfo where username='"& username &"'"
	Set Rs = Conn.execute(Sql)
	if Rs.eof and Rs.bof then
		Rs.close
		Set Rs = nothing

		Errmsg = Errmsg+"<br><li>您输入的用户名和密码不正确或者您不是管理员。<li><b>返回后请刷新登陆页面后重新输入正确的信息。</b>"
		FoundErr = true
		Call Err_List(Errmsg,2)
		exit sub
	else
		if Trim(rs("password"))<>password then
			Errmsg = Errmsg+"<br><li>您输入的用户名和密码不正确或者您不是管理员。<li><b>返回后请刷新登陆页面后重新输入正确的信息。</b>"
			FoundErr = true
			Call Err_List(Errmsg,2)
			exit sub
		else
			Session("Admin_Name")=username
			Session("admin_id")=rs("id")
			session.timeout=45
			rs.close
			set rs=nothing
			response.write "<script>location.href='index.asp'</script>"
		end if
	end if
End Sub

Sub login_main()
if  Session("Admin_Name")="" then
	Call Login_in()
else
%>
<frameset cols="180,*" frameborder="NO" border="0" framespacing="0" rows="*"> 
  <frame name="leftFrame" scrolling="AUTO" noresize src="index.asp?method=login_left" marginwidth="0" marginheight="0">

<frameset rows="39,*"  framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
<frame src="index.asp?method=login_top" name="head" scrolling="NO" NORESIZE frameborder="0" marginwidth="10" marginheight="0" border="no">
<%if Session("Admin_Name")=""  then%>
  <frame name="main" src="index.asp?method=Login_in" scrolling="AUTO" NORESIZE frameborder="0" marginwidth="10" marginheight="10" border="no">
<%else%>
  <frame name="main" src="index.asp?method=login_right" scrolling="AUTO" NORESIZE frameborder="0" marginwidth="10" marginheight="10" border="no">
<%end if%>
</frameset>
</frameset>
<%
end if
End Sub

Sub Login_in()
	if Session("Admin_Name") = "" then
			dim num1
			dim rndnum
			Randomize
			Do While Len(rndnum)<4
			num1=CStr(Chr((57-48)*rnd+48))
			rndnum=rndnum&num1
			loop
			session("verifycode")=rndnum
%>
	<BODY leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#799AE1">
	<br><br><br><form action="index.asp" method=post> 
	  <table width="413" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#EEEAD6">
		<tr>
		  <td height="29" colspan="3" background="image/topbg.gif"> <table width="95%" align="right" border="0" cellspacing="0" cellpadding="0">
			  <tr> 
				<td align="left" valign="middle"><font color="#FFFFFF"><B>思高(www.cycoo.com)网站调查系统 V1.2</B></font></td>
				<td width="8%" align="right"></td>
			  </tr>
			</table></td>
		</tr>
		<tr>
		  <td width="3" background="image/link.GIF"></td>
		  <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
			  <tr>
				<td><table width="95%" border="0" align="center">
		  
		  <tr><td>
		  <fieldset><legend accesskey="F" align="left">登陆窗口</legend> 
				  <table width="100%" border="0" cellspacing="2" cellpadding="2">
					<tr> 
					  <td width="10%">&nbsp;</td>
					  <td width="20%">用&nbsp;户&nbsp;名：</td>
					  <td><input type="text" name="username"></td>
					</tr>
					<tr> 
					<td width="10%">&nbsp;</td>
					  <td width="20%">密&nbsp;&nbsp;&nbsp;&nbsp;码：</td>
					  <td><input type="password" name="password">
					  </td>
					</tr>
					<tr>
					  <td width="10%">&nbsp;</td>
					  <td>附&nbsp;加&nbsp;码：</td>
					  <td><input type="text" name="verify" size="10"> &nbsp;输入附加码<span style="padding-left:4px;padding-right:4px;background-color: #D0D0BF;line-height:200%"><font color=#ff0000><%=session("verifycode")%></font></span> 
					  </td>
					</tr>
					<tr> 
					  <td colspan="3" align="center"><input type="submit" name="submit" value=" 登 陆 " class="tbutton"></td>
					</tr>
				  </table>
		  </fieldset> 
		  &nbsp;</td></tr>
		  </table></td>
			  </tr>
			</table></td>
		  <td width="3" background="image/link.GIF"></td>
		</tr>
		<tr><td height="3" background="image/linkbom.GIF" colspan="3"></td></tr>
	  </table>  
	  <input type="hidden" value="CheckLogin" name="method">
	</form>
<%
	end if
End Sub

Sub login_left()
%>
<SCRIPT language=javascript1.2>
function showsubmenu(sid)
{
var obj1= "ss" + sid
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
document.all.item(obj1).src='image/show.gif';
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
document.all.item(obj1).src='image/hide.gif';
}
}

</SCRIPT>
<BODY leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#799AE1">
<br>
<table cellpadding=0 cellspacing=0 width=158 align=center>
  <tr> 
    <td height=25 valign="middle" background="image/title.GIF" class=menu_title onmouseover=this.className='menu_title2'; onmouseout=this.className='menu_title'; ><span><font color="#FFFFFF">管理功能菜单</font></span> </td>
  </tr>
</table>
<table cellpadding=0 cellspacing=0 width=158 align=center>
  <tr> 
    <td width="134" height=25 valign="middle" background="image/bg.GIF" class=menu_title onmouseover=this.className='menu_title2'; onmouseout=this.className='menu_title'; > 
      <a href="index.asp" target=_top><span>管理首页</span></a>&nbsp;&nbsp;<B>|</B><a href=index.asp?method=logout target=_top><span>退出</span></a></td>
    <td width="25"><img src="image/quit.GIF" width="25" height="25"></td>
  </tr>
</table>
<br>
<table cellpadding=0 cellspacing=0 width=158 align=center>
  <tr id=menuTitle1 onclick="showsubmenu(1)" style="cursor: hand"> 
    <td width="134" height=25 valign="middle" background="image/bg.GIF" class=menu_title onmouseover=this.className='menu_title2'; onmouseout=this.className='menu_title'; > 
      <span>调查系统管理</span> </td>
    <td width="25"><img src="image/hide.GIF" width="25" height="25" id=ss1></td>
  </tr>
  <tr> 
    <td colspan="2" style="display:none" id='submenu1'>
	<div class=sec_menu style="width:158">
	<table cellpadding=0 cellspacing=0 align=center width=135>
	<tr><td height=20> # <a href="admin_vote_list.asp" target="main">调查项目列表</a> </td></tr>
	<tr><td height=20> # <a href="admin_vote_list.asp?cmd=4" target="main">添加调查项目</a></td></tr>
	<tr><td height=20> # <a href="admin_vote_code.asp" target="main">页面调用代码</a></td></tr>
  <tr><td height=20> # <a href="admin_password.asp" target="main">操作员密码修改</a></td></tr>

	</table>
	</div></td>
  </tr>
</table>
<BR>

<table cellpadding=0 cellspacing=0 width=158 align=center>
  <tr id=menuTitle2 onclick="showsubmenu(2)" style="cursor: hand"> 
    <td width="134" height=25 valign="middle" background="image/bg.GIF" class=menu_title onmouseover=this.className='menu_title2'; onmouseout=this.className='menu_title'; > 
      <span>程序问题交流</span> </td>
    <td width="25"><img src="image/hide.GIF" width="25" height="25" id=ss2></td>
  </tr>
  <tr> 
    <td colspan="2" style="display:none" id='submenu2'>
	<div class=sec_menu style="width:158">
	<table cellpadding=0 cellspacing=0 align=center width=135>
	<tr><td height=20> # <a href="http://bbs.cycoo.com" target="_blank">技术交流论坛</a></td></tr>
	<tr><td height=20> # <a href="http://prog.cycoo.com" target="_blank">思高系列下载</a></td></tr>
	<tr><td height=20> # <a href="http://shop.cycoo.com" target="_blank">思高数码商城</a></td></tr>
	</table>
	</div></td>
  </tr>
</table>
<br>
<table cellpadding=0 cellspacing=2 align=center width=150>
  <tr>
    <td>版权所有：<a href="http://www.cycoo.com" target="_blank"><font color="#000000">思高网络</font></a></td></tr>
  <tr><td>技术支持：<a href="mailto:windward@cycoo.com" ><font color="#000000">啸沧海</a></td></tr>
</table>
<%
end sub

Sub login_top()
%>
<BODY leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#F4EEE4">
<table width="100%" align=center cellpadding=0 cellspacing=0 border=0 background="image/linkbg.gif">
<tr><td height="39" align=center nowrap> &nbsp;欢迎 <b><%=Session("Admin_Name")%></b> 登陆思高(www.cycoo.com)网站调查管理系统！今天 <SCRIPT language=javascript>
function isnArray()
{
	argnr=isnArray.arguments.length
	for(var i=0;i<argnr;i++)
		this[i+1]=isnArray.arguments[i];
}
var isnDays=new isnArray("星期一","星期二","星期三","星期四","星期五","星期六","星期日");isnDays[0]="星期日";
mydate = new Date();
myyear = mydate.getFullYear();
mymonth = mydate.getMonth()+1;
today = mydate.getDate();
document.write(myyear+"年"+mymonth+"月"+today+"日");
document.write("&nbsp;")
document.write(isnDays[mydate.getDay()]);
</SCRIPT></td><td nowrap align=right> [ <a href="/" target="_blank">网站首页</a> ]
&nbsp;</td>
</tr>
</table>
<%
End Sub

Sub login_right()
%>

<BODY leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#F4EEE4" class="Dtu">
<BR>

<table width="98%" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#ECEEE4" bordercolordark="#CCCABC">
 <TR><TD align="center"><strong><font color="#FF0000">[安全事项]</font></strong></TD></TR>
  <TR><TD>1、欢迎您使用<b>思高网站调查系统</b>免费版。<br>
  2、为避免密码泄漏，请勿在网吧、公司外等公共场所使用本系统。<br>
      3、登陆后，如果暂时离开电脑，请务必点击 <a href="index.asp?method=logout"><strong>[退出]</strong></a> 系统，以免无关人员操作，造成数据泄漏或损失。
	  </TD>
  </TR>
</TABLE>
<br>
<table width="98%" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#ECEEE4" bordercolordark="#CCCABC">
<TR><TD>程序版本：<b>网站调查管理系统</b> V1.2 </TD></TR>
  <TR><TD>版权所有：<a href="http://www.cycoo.com" target="_blank">www.cycoo.com</a></TD></TR>
  <TR><TD>支持论坛：<a href="http://bbs.cycoo.com" target="_blank">思高网络</a></TD></TR>
  <TR><TD>程序设计：啸沧海&nbsp;&nbsp;QQ:59466966</TD></TR>
  <TR><TD>开发日期：2004年10月</TD></TR>
</TABLE>
<br>
<%
End Sub
%>

</body>