应用技巧

关注公众号 jb51net

关闭
首页 > 网络编程 > ASP编程 > 应用技巧 >

kesion科讯V4.0管理员Key工具

作者:

kesion科讯V4.0管理员Key工具
操作说明,请仔细阅读操作说明后进行操作:
1、请把压缩包中的key.asp文件上传到KesionCMS根目录下。
2、运行key.asp后选择您所需要的选项。
3、注意:使用完毕后请点击“删除Key文件”或在FTP中删除key.asp文件以防留有后门。
4、功能简介:
A 在删除了所有管理员情况下,新建管理员帐号。
B 修改后台管理员的登录名称和密码。
C 商业用户注册码修改。
复制代码 代码如下:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit
Response.Buffer=true%>
<!--#include file="Conn.asp"-->
<!--#include file="KS_Inc/md5.asp"-->
<!--#include file="KS_Cls/KS.PublicCls.asp"-->
<%
'****************************************************
' Software name:Kesion CMS 4.0
' Email: service@kesion.com . QQ:111394,9537636
' Web: http://www.kesion.com http://www.kesion.cn
' Copyright (C) Kesion Network All Rights Reserved.
'****************************************************
Dim KSCls
Set KSCls = New Install
KSCls.Kesion()
Set KSCls = Nothing

Class Install
        Private KS
        Private SqlStr,RS,InstallDir,FsoIndexFile,FsoIndexExt,AdminDirStr,CurrPath,Step

        Private Sub Class_Initialize()
          Set KS=New PublicCls
        End Sub
        Private Sub Class_Terminate()
         Call CloseConn()
         Set KS=Nothing
        End Sub
        Sub Kesion
            %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>科汛网站管理系统V4.0系列产品安装程序</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=GB2312">
    <script src="<%=AdminDirStr%>/JS/Common.js" language="JavaScript"></script>
    <Script Language="javascript">
            <!--
            function CheckForm()
            { var form=document.SetWebInfoForm;
               if (form.UserName.value=="")
               {
                 alert("请输入管理账号!");
                 form.UserName.focus();
                return false;
               }
               if (form.PassWord.value=="")
               {
                 alert("请输入管理密码!");
                 form.PassWord.focus();
                return false;
               }
               if (form.ConPassWord.value=="")
               {
                 alert("请输入确认密码!");
                 form.ConPassWord.focus();
                return false;
               }
               if (form.ConPassWord.value!=form.PassWord.value)
               {
                 alert("两次输入的密码不一致!");
                 form.ConPassWord.focus();
                return false;
               }
               if (form.SiteSN.value=="")
               {
                 alert("请输入授权系列号!");
                 form.SiteSN.focus();
                return false;
               }
               if (form.SiteSN.value.length!=29&&form.SiteSN.value.length!=1)
               {
                 alert("请输入的授权系列号有误!");
                 form.SiteSN.focus();
                return false;
               }
               if (form.WebName.value=="")
                {
                 alert("请输入您的网站名称!");
                 form.WebName.focus();
                return false;
                }
                form.submit();
                return true;

            }
            //-->
            </Script>
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF}

A { TEXT-DECORATION: none; Color: #000000;}

A:hover { TEXT-DECORATION: none;Color: #4455aa; }

BODY { 
    text-align: center;
    margin-top :20px;
    SCROLLBAR-FACE-COLOR: #eeeeee; 
    SCROLLBAR-HIGHLIGHT-COLOR: #ffffff; 
    SCROLLBAR-SHADOW-COLOR: #dee3e7; 
    SCROLLBAR-3DLIGHT-COLOR: #d1d7dc; 
    SCROLLBAR-ARROW-COLOR: #000000; 
    SCROLLBAR-TRACK-COLOR: #ededed; 
    SCROLLBAR-DARKSHADOW-COLOR: #808080;
}
INPUT.text ,TEXTAREA ,subject ,SELECT {
    BORDER: 1px gray solid;
    PADDING-RIGHT: 1px;
    PADDING-LEFT: 1px;
    PADDING-BOTTOM: 1px;
    PADDING-TOP: 1px;
    HEIGHT: 19px;
}
TABLE {
    WORD-BREAK: break-all;
}
body,td,th,div{
    FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Tahoma; line-height: normal;
}
hr { height: 1px; color: #6595D6; width: 100%; }
.ContactInfo{
    FONT-SIZE: 14px;
    padding:5px;
    color:#003399;
}
TEXTAREA.UpdateInfo{
    border : 1px dotted #666666;
    width:100%;
    height:360px;
    overflow: auto; 
    BACKGROUND-COLOR: #ffffff;
    FONT-SIZE: 14px;
    padding:5px;
    color:#003399;
}
.copyright{
    color:gray;
    BACKGROUND-COLOR:#EAEAEA;
}
.redfont {color: #FF0000}
-->
</style></HEAD>
<BODY>
<table width="700" border="1" align="center" cellpadding="1" cellspacing="6" bordercolor="#CCCCCC">
  <tr>
    <td width="682" height="22" bgcolor="#F0F0F0"><TABLE width="98%" border=0 cellPadding=0 cellSpacing=1 class=Table1>
      <TBODY>
        <TR>
          <TH  noWrap class=Link><A href="http://www.kesion.com" target="_blank">官方网站</A> <A href="http://bbs.kesion.com" target="_blank">技术论坛</A>          <A href="http://help.kesion.com" target="_blank">帮助中心</A>            <A href="http://test.kesion.com" target="_blank">演示站点</A></TH>
          <TH  width=404 align="center" noWrap class=Link><div align="right"><strong>当前版本:</strong>V4.0<strong> 官方版本: </strong>
              <script src="http://www.kesion.com/websystem/showver.asp"></script>            </TH>
        </TR>
      </TBODY>
    </TABLE>      </td>
  </tr>
  <tr>
    <td width="682" height="30" align="center" bgcolor="#333399">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>&nbsp;</td>
        <td align="center"><span class="STYLE1"><strong>KesionCMS V4.0 Key管理员工具</strong></span></td>
      </tr>
    </table></td>
  </tr>

  <tr bgcolor="#F0F0F0"  id="ShowSetup">
    <td height="250">
      <div style="color:red;font-weight:bold;text-align:center;padding:5px;">温馨提示:为了系统的安全,请使用后一定要删除该文件。</div>
    <br>

     <%select case request("action")
        case "AddAdmin"
         Call AddAdmin()
        Case "AddSave"
         Call SaveInfo()
        Case "EditAdmin"
         Call EditAdmin()
        Case "EditSave"
         Call EditSave()
        Case "EditSiteSN"
         Call EditSiteSN()
        Case "EditSN"
         Call EditSN()
        Case "Del"
              CurrPath = KS.Setting(3) 
             Call KS.DeleteFile(CurrPath&"key.asp")  
             Response.Redirect KS.Setting(89) & "Login.asp"
        Case Else
         Call Main()
        End Select
    %>

      

      
    <br></td>
  </tr>

</table>
<table width="700"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="10" align="right">&nbsp;</td>
  </tr>
  <tr>
    <td align="center" valign="bottom"> Powered by&nbsp;<a href="http://www.kesion.com/" target="_blank"><strong> Kesion.Com </a>
      &copy; 2007
    </td>
  </tr>
</table>
<TABLE class=Table0 cellSpacing=0 cellPadding=0 align=center border=0>
  <TBODY>
  <TR>
    <TD class=Table0 height=1></TD></TR></TBODY></TABLE>
<!--结束部分-->
</BODY>
</HTML>
    <%    
     End Sub
     Sub SaveInfo()
                if not conn.execute("select username from ks_admin where SuperTF='1'").eof then
                 Call KS.AlertHistory("设置失败:\n\n对不起,系统已存在超级管理账号!","-1")
                 Response.End
                end if
                Dim PreUserName,UserName,PassWord,ConPassWord,UserRS
                PreUserName=KS.S("PreUserName")
                IF PreUserName="" then 
                 Call KS.AlertHistory("设置失败:\n\n没有输入前台会员账号,请输入!","-1")
                 Response.End
                End If
                If Conn.Execute("Select * From KS_User Where UserName='" & PreUserName & "'").eof then
                 Call KS.AlertHistory("设置失败:\n\n前台用户不存在,请重新输入!","-1")
                 Response.End
                end if

                UserName=KS.S("UserName")
                IF UserName="" then 
                 Call KS.AlertHistory("设置失败:\n\n没有输入管理账号,请输入!","-1")
                 Response.End
                End If
                PassWord=KS.S("PassWord")
                IF PassWord="" then 
                 Call KS.AlertHistory("设置失败:\n\n没有输入管理密码,请输入!","-1")
                 Response.End
                End If
                IF Len(PassWord)<6 then 
                 Call KS.AlertHistory("设置失败:\n\n密码不能少于6位,请重新输入!","-1")
                 Response.End
                End If

                ConPassWord=KS.S("ConPassWord")
                IF PassWord<>ConPassWord then 
                 Call KS.AlertHistory("设置失败:\n\n两次输入密码不一致,请重新输入!","-1")
                 Response.End
                End If
                PassWord =MD5(KS.R(Request.form("PassWord")),16)

                
                Set UserRS=Server.CreateObject("ADODB.RECORDSET")
                UserRS.Open "Select * From KS_Admin",Conn,1,3
                 UserRS.AddNew
                 UserRS("UserName")=UserName
                 UserRS("PrUserName")=UserName
                 UserRS("PassWord")=PassWord
                 UserRS("Sex")="男"
                 UserRS("Description")="科汛系统安装分配的超级管理员"
                 UserRS("SuperTF")=1
                 UserRS("Locked")=0
                 UserRS("LastLoginIP")=KS.GetIP
                 UserRS("LoginTimes")=0
                 UserRS("LastLoginTime")=Now
                 UserRS("LastLogoutTime")=Now
                 UserRS("AddDate")=Now
                 UserRS("PowerList")=1
                 UserRS("ModelPower")="11111111111111111111"
                 UserRS.Update
              UserRS.Close
              Set UserRS=Nothing
              Conn.Execute("Update KS_User Set GroupID=4 where username='" & PreUserName & "'")
                KS.DelCaches(KS.SiteSN)
                response.write "<div align='center'>恭喜,后台管理员设置成功!<br><a href=""" & KS.Setting(89) & "login.asp"">进入后台</a> | <a href=""?action=Del"">删除Key文件</a></div>"
     End Sub

     Sub EditSave()
       Dim UserName,password,conpassword
            UserName=KS.S("UserName")
            IF UserName="" then 
                 Call KS.AlertHistory("设置失败:\n\n没有输入管理账号,请输入!","-1")
                 Response.End
            End If
          Conn.Execute("Update KS_Admin Set UserName='" & UserName & "' Where Supertf='1'")

             PassWord=KS.S("PassWord")
            IF PassWord<>"" then 
                IF Len(PassWord)<6 then 
                 Call KS.AlertHistory("设置失败:\n\n密码不能少于6位,请重新输入!","-1")
                 Response.End
                End If

                ConPassWord=KS.S("ConPassWord")
                IF PassWord<>ConPassWord then 
                 Call KS.AlertHistory("设置失败:\n\n两次输入密码不一致,请重新输入!","-1")
                 Response.End
                End If
                PassWord =MD5(KS.R(Request.form("PassWord")),16)    
                Conn.Execute("Update KS_Admin Set [password]='" & password & "' Where Supertf='1'")
         End If 
                response.write "<div align='center'>恭喜,后台管理员修改成功!<br><a href=""" & KS.Setting(89) & "login.asp"">进入后台</a> | <a href=""?action=Del"">删除Key文件</a></div>"
    End Sub

    Sub EditSN()
      Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
      RS.Open "Select Setting From KS_Config",conn,1,3
      Dim SetArr,SetStr,I
      SetArr=Split(RS(0),"^%^")
      For I=0 To Ubound(SetArr)
       If I=0 Then 
        SetStr=SetArr(0)
       ElseIf I=17 Then
        SetStr=SetStr & "^%^" & request("sn")
       Else
        SetStr=SetStr & "^%^" & SetArr(I)
       End If
      Next
      RS(0)=SetStr
      RS.Update
      RS.Close:Set RS=Nothing
      Call KS.DelCahe(KS.SiteSn & "_Config")
      Call KS.DelCahe(KS.SiteSn & "_Date")
                response.write "<div align='center'>恭喜,授权系统号修改成功!<br><a href=""" & KS.Setting(89) & "login.asp"">进入后台</a> | <a href=""?action=Del"">删除Key文件</a></div>"
    End Sub

     Sub Main()
     %>
     <table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#666666">
        <tr align="right">
          <td height="5" colspan="3" bgcolor="#0066CC"></td>
        </tr>
         <form name="SetWebInfoForm" method="post" action="" onSubmit="return(CheckForm())">
              <input type="hidden" value="Save" name="Action">
        <tr>
          <td width="17%" height="35" align="right" bgcolor="#FFFFFF"><strong>新建超级管理员:</strong></td>
          <td width="41%" bgcolor="#FFFFFF">重新建立新的超级管理员帐号</td>
          <td width="42%" bgcolor="#FFFFFF">&nbsp; 
          <%dim rsc:set rsc=conn.execute("select username from ks_admin where SuperTF='1'")
           if rsc.eof then%>
           <input type="button" value="开始新建" onClick="location.href='?action=AddAdmin';">
           <%else%>
           <input type="button" value="禁止新建" disabled>&nbsp;<font color=#a7a7a7>系统已存在<%=rsc("username")%>的超级用户</font>
           <%end if%>
           </td>
        </tr>
        <tr>
          <td height="35" align="right" bgcolor="#FFFFFF"><strong>修改管理员:</strong></td>
          <td bgcolor="#FFFFFF">修改超级管理员登录名及登录密码</td>
          <td bgcolor="#FFFFFF">&nbsp;
            <input name="button" type="button" value="开始修改" onClick="location.href='?action=EditAdmin';"></td>
        </tr>
        <tr>
          <td height="35" align="right" bgcolor="#FFFFFF"><strong>修改授权注册码:</strong></td>
          <td bgcolor="#FFFFFF">修改官方授权唯一的注册码</td>
          <td bgcolor="#FFFFFF">&nbsp;
            <input name="button2" type="button" value="开始修改" onClick="location.href='?action=EditSiteSN';"></td>
        </tr>
        <tr align="right">
          <td height="5" colspan="3" bgcolor="#0066CC"></td>
        </tr>
        </form>
      </table>
     <%
     End Sub

     Sub AddAdmin()
     %>
     <table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#666666">
        <tr align="right">
          <td height="5" colspan="2" bgcolor="#0066CC"></td>
        </tr>
         <form name="SetWebInfoForm" method="post" action="?action=AddSave">
        <tr>
          <td width="17%" height="35" align="right" bgcolor="#FFFFFF"><strong>前台用户名:</strong></td>
          <td width="41%" bgcolor="#FFFFFF"><input type="text" name="preusername" size=12> (前台注册的用户名)</td>
        </tr>
        <tr>
          <td height="35" align="right" bgcolor="#FFFFFF"><strong>管理员登录名:</strong></td>
          <td bgcolor="#FFFFFF"><input type="text" name="username" size=12></td>
        </tr>
        <tr>
          <td height="35" align="right" bgcolor="#FFFFFF"><strong>登录密码:</strong></td>
          <td bgcolor="#FFFFFF"><input type="password" name="password" size=12> (长度不能小于6)</td>       
       </tr>
        <tr>
          <td height="35" align="right" bgcolor="#FFFFFF"><strong>确认密码:</strong></td>
          <td bgcolor="#FFFFFF"><input type="password" name="conpassword" size=12> (长度不能小于6)</td>       
       </tr>
        <tr align="right">
          <td height="5" colspan="2" bgcolor="#0066CC"></td>
        </tr>
        <tr align="center">
          <td height="25" colspan="2" bgcolor="#ffffff"><input type="submit" value="确认增加"></td>
        </tr>
        </form>
      </table>
     <%
     End Sub

     Sub EditAdmin()
       %>
     <table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#666666">
        <tr align="right">
          <td height="5" colspan="2" bgcolor="#0066CC"></td>
        </tr>
         <form name="SetWebInfoForm" method="post" action="?action=EditSave">
        <tr>
          <td height="35" align="right" bgcolor="#FFFFFF"><strong>管理员登录名:</strong></td>
          <td bgcolor="#FFFFFF"><input value="<%=conn.execute("select username from ks_admin where supertf='1'")(0)%>" type="text" name="username" size=12></td>
        </tr>
        <tr>
          <td height="35" align="right" bgcolor="#FFFFFF"><strong>登录密码:</strong></td>
          <td bgcolor="#FFFFFF"><input type="password" name="password" size=12> (长度不能小于6)不想修改请留空</td>       
       </tr>
        <tr>
          <td height="35" align="right" bgcolor="#FFFFFF"><strong>确认密码:</strong></td>
          <td bgcolor="#FFFFFF"><input type="password" name="conpassword" size=12> (长度不能小于6)不想修改请留空</td>       
       </tr>
        <tr align="right">
          <td height="5" colspan="2" bgcolor="#0066CC"></td>
        </tr>
        <tr align="center">
          <td height="25" colspan="2" bgcolor="#ffffff"><input type="submit" value="确认修改"></td>
        </tr>
        </form>
      </table>
     <%
     End Sub

      Sub EditSiteSN()
       %>
     <table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#666666">
        <tr align="right">
          <td height="5" colspan="2" bgcolor="#0066CC"></td>
        </tr>
         <form name="SetWebInfoForm" method="post" action="?action=EditSN">
        <tr>
          <td height="35" align="right" bgcolor="#FFFFFF"><strong>授权系统号:</strong></td>
          <td bgcolor="#FFFFFF"><input value="<%=ks.setting(17)%>" type="text" name="sn" size=40></td>
        </tr>

        <tr align="right">
          <td height="5" colspan="2" bgcolor="#0066CC"></td>
        </tr>
        <tr align="center">
          <td height="25" colspan="2" bgcolor="#ffffff"><input type="submit" value="确认修改"></td>
        </tr>
        </form>
      </table>
     <%
           End Sub
End Class
%>
阅读全文