<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="inc/Page_cls.asp"-->
<!--#include file="../include/lebi_md5.asp"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 admin_pass.asp
'* 最后更新 2012-02-06 by 56770.kingdge
'*****************************************
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_flag.inc"
CurrentId = 0
CurrentUrl = "admin_pass.asp"
LB_Head()
LB_Menu()
action = request("action")
%>
<div class="tabmenu mainwidth">
      <ul>
        <li <%If action <> "add" And action <> "add_ok" And action <> "log" Then Response.Write("class=""current""") End If%>><a href="admin_pass.asp"><span><%=Lang_Menu(131)%></span></a></li>
		<li <%If action = "log" Then Response.Write("class=""current""") End If%>><a href="?action=log"><span><%=Lang_Menu(132)%></span></a></li>
      </ul>
</div>
<%
Response.Write("<div class=""tab-mainbody"">")
Response.Write("<div class=""tab-mainbody2"">")
If Eshop_Lebi_name="" Then
	    adminflag()
Else
		If OutSubmit = 1 Then CheckOutSubmit()
		Select Case action
			Case "edit_ok" : edit_oke()
			Case "pasword" : pasword()
			Case "newpass" : newpass()
			Case "edit" : userinfo()
			Case "log" : Log()
			Case "layout" : layout()
			Case Else
				pasword()
		End Select
End If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

Sub layout()
		menutype = checknum(request("type"),0)
		conn.execute("update [Lebi_adminuser] set menutype = "& menutype &" where admin_name='"& Eshop_Lebi_name &"'")
		Select Case menutype
		Case "0" url = "manage.asp"
		Case "1" url = "manage_vertical.asp"
		End Select 
		response.redirect url
End Sub 

Sub	pasword()
	Dim AcceptIP,i,AddIP
	set	Rs=Conn.Execute("select * from [Lebi_adminuser] where admin_name='"& Eshop_Lebi_name &"'")
	admin_pass=rs("admin_pass")
	admin_name=rs("admin_name")
	AcceptIP = trim(Rs("AcceptIP"))
	AddIP = request.servervariables("remote_addr")
	'AddIP = Left(AddIP, InStrRev(AddIP, ".")-1)
	'AddIP = Left(AddIP, InStrRev(AddIP, ".")-1)
	'AddIP = AddIP &".*.*"
  %>
         <table width="100%" border="0" cellspacing="0" cellpadding="0" id="classtable" class="classtable">
          <form name="form" method="post" action="?">
           <tr>
              <td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"><input type="hidden" name="action" value="newpass"></td>
			<td align="right" class="classhead">
			<%=QuickMenu("","")%>
			</td>
           </tr>
           <tr>
              <td class="classtop" height="30" colspan="2"><%=Lang_Flag(15)%></td>
           </tr>
		   <tr class="classrow">
			<td width="15%" height="30" class="classrow"><%=Lang_Flag(16)%></td>
			<td width="85%" class="classrow"><%=rs("admin_name")%>
			</td>
		  </tr>
		  <tr class="classrow">
			<td height="30" class="classrow"><%=Lang_Flag(17)%></td>
			<td class="classrow">
			  <input type="password" name="admin_pass" class="form"> <img src="images/help.gif" align="absmiddle" onmouseover="showhintinfo(this,0,0,'','<%=Lang_Flag(20)%>','50','up');" onmouseout="hidehintinfo();" />
			</td>
		  </tr>
		  <tr class="classrow">
			<td class="classrow" valign="top"><%=Lang_Flag(19)%>
			</td>
			<td class="classrow">
			<textarea name="AddAcceptIP" cols="40" rows="3" class="text"><%=AcceptIP%>
			<%
			'If AcceptIP<>"" or not IsNull(AcceptIP) Then
			'	AcceptIP=Split(Trim(AcceptIP),"|")
			'	For i=0 To Ubound(AcceptIP)
			'		Response.Write AcceptIP(i)
			'		If i<Ubound(AcceptIP) Then Response.Write vbCrLf
			'	Next
			'End If

			%></textarea><br><input type=button value="<%=Lang_Flag(21)%>" onclick="AddAcceptIP.value+='<%=AddIP%>|'" class="button"> <%=request.servervariables("remote_addr")%>
           </td>
		  </tr>
		  <tr>
			<td height="30" colspan="2" align="left" class="classfooter">
			  <input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
			  <input type="hidden" name="id" value="<%=request("id")%>">
			</td>
		  </tr>
          <tr>
            <td colspan="2" class="classfaq">
               <div class="faq_main">
               <p class="faq_title"><%=Lang_Flag(22)%></p>
               <%=Lang_Flag(23)%>
			   </div>
            </td>
          </tr>
		</form>
		</table>
		<script>tdshow("classtable");</script>
<%		 Rs.close
		 Set Rs=nothing
End	Sub

Sub	newpass()
        If OnlyRead = 1 Then OnlyReadMessage()
        admin_pass=md5(safereplace(Trim(request("admin_pass"))))
	    admin_name=safereplace(trim(request("admin_name")))
	    a_state=CheckNum(request("a_state"),0)
	    AcceptIP = Replace(safereplace(Trim(Request("AddAcceptIP")))," ","")
	    'Tempstr = Trim(Request("AddAcceptIP"))
	    'If Tempstr<>"" Then
	    '	Tempstr = Split(Tempstr,vbCrLf)
	    '	For i = 0 To ubound(Tempstr)
	    '		If Tempstr(i)<>"" and Tempstr(i)<>" " and Isnumeric(Replace(Replace(Tempstr(i),".",""),"*","")) and Instr(Tempstr(i),",")=0 Then
	    '			If i=0 or AcceptIP="" Then
	    '				AcceptIP = Tempstr(i)
	    '			Else
	    '				AcceptIP = AcceptIP & "|" & Tempstr(i)
	    '			End If
	    '		End If
	    '	Next
	    'End If
	    If Len(AcceptIP)>=255 Then
			    Call Up_mes(Lang_sys(48),"·"& Lang_Flag(24),0,"javascript:history.back()",0,0,2,1)
	    End If
	    set	rs=server.createobject("adodb.recordset")
	    sql="select * from [Lebi_adminuser] where admin_name='"& Eshop_Lebi_name &"'"
	    rs.open	sql,conn,1,3
	    if not rs.eof and not rs.bof then
	    	    if request("admin_pass")<>"" then
	    	    	    Rs("admin_pass") = admin_pass
	    	    end if
	    	    Rs("AcceptIP") = AcceptIP
	    	    rs.update
	    End	if
	    rs.close : Set rs = Nothing
		ManageLog Lang_Flag(25) &" ["&admin_name&"]"
		Call Up_mes(Lang_sys(48),"·"& Lang_sys(47),0,"?",0,0,2,1)
end	sub

Sub Log()
		If IsSqlDataBase =1 Then
				conn.execute("delete from [Lebi_admin_log] where datediff(d,l_logintime,"&sqlnowstring&")>30")
		Else
				conn.execute("delete from [Lebi_admin_log] where datediff('d',l_logintime,"&sqlnowstring&")>30")
		End If
		page = CheckNum(request("page"),1)
		datefrom=safeReplace(request("datefrom"))
		dateto=safeReplace(request("dateto"))
		l_name=safereplace(request("l_name"))
		keyword=safeReplace(request("keyword"))
		Dim ors
		Set ors=new Cls_vbsPage
		Set ors.Conn=conn
		With ors
		.PageSize=15
		.PageName="Page"
		If IsSqlDataBase = 0 Then
				.DbType="AC"
		Else
				.DbType="MSSQL"
		End If
		.RecType=-1
		.Pkey="l_id"
		.Field="l_name,l_logintime,l_loginip"
		.Table="[Lebi_admin_log]"
		sql = "l_name='"& Eshop_Lebi_name &"'"
		if keyword<>"" then sql=sql&" and (l_loginip like '%"&keyword&"%')"
		If IsSqlDataBase = 1 And datefrom<>"" And dateto<>"" Then sql=sql + " and DateDiff(d,l_logintime,'"& datefrom &"')<=0 and DateDiff(d,l_logintime,'"& dateto &"')>=0"
		If IsSqlDataBase = 0 And datefrom<>"" And dateto<>"" Then sql=sql + " and DateDiff('d',l_logintime,'"& datefrom &"')<=0 and DateDiff('d',l_logintime,'"& dateto &"')>=0"
		.Condition=sql
		.OrderBy="l_logintime desc"
		End With
		DataCount=ors.RecCount()
		DataList=ors.ResultSet()
%>
<script language="javascript" src="inc/js/MyCalendar.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
<tbody>
<form name="form" action="?" method="get">
<tr>
<td height="30" align="left" class="classhead">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="text" name="dateFrom" value="<%=dateFrom%>" size="12" class="form_calendar" onclick="setday(this)" /> - <input type="text" name="dateTo" value="<%=dateTo%>" size="12" class="form_calendar" onclick="setday(this)" /></td>
<td style="padding-left:5px;"><input name="keyword" type="text" value="<%=keyword%>" class="form_query" size="15"><input name="Submit" type="submit" value="" title="<%=Lang_sys(25)%>" align="absmiddle" class="btn_query"><input type="hidden" name="action" value="log">
</td>
</tr>
</table>
</td>
<td align="right" class="classhead">
<%=QuickMenu("admin_pass.asp|"& Lang_Menu(131) &"","")%>
</td>
</tr>
</form>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="classtable" class="classtable2">
</tbody>
<tr>
<td height="30" class="classhead" align="right" colspan="3"><%=ors.ShowPageHead(page)%></td>
</tr>
  <tr>
    <td width="15%" height="30" class="classtop"><%=Lang_Flag(1)%></td>
    <td width="65%" class="classtop"><%=Lang_Flag(57)%></td>
    <td width="20%" class="classtop"><%=Lang_Flag(58)%></td>
  </tr>
<%
If DataCount >0 Then
		For i = 0 To Ubound(DataList,2)
%>
  <tr class="classrow">
    <td height="30" class="classrow"><%=DataList(0,i)%></td>
    <td class="classrow"><%=DataList(1,i)%></td>
    <td class="classrow"><%=DataList(2,i)%></td>
  </tr>
<%
        Next
End If
%>
</form>
<tr>
	<td height="30" class="classfooter" align="right" colspan="3"><%=ors.ShowPageFoot(page)%></td>
</tr>
<tr>
<td colspan="3" class="classfaq">
  <div class="faq_main">
  <p class="faq_title"><%=Lang_sys(49)%></p>
  <%=Lang_Flag(59)%>
  </div>
</td>
</tr>
</tbody>
</table>
<script>tdshow("classtable");</script>
<%End sub%>