欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-08-06 08:29:39
操作说明,请仔细阅读操作说明后进行操作: 1、请把压缩包中的key.asp文件上传到kesioncms根目录下。 2、运行key.asp后选择您所需要的选项。 3、注意:使...
操作说明,请仔细阅读操作说明后进行操作:
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> </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"> </td>
  </tr>
  <tr>
    <td align="center" valign="bottom"> powered by <a href="http://www.kesion.com/" target="_blank"><strong> kesion.com </a>
      © 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">  
          <%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> <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"> 
            <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"> 
            <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
%>