#NoTrayIcon
#Include <Array.au3>
#Include <GuiEdit.au3>
#include <WindowsConstants.au3>
$dir = @ScriptDir&"\Data.ini"
$Form1 = GUICreate("登陆界面", 330, 220)
$Label1 = GUICtrlCreateLabel("账号:", 40, 50, 52, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("密码:", 40, 100, 52, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("注册", 260, 50, 36, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("", 90, 50, 160, 21)
$Input2 = GUICtrlCreateInput("", 90, 100, 160, 21, BitOR($ES_LOWERCASE, $ES_PASSWORD))
$Button1 = GUICtrlCreateButton("登陆", 100, 168, 70, 30, $WS_GROUP)
$Button2 = GUICtrlCreateButton("退出", 200, 168, 70, 30, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button2 ,-3
Exit
Case $Button1
Login()
Case $Label3
zhuce()
EndSwitch
WEnd
Func Login()
$zh = GUICtrlRead($Input1)
$Pass = GUICtrlRead($Input2)
If $zh <> '' And $Pass <> '' Then
$a = IniRead($dir, "Data", $zh, "NotFound")
If $a == $Pass Then
MsgBox(64,'提示','登陆成功,谢谢使用。')
Else
MsgBox(48 ,'错误' ,'密码错误,请确认。')
EndIf
Else
MsgBox(48 ,'错误' ,'请正确输入登陆信息')
EndIf
EndFunc
Func zhuce()
GUISetState(@SW_DISABLE,$Form1)
$Form11 = GUICreate("注册账号", 300, 260)
$Label11 = GUICtrlCreateLabel("账号:", 50, 30, 52, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label12 = GUICtrlCreateLabel("密码:", 50, 100, 52, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label13 = GUICtrlCreateLabel("确认密码:", 20, 150, 84, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Input11 = GUICtrlCreateInput("", 100, 30, 150, 21)
$Input12 = GUICtrlCreateInput("", 100, 100, 150, 21, BitOR($ES_LOWERCASE, $ES_PASSWORD))
$Input13 = GUICtrlCreateInput("", 100, 150, 150, 21, BitOR($ES_LOWERCASE, $ES_PASSWORD))
$Button11 = GUICtrlCreateButton("注册", 100, 200, 60, 30, $WS_GROUP)
$Button12 = GUICtrlCreateButton("取消", 200, 200, 60, 30, $WS_GROUP)
$Button13 = GUICtrlCreateButton("确认账号是否可用", 100, 55, 150, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3,$Button12
GUISetState(@SW_ENABLE,$Form1)
GUIDelete($Form11)
ExitLoop
Case $Button11
$zh = GUICtrlRead($Input11)
$Pass1 = GUICtrlRead($Input12)
$Pass2 = GUICtrlRead($Input13)
If $zh <> "" And $Pass1 <> "" And $Pass2 <> "" Then
If $Pass1 == $Pass2 Then
IniWrite ( $dir, "Data", $zh, $Pass1 )
MsgBox(64 ,'提示' ,'注册成功')
Else
MsgBox(48 ,'错误' ,'请确认两次密码输入相同')
EndIf
Else
MsgBox(48 ,'错误' ,'请正确输入注册信息')
EndIf
Case $Button13
$a = IniReadSection($dir ,"Data")
$zh = GUICtrlRead($Input11)
If $zh <> '' Then
If _ArraySearch($a, $zh) = -1 Then
GUICtrlSetData($Button13,'此账号可用')
Else
GUICtrlSetData($Button13,'此账号已注册')
EndIf
Else
GUICtrlSetData($Button13,'账号不能留空')
EndIf
EndSwitch
WEnd
EndFunc