Sign in to follow this  
Followers 0
erifash

Registration script

1 post in this topic

Here is a simple registration script that allows you to verify a username and password. Just in case anyone was interested! :)

#include <GUIConstants.au3>

$gui = GUICreate("Register", 300, 131)
GUICtrlCreateLabel("Input Password", 3, 3, 100, 15)
$pass = GuiCtrlCreateInput("", 100, 0, 240, 20, 0x20)
GUICtrlCreateLabel("Confirm Password", 3, 23, 100, 15)
$conf = GuiCtrlCreateInput("", 100, 20, 240, 20, 0x20)

$code = ""
$len = Random(6, 11, 1)
Dim $text[$len + 1]
$text[0] = $len
For $i = 1 to $text[0]
  $text[$i] = Chr(Random(65, 90, 1))
  $code = $code & $text[$i]
  GUICtrlCreateLabel($text[$i], $i * Random(20, 22, 1), 45 + Random(0, Random(3, 11, 1), 1), 10, 18)
Next

GUICtrlCreateLabel("Confirmation Code", 3, 80, 100, 15)
$deco = GuiCtrlCreateInput("", 100, 77, 240, 20)
$submit = GuiCtrlCreateButton("S u b m i t", 150, 100, 150, 30, $BS_DEFPUSHBUTTON)
GUICtrlCreateLabel("Made by: Erifash", 30, 106, 100, 15)

GUISetState()

While 1
  ui_loop()
  If MsgBox(4, "Register", "Are you sure you want to exit?") = 6 Then Exit
Wend

Func ui_loop()
  $msg = -1
  While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    If $msg = $submit Then checkreg()
    Sleep(10)
  Wend
EndFunc

Func checkreg()
  $err = 0
  If GUICtrlRead($pass) = "" and GUICtrlRead($conf) = "" Then Assign("err", 1, 0*MsgBox(0, "Error", "Password fields are blank!"))
  If GUICtrlRead($pass) <> GUICtrlRead($conf) Then Assign("err", 1, 0*MsgBox(0, "Error", "Passwords do not match!"))
  If GUICtrlRead($deco) <> $code Then Assign("err", 1, 0*MsgBox(0, "Error", "Confirmation code is incorrect!"))
  If $err Then Exit
  register_user()
EndFunc

Func register_user()
  MsgBox(0, "Register", "You are registered.")
  Exit
EndFunc

You can do whatever you want within the register_user function.

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0