⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin.au3

📁 宽带管理系统源码
💻 AU3
📖 第 1 页 / 共 4 页
字号:
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <IPAddressConstants.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <StatusBarConstants.au3>
#include <WindowsConstants.au3>
#include <GuiIPAddress.au3>
#include <GuiStatusBar.au3>
#include <GUIConstants.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <GuiDateTimePicker.au3>
#include <Date.au3>
#AutoIt3Wrapper_icon=d:\autoit3\Aut2Exe\Icons\norton1.ico
#AutoIt3Wrapper_Res_Comment=宽带管理V1.0
#AutoIt3Wrapper_Res_Description=宽带管理V1.0
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=帅哥命苦
$g_szVersion = "S_data"
If WinExists($g_szVersion) Then Exit ; 此脚本已经运行了
AutoItWinSetTitle($g_szVersion)
TraySetState (2)
;~ FileInstall("login.jpg", "login.jpg",0)
;~ FileInstall("top.jpg", "top.jpg",0)
Local $aParts[3] = [501,618,718] ;定义状态栏宽度
Local $datadir = "data.mdb"
local $acc_pwd = "supervisor9958123"
Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER)
local $Date_time = @YEAR&"\"&@MON&"\"&@MDAY&","&@HOUR&":"&@MIN
local $Date1_data = @YEAR&"年"&@MON&"月"&@MDAY&"日"
$Form1_1 = GUICreate("宽带管理软件 v1.0", 781, 586)
$Group1 = GUICtrlCreateGroup("", 2, 0, 777, 89)
$Pic1 = GUICtrlCreatePic("top.jpg", 8, 16, 62, 65)
GUICtrlCreateLabel("名称:", 96, 24, 43, 17)
GUICtrlCreateLabel("权限:", 96, 57, 43, 17)
GUICtrlCreateGroup("", 8, 10, 65, 70)
$User_name_Label = GUICtrlCreateLabel("", 136, 24, 64, 17)
$Authority_Label = GUICtrlCreateLabel("", 136, 57, 64, 17)
GUICtrlSetColor(-1, 0x008000)
$Button13 = GUICtrlCreateButton("↓", 77, 18, 12, 60, $BS_FLAT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Search_Button = GUICtrlCreateButton("查找", 720, 56, 42, 21)
GUICtrlSetBkColor(-1, 0xCAE1FF)
GUICtrlSetState(-1,$GUI_DEFBUTTON)
$Keys_Input = GUICtrlCreateInput("请输入查询条件", 496, 56, 137, 20 )
$Combo1 = GUICtrlCreateCombo("按姓名", 640, 56, 73, 25)
GUICtrlSetData(-1, "按MAC地址|按IP地址|按状态")
$Add_Button = GUICtrlCreateButton("客户录入", 242, 18, 80, 25)
GUICtrlSetFont(-1, 9, 400, 0, "宋体")
GUICtrlSetBkColor(-1, 0xCAE1FF)
$Button3 = GUICtrlCreateButton("查询统计", 352, 18, 80, 25)
GUICtrlSetFont(-1, 9, 400, 0, "宋体")
GUICtrlSetBkColor(-1, 0xCAE1FF)
$Sezhi_Button = GUICtrlCreateButton("系统设置", 462, 18, 80, 25)
GUICtrlSetFont(-1, 9, 400, 0, "宋体")
GUICtrlSetBkColor(-1, 0xCAE1FF)
$Bak_Button = GUICtrlCreateButton("数据备分", 572, 18, 80, 25)
GUICtrlSetFont(-1, 9, 400, 0, "宋体")
GUICtrlSetBkColor(-1, 0xCAE1FF)
$MAC_Button = GUICtrlCreateButton("MAC 管理", 682, 18, 80, 25)
GUICtrlSetFont(-1, 9, 400, 0, "宋体")
GUICtrlSetBkColor(-1, 0xCAE1FF)
$Date1 = GUICtrlGetHandle(GUICtrlCreateDate( "",242, 57, 231, 19))
_GUICtrlDTP_SetFormat($Date1, "ddd MMM dd, yyyy hh:mm ttt")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$ListView1 = GUICtrlCreateListView("姓名|IP地址|MAC地址|开户日期|到期日期|状态", 2, 96, 585, 465)
GUICtrlSendMsg($ListView1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
_GUICtrlListView_SetColumnWidth($ListView1, 0, 130)
_GUICtrlListView_SetColumnWidth($ListView1, 5, 40)
$menu1 = GUICtrlCreateContextMenu($ListView1)
$xufei_menu = GUICtrlCreateMenuItem("续费记录", $menu1)
$del = GUICtrlCreateMenuItem("删除客户", $menu1)
GUICtrlCreateMenuItem("", $menu1)
$Search_all = GUICtrlCreateMenuItem("全部客户", $menu1)
$Search_z = GUICtrlCreateMenuItem("正常客户", $menu1)
$Search_t = GUICtrlCreateMenuItem("到期客户", $menu1)
$Search_o = GUICtrlCreateMenuItem("在线检测", $menu1)
GUICtrlCreateGroup("", 592, 90, 187, 471)
GUICtrlCreateLabel("客户姓名:", 600, 112, 64, 17)
GUICtrlCreateLabel("I P 地址:", 600, 140, 64, 17)
GUICtrlCreateLabel("MAC 地址:", 600, 168, 64, 17)
GUICtrlCreateLabel("开户日期:", 600, 196, 64, 17)
GUICtrlCreateLabel("到期日期:", 600, 224, 64, 17)
GUICtrlCreateLabel("用户状态:", 600, 252, 64, 17)
GUICtrlCreateLabel("在线状态:", 601, 280, 64, 17)
GUICtrlCreateLabel("联系电话:", 600, 308, 64, 17)
GUICtrlCreateLabel("联系地址:", 601, 336, 64, 17)
$Name_Input_1 = GUICtrlCreateInput("", 663, 108, 108, 21)
$IPAddress_1 = _GUICtrlIpAddress_Create($Form1_1, 663, 136, 108, 21)
$Mac_Input_1 = GUICtrlCreateInput("", 663, 164, 108, 21,$ES_UPPERCASE+$ES_AUTOVSCROLL)
$Date1_Input_1 = GUICtrlCreateDate("", 663, 192, 108, 21)
$Date2_Input_1 = GUICtrlCreateDate("", 663, 220, 108, 21)
$State_Label = GUICtrlCreateLabel("未知", 663, 252, 37, 15)
GUICtrlSetColor(-1, 0xFF0000)
$Online_Label = GUICtrlCreateLabel("未知", 663, 280, 37, 15)
GUICtrlSetColor(-1, 0xFF0000)
$Online_Checkbox_1 = GUICtrlCreateCheckbox("自动检测", 703, 278, 65, 17)
$Tel_Input_1 = GUICtrlCreateInput("", 665, 304, 105, 21,$ES_AUTOVSCROLL)
$Address_Input_1 = GUICtrlCreateInput("", 665, 332, 105, 21)
$Remarks_Edit_1 = GUICtrlCreateEdit("", 600, 360, 170, 81,$ES_AUTOVSCROLL)
GUICtrlSetTip(-1,"此处可填写备注信息,方便管理!","提示:",1)
GUICtrlSetColor(-1, 0x008000)
$Xufei_Button = GUICtrlCreateButton("客户续费", 608, 456, 65, 24)
GUICtrlSetBkColor(-1, 0xCAE1FF)
$Xiugai_Button = GUICtrlCreateButton("资料保存", 696, 456, 65, 24)
GUICtrlSetBkColor(-1, 0xCAE1FF)
$Kongzhi_Button = GUICtrlCreateButton("远程控制", 608, 490, 65, 24)
GUICtrlSetBkColor(-1, 0xCAE1FF)
$Chaxun_Button = GUICtrlCreateButton("缴费查询", 696, 490, 65, 24)
GUICtrlSetBkColor(-1, 0xCAE1FF)
$Mac_jiance_Button = GUICtrlCreateButton("MAC 检测", 608, 522, 65, 24)
GUICtrlSetBkColor(-1, 0xCAE1FF)
$Shanchu_Button = GUICtrlCreateButton("删除用户", 696, 522, 65, 24)
GUICtrlSetBkColor(-1, 0xCAE1FF)
_zhuangtai(1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
_GUICtrlStatusBar_SetMinHeight($StatusBar1, 20)
_GUICtrlStatusBar_SetParts ($StatusBar1, $aParts)
_GUICtrlStatusBar_SetText ($StatusBar1, "  作者: 帅哥命苦     ",1)
_GUICtrlStatusBar_SetText ($StatusBar1, "  联系QQ: 76594695    ",2)
$login_user = _login()
if $login_user <> 1 then
HotKeySet("{ESC}", "_no")
GUICtrlSetData($User_name_Label,$login_user)
$User_Authority = _login_Authority($login_user)
GUICtrlSetData($Authority_Label,$User_Authority)
GUISetState(@SW_SHOW)
GUISetBkColor (0xCAE1FF)
_sql()

_GUICtrlListView_RegisterSortCallBack($ListView1)
While 1
        $msg = GUIGetMsg()
	Select
        Case $msg = $GUI_EVENT_CLOSE
			    ExitLoop
		Case $msg = $ListView1
				_GUICtrlListView_SortItems($ListView1, GUICtrlGetState($ListView1))
		Case $msg = $Search_o
				_sql_ip()
		Case $msg = $MAC_Button
				_login_xr()
		Case $msg = $del Or $msg = $Shanchu_Button
				_delete();调用删除用户函数
		Case $msg = $Add_Button 
			    _Add_gui();调用添加客户函数,含窗口GUI函数
		Case $msg = $Bak_Button
			    _bak();调用数据库备份函数,含窗口GUI函数
		Case $msg = $Sezhi_Button
                 _Sezhi_gui($login_user)
		Case $msg = $Chaxun_Button or $msg = $xufei_menu
				_log_gui(_GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 0))				 
		Case $msg = $Search_Button
				$Combo1data = GUICtrlRead($Combo1)
				$keys = GUICtrlRead($Keys_Input)
				if $keys<> "" and $keys <> "请输入查询条件" then 
					$bar_name = "查询到与条件相符的用户总数为:"
			    _sql_Search($Combo1data,$keys,$bar_name);调用数据库搜索函数
			Else
				MsgBox(64,"提示:","请输入查询条件")
			   EndIf
		Case $msg = $Mac_jiance_Button
				$sIP = _GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 1)
				$Mac_1 =  GUICtrlRead($Mac_Input_1)
				$Get_mac = _GetMAC($sIP)
 				if $Get_mac = "00-00-00-00-00-00" then  
					MsgBox (64,"提示:","该客户机器不在线,检测MAC地址中断")
				Else
					if $Get_mac = $Mac_1 THEN 
						MsgBox (64,"提示:","该客户机器MAC地址为: "& $Get_mac )
					Else
						if MsgBox (8192 + 256 + 32 + 4,"提示:","该客户机器MAC地址为: "& $Get_mac &" 与数据库IP地址不相符,是否更新到数据库") = 6 then 
						    GUICtrlSetData($Mac_Input_1,$Get_mac)
                            MsgBox(64,"提示:","MAC地址已经更新,点击修改资料按钮更新到数据!")						
						EndIf
                    EndIf
				EndIf
	    Case $msg = $Search_all
				_sql();调用添加客户函数,含窗口GUI函数
		Case $msg = $Search_z
				_sql_Search("按状态","正常","查询正常用户总数为:")
		Case $msg = $Search_t
				_sql_Search("按状态","到期","查询到期用户总数为:")
        Case $msg = $GUI_EVENT_PRIMARYDOWN
                $pos = GUIGetCursorInfo();返回数组$pos[4] 表示鼠标下面的控件的控件ID( 0 为没有或者无法获取)
                if $pos <> 0 then 
                If ($pos[4] == $listview1) Then _chakan()
			EndIf
		Case $msg = $Xiugai_Button
			    $Name_1 = _GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 0)
				$Name_new = GUICtrlRead($Name_Input_1)
				$Tel_1 =  GUICtrlRead($Tel_Input_1)
				$Mac_1 =  GUICtrlRead($Mac_Input_1)
                $Ip_1 = _GUICtrlIpAddress_Get($IPAddress_1)
				$Address_1 =  GUICtrlRead($Address_Input_1)		
				$Date1_1 = GUICtrlRead($Date1_Input_1)
				$Date2_1 = GUICtrlRead($Date2_Input_1)
				$Remarks_1 = GUICtrlRead($Remarks_Edit_1)
				if 	$Ip_1= "" or $Date1_1 = "" or $Date2_1 = "" or $Mac_1  = ""  or $Tel_1 = "" or $Address_1 = "" then 
					MsgBox (0+16,"提示:","用户资料不能修改为空!")
					Else
				    IF $Name_1 <> "" and MsgBox(8192 + 256 + 32 + 4, "警告提示:", "是否修改客户:『"& $Name_1 &"』点否取消操作!!!")=6 Then 
					     _sql_edit($Name_1,$Name_new,$Tel_1,$Mac_1,$Ip_1,$Address_1,$Date1_1,$Date2_1,$Remarks_1)
				         MsgBox (0+64,"成功","用户:『"& $Name_new &"』 数据修改成功")
				    Else
				    EndIf
				EndIf
			Case $msg = $Xufei_Button
				_xufei(_GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 0))
	EndSelect
WEnd
_GUICtrlListView_UnRegisterSortCallBack($ListView1)
Else
	Exit ;如果登陆窗口函数返回1 程序自动退出
EndIf


Func _chakan();查看用户
	If _GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 0) <>"" then 
        if StringStripWS($User_Authority,8)= "管理员" then _zhuangtai(0)
	    GUICtrlSetData($Name_Input_1,_GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 0))
		_GUICtrlIpAddress_Set($IPAddress_1,_GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 1))
		GUICtrlSetData($Mac_Input_1,_GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 2))
		GUICtrlSetData($Date1_Input_1,_Date_z( _GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 3),1))
		GUICtrlSetData($Date2_Input_1,_Date_z( _GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 4),1))
		GUICtrlSetData($State_Label,_GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 5))
		if GUICtrlRead ($Online_Checkbox_1) = 1 Then
			GUICtrlSetData($Online_Label,"检测中")
		    IF _ping (_GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 1)) = 0 Then
			GUICtrlSetData($Online_Label,"在线")
		     Else
			GUICtrlSetData($Online_Label,"不在线")
		    EndIf
		Else
		    GUICtrlSetData($Online_Label,"未知")
		EndIf
		$Name_data = _GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 0)
	    $conn = ObjCreate("ADODB.Connection")
	    $RS = ObjCreate("ADODB.Recordset")
	    $conn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & $datadir& ";Jet Oledb:Database Password="&$acc_pwd)
	    $RS.ActiveConnection = $conn
        $RS.Open ('Select * From S_data where '  & "Name" &  '=' & '"' & $Name_data & '"')
		While (Not $RS.eof And Not $RS.bof)
			GUICtrlSetData($Address_Input_1,$RS.Fields (5).value)
			GUICtrlSetData($Tel_Input_1,$RS.Fields (4).value)
			GUICtrlSetData($Remarks_Edit_1,$RS.Fields (8).value)
			$RS.movenext
		WEnd
		$RS.close
	Else
		_zhuangtai(1)
	EndIf
EndFunc

Func _delete();删除用户
if StringStripWS($User_Authority,8)= "管理员" then
	 $name = _GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 0)
	If  $name <>"" then 
	if MsgBox(8192 + 256 + 32 + 4, "警告提示:", "是否删除客户:『"& $name &"』 该操作不可逆,点否取消操作!!!")=6 then
		$conn = ObjCreate("ADODB.Connection")
		$conn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & $datadir& ";Jet Oledb:Database Password="&$acc_pwd)
		$conn.Execute("Delete  From S_data Where  Name ='" & _GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetNextItem($ListView1), 0)& "'")
		$conn.close
		_delete_log($name,0)
		MsgBox(0,"提示:","删除客户:『"& $name &"』记录成功!")
       _sql()
    EndIf
    Else
	MsgBox(64,"错误:","请在列表中选择一位用户记录进行操作!!!")

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -