Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 6.31 KB | None | 0 0
  1. ;Xchange
  2. #include <ButtonConstants.au3>
  3. #include <EditConstants.au3>
  4. #include <GUIConstantsEx.au3>
  5. #include <StaticConstants.au3>
  6. #include<mysql.au3>
  7. #include <WindowsConstants.au3>
  8. #include<guiconstants.au3>
  9. #include<INetSmtpMailCom.au3>
  10. $Login = GUICreate("Login", 316, 205, 378, 183, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS))
  11. $Label1 = GUICtrlCreateLabel("Xchange Login", 0, 0, 312, 36, $SS_CENTER)
  12. GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
  13. $Benutzername = GUICtrlCreateInput("", 115, 66, 148, 21)
  14. $aPassword = GUICtrlCreateInput("", 115, 93, 148, 21, $ES_PASSWORD)
  15. $Label2 = GUICtrlCreateLabel("Benutzername:", 1, 66, 106, 20, $SS_CENTER)
  16. $Passwort = GUICtrlCreateLabel("Passwort:", -13, 94, 113, 17, $SS_CENTER)
  17. $login = GUICtrlCreateButton("Login", 12, 120, 253, 24, $WS_GROUP)
  18. $Registrierung = GUICtrlCreateButton("Registrierung", 12, 147, 253, 24, $WS_GROUP)
  19. GUISetState(@SW_SHOW)
  20.  
  21. $UserName = "xchange123"
  22. $Password = "mendax123"
  23. $Database = "xchange123"
  24. $MySQLServerName = "db4free.net"
  25. $SQL = _MySQLConnect($UserName,$Password,$Database,$MySQLServerName)
  26.  
  27.  
  28.  
  29. While 1
  30.     $nMsg = GUIGetMsg()
  31.     Switch $nMsg
  32. case $GUI_EVENT_CLOSE
  33.                         guisetstate(@SW_hide, $createaccount)
  34.                         guisetstate(@SW_enable, $login)
  35.         case $login
  36.  
  37.             sqlcheck()
  38.  
  39.  
  40.         case $Registrierung
  41.             guisetstate(@SW_disable, $login)
  42.  
  43.             $createaccount = GUICreate("Form1", 498, 376, 205, 164)
  44. $aLabel1 = GUICtrlCreateLabel("Registrierung für Xchange", 1, 0, 496, 56, $SS_SUNKEN)
  45. GUICtrlSetFont(-1, 35, 400, 0, "MS Sans Serif")
  46. $aInput1 = GUICtrlCreateInput("Gewünschter Username", 13, 80, 345, 21)
  47. $aMail = GUICtrlCreateInput("Deine Mailadresse", 14, 108, 344, 21)
  48. $aPW = GUICtrlCreateInput("Gewünschtes Passwort", 16, 135, 344, 21)
  49. $bPw= GUICtrlCreateInput("Passwort wiederholen", 15, 165, 344, 21)
  50. $aCheckbox1 = GUICtrlCreateCheckbox("Ja, ich will den Newsletter erhalten", 16, 193, 243, 21)
  51. $aCheckbox2 = GUICtrlCreateCheckbox("Ja, mir ist bewusst, dass es verboten ist, urheberrechtlich geschütztes Material zu verbreiten,", 17, 215, 387, 36)
  52. $aButton1 = GUICtrlCreateButton("Anmeldung abschicken ", 16, 255, 341, 26, $WS_GROUP)
  53. $aInput2 = GUICtrlCreateInput("Aktivierungscode", 18, 289, 343, 21)
  54. guictrlsetstate(-1, $gui_disable)
  55.             guisetstate(@sw_show, $createaccount)
  56.             while winexists("Registrierung für Xchange")
  57.                 $msg= guigetmsg()
  58.                 switch $msg
  59.                     case $aButton1
  60.                         If stringlen(guictrlread($ainput1))> 5 and stringlen(guictrlread($ainput1))<50 and stringlen(guictrlread($apw))>5 and stringlen(guictrlread($apw))<50 and guictrlread($apw)= guictrlread($bPW)   Then
  61.                             Msgbox(0, "Anmeldung erfolgreich", "Deine Anmeldung war erfolgreich. Dir wurde eine Email mit einem Aktivierungs gesendet. Gib diesen Aktivierungscode im unteren Feld ein")
  62.                             guictrlsetstate($ainput1, $gui_disable)
  63.                             guictrlsetstate($amail, $gui_disable)
  64.                             guictrlsetstate($aPw, $gui_disable)
  65.                             guictrlsetstate($bPw, $gui_disable)
  66.                             guictrlsetstate($acheckbox1, $gui_disable)
  67.                             guictrlsetstate($acheckbox2, $gui_disable)
  68.                             guictrlsetstate($ainput2, $gui_enable)
  69.                             guictrlsetdata($abutton1, "Account aktivieren")
  70.                             _registerinsql()
  71.  
  72.                         EndIf
  73.                         If guictrlread($abutton1) and guictrlread($ainput2)<> 0 then Msgbox(0, "", "")
  74.  
  75. endswitch
  76.                 wend
  77.  
  78.     EndSwitch
  79. WEnd
  80. func sqlcheck()
  81.     If not (guictrlread($apassword))=0  then
  82.     local $pw
  83.  
  84.     $SQLCode = "SELECT  Passwort FROM Members WHERE Benutzername ='"& guictrlread($benutzername)&"'"
  85. $TableContents = _Query($SQL,$SQLCode)
  86. With $TableContents
  87. While Not .EOF
  88. $pw &= .Fields ("Passwort").value
  89. .MoveNext
  90.  
  91. WEnd
  92. endwith
  93.  
  94. $readinput= guictrlread($apassword)
  95.  
  96.  
  97. If $pw= $readinput  Then
  98.     Msgbox(0, "Login erfolgreich", "Du wurdest erfolgreich angemeldet")
  99. Else
  100.     Msgbox(0, "Fehler", "Der Login-Vorgang war nicht erfolgreich")
  101.     endif
  102. endif
  103. endfunc
  104. func _registerinsql()
  105.     local $namelist
  106. $UserNamesql = "xchange123" ;MySQL User
  107. $Passwordsql = "mendax123" ;MySQL Passwort
  108. $Databasesql = "xchange123" ;Database
  109. $MySQLServerNamesql = "db4free.net" ;Hostname oder IP
  110. $SQLconnect = _MySQLConnect($UserName,$Password,$Database,$MySQLServerName)
  111. Dim $ColumnNames[5]
  112. $ColumnNames[0]= "Benutzername"
  113. $ColumnNames[1]= "Passwort"
  114. $ColumnNames[2]= "Email"
  115. $columnnames[3]= "Aktivierungsnummer"
  116. $columnnames[4]= "activated"
  117. Dim $Newaccount[5]
  118. $Newaccount[0]= guictrlread($ainput1)
  119. $Newaccount[1]= guictrlread($amail)
  120. $Newaccount[2]= guictrlread($apw)
  121. $Key = Random(0, 9, 1) & Random(0, 9, 1) & Random(0, 9, 1) & Random(0, 9, 1) & Random(0, 9, 1) & Random(0, 9, 1) & Random(0, 9, 1)
  122. $newaccount[3]= $key
  123. $newaccount[4]= "0"
  124. _AddRecord($SQLconnect,"Members",$ColumnNames,$Newaccount)
  125. endfunc
  126. Func _SendEmail($sEmail)
  127.  $Key = Random(0, 9, 1) & Random(0, 9, 1) & Random(0, 9, 1) & Random(0, 9, 1) & Random(0, 9, 1) & Random(0, 9, 1) & Random(0, 9, 1)
  128.  $SmtpServer = "smtp.web.de" ; address for the smtp-server to use - REQUIRED
  129.  $FromName = "Xchange 123" ; name from who the email was sent
  130.  $FromAddress = "" ; address from where the mail should come
  131.  $ToAddress = $sEmail; destination address of the email - REQUIRED
  132.  $Subject = "Registrierungs Bestätigung" ; subject from the email - can be anything you want it to be
  133.  $Body = "Zur Bestätigung ihrer Angaben übernehmen Sie bitte den unten stehenden Code und melden Sie sich an." & @CRLF & "Code: " & $Key & @CRLF & "Vielen Dank" & @CRLF & "Autoits Multiplayer Towerdefence Team" ; the messagebody from the mail - can be left blank but then you get a blank mail
  134.  $AttachFiles = "" ; the file you want to attach- leave blank if not needed
  135.  $CcAddress = "" ; address for cc - leave blank if not needed
  136.  $BccAddress = "" ; address for bcc - leave blank if not needed
  137.  $Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
  138.  $Username = "x_change" ; username for the account used from where the mail gets sent - REQUIRED
  139.  $Password = "mendax123" ; password for the account used from where the mail gets sent - REQUIRED
  140.  $IPPort = 587 ; port used for sending the mail normaly 25
  141.  $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS
  142.  $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
  143.  Return ($Key)
  144. EndFunc   ;==>_SendEmail
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement