Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Xchange
- #include <ButtonConstants.au3>
- #include <EditConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <StaticConstants.au3>
- #include<mysql.au3>
- #include <WindowsConstants.au3>
- #include<guiconstants.au3>
- #include<INetSmtpMailCom.au3>
- $Login = GUICreate("Login", 316, 205, 378, 183, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS))
- $Label1 = GUICtrlCreateLabel("Xchange Login", 0, 0, 312, 36, $SS_CENTER)
- GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
- $Benutzername = GUICtrlCreateInput("", 115, 66, 148, 21)
- $aPassword = GUICtrlCreateInput("", 115, 93, 148, 21, $ES_PASSWORD)
- $Label2 = GUICtrlCreateLabel("Benutzername:", 1, 66, 106, 20, $SS_CENTER)
- $Passwort = GUICtrlCreateLabel("Passwort:", -13, 94, 113, 17, $SS_CENTER)
- $login = GUICtrlCreateButton("Login", 12, 120, 253, 24, $WS_GROUP)
- $Registrierung = GUICtrlCreateButton("Registrierung", 12, 147, 253, 24, $WS_GROUP)
- GUISetState(@SW_SHOW)
- $UserName = "xchange123"
- $Password = "mendax123"
- $Database = "xchange123"
- $MySQLServerName = "db4free.net"
- $SQL = _MySQLConnect($UserName,$Password,$Database,$MySQLServerName)
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- case $GUI_EVENT_CLOSE
- guisetstate(@SW_hide, $createaccount)
- guisetstate(@SW_enable, $login)
- case $login
- sqlcheck()
- case $Registrierung
- guisetstate(@SW_disable, $login)
- $createaccount = GUICreate("Form1", 498, 376, 205, 164)
- $aLabel1 = GUICtrlCreateLabel("Registrierung für Xchange", 1, 0, 496, 56, $SS_SUNKEN)
- GUICtrlSetFont(-1, 35, 400, 0, "MS Sans Serif")
- $aInput1 = GUICtrlCreateInput("Gewünschter Username", 13, 80, 345, 21)
- $aMail = GUICtrlCreateInput("Deine Mailadresse", 14, 108, 344, 21)
- $aPW = GUICtrlCreateInput("Gewünschtes Passwort", 16, 135, 344, 21)
- $bPw= GUICtrlCreateInput("Passwort wiederholen", 15, 165, 344, 21)
- $aCheckbox1 = GUICtrlCreateCheckbox("Ja, ich will den Newsletter erhalten", 16, 193, 243, 21)
- $aCheckbox2 = GUICtrlCreateCheckbox("Ja, mir ist bewusst, dass es verboten ist, urheberrechtlich geschütztes Material zu verbreiten,", 17, 215, 387, 36)
- $aButton1 = GUICtrlCreateButton("Anmeldung abschicken ", 16, 255, 341, 26, $WS_GROUP)
- $aInput2 = GUICtrlCreateInput("Aktivierungscode", 18, 289, 343, 21)
- guictrlsetstate(-1, $gui_disable)
- guisetstate(@sw_show, $createaccount)
- while winexists("Registrierung für Xchange")
- $msg= guigetmsg()
- switch $msg
- case $aButton1
- 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
- Msgbox(0, "Anmeldung erfolgreich", "Deine Anmeldung war erfolgreich. Dir wurde eine Email mit einem Aktivierungs gesendet. Gib diesen Aktivierungscode im unteren Feld ein")
- guictrlsetstate($ainput1, $gui_disable)
- guictrlsetstate($amail, $gui_disable)
- guictrlsetstate($aPw, $gui_disable)
- guictrlsetstate($bPw, $gui_disable)
- guictrlsetstate($acheckbox1, $gui_disable)
- guictrlsetstate($acheckbox2, $gui_disable)
- guictrlsetstate($ainput2, $gui_enable)
- guictrlsetdata($abutton1, "Account aktivieren")
- _registerinsql()
- EndIf
- If guictrlread($abutton1) and guictrlread($ainput2)<> 0 then Msgbox(0, "", "")
- endswitch
- wend
- EndSwitch
- WEnd
- func sqlcheck()
- If not (guictrlread($apassword))=0 then
- local $pw
- $SQLCode = "SELECT Passwort FROM Members WHERE Benutzername ='"& guictrlread($benutzername)&"'"
- $TableContents = _Query($SQL,$SQLCode)
- With $TableContents
- While Not .EOF
- $pw &= .Fields ("Passwort").value
- .MoveNext
- WEnd
- endwith
- $readinput= guictrlread($apassword)
- If $pw= $readinput Then
- Msgbox(0, "Login erfolgreich", "Du wurdest erfolgreich angemeldet")
- Else
- Msgbox(0, "Fehler", "Der Login-Vorgang war nicht erfolgreich")
- endif
- endif
- endfunc
- func _registerinsql()
- local $namelist
- $UserNamesql = "xchange123" ;MySQL User
- $Passwordsql = "mendax123" ;MySQL Passwort
- $Databasesql = "xchange123" ;Database
- $MySQLServerNamesql = "db4free.net" ;Hostname oder IP
- $SQLconnect = _MySQLConnect($UserName,$Password,$Database,$MySQLServerName)
- Dim $ColumnNames[5]
- $ColumnNames[0]= "Benutzername"
- $ColumnNames[1]= "Passwort"
- $ColumnNames[2]= "Email"
- $columnnames[3]= "Aktivierungsnummer"
- $columnnames[4]= "activated"
- Dim $Newaccount[5]
- $Newaccount[0]= guictrlread($ainput1)
- $Newaccount[1]= guictrlread($amail)
- $Newaccount[2]= guictrlread($apw)
- $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)
- $newaccount[3]= $key
- $newaccount[4]= "0"
- _AddRecord($SQLconnect,"Members",$ColumnNames,$Newaccount)
- endfunc
- Func _SendEmail($sEmail)
- $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)
- $SmtpServer = "smtp.web.de" ; address for the smtp-server to use - REQUIRED
- $FromName = "Xchange 123" ; name from who the email was sent
- $FromAddress = "" ; address from where the mail should come
- $ToAddress = $sEmail; destination address of the email - REQUIRED
- $Subject = "Registrierungs Bestätigung" ; subject from the email - can be anything you want it to be
- $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
- $AttachFiles = "" ; the file you want to attach- leave blank if not needed
- $CcAddress = "" ; address for cc - leave blank if not needed
- $BccAddress = "" ; address for bcc - leave blank if not needed
- $Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
- $Username = "x_change" ; username for the account used from where the mail gets sent - REQUIRED
- $Password = "mendax123" ; password for the account used from where the mail gets sent - REQUIRED
- $IPPort = 587 ; port used for sending the mail normaly 25
- $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS
- $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
- Return ($Key)
- EndFunc ;==>_SendEmail
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement