SHARE
TWEET

Untitled

a guest Aug 12th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  11. global $UserNamesql = "xchange123" ;MySQL User
  12. global $Passwordsql = "mendax123" ;MySQL Passwort
  13. global $Databasesql = "xchange123" ;Database
  14. global $MySQLServerNamesql = "db4free.net" ;Hostname oder IP
  15. global $key
  16. $Login = GUICreate("Login", 316, 205, 378, 183, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_POPUP, $WS_GROUP, $WS_CLIPSIBLINGS))
  17. $Label1 = GUICtrlCreateLabel("Xchange Login", 0, 0, 312, 36, $SS_CENTER)
  18. GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
  19. $Benutzername = GUICtrlCreateInput("", 115, 66, 148, 21)
  20. $aPassword = GUICtrlCreateInput("", 115, 93, 148, 21, $ES_PASSWORD)
  21. $Label2 = GUICtrlCreateLabel("Benutzername:", 1, 66, 106, 20, $SS_CENTER)
  22. $Passwort = GUICtrlCreateLabel("Passwort:", -13, 94, 113, 17, $SS_CENTER)
  23. $Login = GUICtrlCreateButton("Login", 12, 120, 253, 24, $WS_GROUP)
  24. $Registrierung = GUICtrlCreateButton("Registrierung", 12, 147, 253, 24, $WS_GROUP)
  25. GUISetState(@SW_SHOW)
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. While 1
  33.     $nMsg = GUIGetMsg()
  34.     Switch $nMsg
  35.         Case $GUI_EVENT_CLOSE
  36.             GUISetState(@SW_HIDE, $createaccount)
  37.             GUISetState(@SW_ENABLE, $Login)
  38.         Case $Login
  39.             sqlcheck()
  40.         Case $Registrierung
  41.             GUISetState(@SW_DISABLE, $Login)
  42.  
  43.             $createaccount = GUICreate("Registrierung für Xchange", 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.  
  57.             While WinExists("Registrierung für Xchange")
  58.                 $msg = GUIGetMsg($createaccount)
  59.  
  60.                 Switch $msg
  61.                     case $GUI_EVENT_CLOSE
  62.                         guisetstate(@SW_show,$login)
  63.                         guidelete($createaccount)
  64.  
  65.                     Case $aButton1
  66.                         Msgbox(0, "", "")
  67.                         If GUICtrlRead($aButton1) = "Anmeldung abschicken" and stringlen(guictrlread($ainput1))>4 and stringlen(guictrlread($ainput1))<30 and stringlen(guictrlread($amail))>4 and stringlen(guictrlread($amail))<30 and stringlen(guictrlread($apw))>4 _
  68.                             and stringlen(guictrlread($apw))<30 and guictrlread($apw)=guictrlread($bpw) and guictrlread($acheckbox2)= $gui_checked Then
  69.                             MsgBox(0, "Anmeldung abgeschickt", "Deine Anmeldung wurde abgeschickt. Dir wurde eine Email mit einem Aktivierungscode gesendet. Gib diesen Aktivierungscode im unteren Feld ein")
  70.                             GUICtrlSetState($aInput1, $gui_disable)
  71.                             GUICtrlSetState($aMail, $gui_disable)
  72.                             GUICtrlSetState($aPW, $gui_disable)
  73.                             GUICtrlSetState($bPw, $gui_disable)
  74.                             GUICtrlSetState($aCheckbox1, $gui_disable)
  75.                             GUICtrlSetState($aCheckbox2, $gui_disable)
  76.                             GUICtrlSetState($aInput2, $gui_enable)
  77.                             GUICtrlSetData($aButton1, "Account aktivieren")
  78.                             _registerinsql()
  79.     _sendemail(guictrlread($amail))
  80.  
  81.                         else
  82.                             Msgbox(0, "Fehler", "Der Benutzername darf min. 5 und max 30 Zeichen haben." &@crlf& "Die Emailadresse darf max 30 Zeichen haben."&@crlf&  "Das Passwort darf min. 5 und max. 30 Zeichen haben."&@crlf& "Die zwei Passwörter müssen übereinstimmen und du musst die 'Mini-AGBs' akzeptieren")
  83.                         EndIf
  84.                         If Guictrlread($abutton1)= "Account aktivieren" then
  85.                             $SQLconnect = _MySQLConnect($UserNamesql,$Passwordsql,$Databasesql,$MySQLServerNamesql)
  86.                             $SQLCode = "SELECT Aktivierungsnummer FROM Members WHERE Aktivierungsnummer='" & GUICtrlRead($aInput1) & "'"
  87.                             $TableContents = _Query($SQLconnect, $SQLCode)
  88.         With $TableContents
  89.             While Not .EOF
  90.                 $aktivierungscode &= .Fields("Aktivierungsnummer" ).value &  @CRLF
  91.                 .MoveNext
  92.  
  93.             WEnd
  94.         EndWith
  95.         endif
  96.                         If guictrlread($aInput2)=  $aktivierungscode Then
  97.  
  98.                         Msgbox(0, "Aktivierung erfolgreich", "Deine Anmeldung war erfolgreich. Der Account ist nun freigeschalten und du kannst dich einloggen")
  99.                     Else
  100.                         Msgbox(0, "Fehler", "Falscher Aktivierungscode")
  101.                         endif
  102.                 EndSwitch
  103.             WEnd
  104.  
  105.     EndSwitch
  106. WEnd
  107. Func sqlcheck()
  108.     If not (GUICtrlRead($aPassword)) = 0 Then
  109.         Local $pw
  110.  
  111.         $SQLCode = "SELECT  Passwort FROM Members WHERE Benutzername ='" & GUICtrlRead($Benutzername) & "'"
  112.         $TableContents = _Query($SQLconnect, $SQLCode)
  113.         With $TableContents
  114.             While Not .EOF
  115.                 $pw &= .Fields("Passwort" ).value &  @CRLF
  116.                 .MoveNext
  117.  
  118.             WEnd
  119.         EndWith
  120.  
  121.         $readinput = GUICtrlRead($aPassword)
  122.  
  123.  
  124.         If $pw = $readinput Then
  125.             MsgBox(0, "Login erfolgreich", "Du wurdest erfolgreich angemeldet")
  126.         Else
  127.             MsgBox(0, "Fehler", "Der Login-Vorgang war nicht erfolgreich")
  128.         EndIf
  129.     EndIf
  130. EndFunc   ;==>sqlcheck
  131.  
  132.  
  133. Func _registerinsql()
  134.  
  135.  
  136.     $SQLconnect = _MySQLConnect($UserNamesql, $Passwordsql, $Databasesql, $MySQLServerNamesql)
  137.     Dim $ColumnNames[5]
  138.     $ColumnNames[0] = "Benutzername"
  139.     $ColumnNames[1] = "Passwort"
  140.     $ColumnNames[2] = "Email"
  141.     $ColumnNames[3] = "Aktivierungsnummer"
  142.     $ColumnNames[4] = "activated"
  143.     Dim $Newaccount[5]
  144.     $Newaccount[0] = GUICtrlRead($aInput1)
  145.     $Newaccount[1] = GUICtrlRead($aMail)
  146.     $Newaccount[2] = GUICtrlRead($aPW)
  147.     $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)
  148.     $Newaccount[3] = $Key
  149.     $Newaccount[4] = 0
  150.     _AddRecord($SQLconnect, "Members", $ColumnNames, $Newaccount)
  151. EndFunc   ;==>_registerinsql
  152. Func _SendEmail($sEmail)
  153.  
  154.     $SmtpServer = "smtp.web.de" ; address for the smtp-server to use - REQUIRED
  155.     $FromName = "Xchange" ; name from who the email was sent
  156.     $FromAddress = "" ; address from where the mail should come
  157.     $ToAddress = $sEmail; destination address of the email - REQUIRED
  158.     $Subject = "Registrierungs Bestätigung" ; subject from the email - can be anything you want it to be
  159.     $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 & "Das Xchange Team" ; the messagebody from the mail - can be left blank but then you get a blank mail
  160.     $AttachFiles = "" ; the file you want to attach- leave blank if not needed
  161.     $CcAddress = "" ; address for cc - leave blank if not needed
  162.     $BccAddress = "" ; address for bcc - leave blank if not needed
  163.     $Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
  164.     $UserName = "x_change" ; username for the account used from where the mail gets sent - REQUIRED
  165.     $Password = "mendax123" ; password for the account used from where the mail gets sent - REQUIRED
  166.     $IPPort = 587 ; port used for sending the mail normaly 25
  167.     $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS
  168.     $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $UserName, $Password, $IPPort, $ssl)
  169.     Return ($Key)
  170. EndFunc   ;==>_SendEmail
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top