Grüße!
Ich habe ein Kleines Problem mit meinem Code.
Es soll ein Login werden, bei dem ich per MySQL - Verbindung User + Passwort vergleiche und ihn dann in mein Programm reinlasse. Doch mein ergoogeltes, ließ mich weiterhin in Stich, ich habe etliches Probiert, ob im Code oder in den php - Dateien.
Loginform
Die php-Dateien:
config.php
login.php
Ich hoffe, Ihr könnt mir einen Neuling, wie mir, helfen. Da ich recht neu bin, bitte nicht gleich solch scharfe Kritik, ich nehme es alles zu Übungszwecken. Da ich ein Perfektionist bin, lasse ich nicht locker, bis es einwandfrei läuft. :)
MfG
Ich habe ein Kleines Problem mit meinem Code.
Es soll ein Login werden, bei dem ich per MySQL - Verbindung User + Passwort vergleiche und ihn dann in mein Programm reinlasse. Doch mein ergoogeltes, ließ mich weiterhin in Stich, ich habe etliches Probiert, ob im Code oder in den php - Dateien.
Loginform
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <INet.au3>
$hWindow_Login = GUICreate("Login", 274, 118)
GUISetIcon("shell32.dll", -45)
GUISetFont(8, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Benutzername", 25, 14, 84, 17)
GUICtrlCreateLabel("Passwort", 53, 38, 55, 17)
$hInput_Benutzername = GUICtrlCreateInput("", 112, 12, 137, 21)
$hInput_Passwort = GUICtrlCreateInput("", 112, 36, 137, 21)
$hButton_Login = GUICtrlCreateButton("Login", 112, 72, 137, 33, $BS_DEFPUSHBUTTON)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $hButton_Login
$sBenutzername = GUICtrlRead($hInput_Benutzername)
$sPasswort = GUICtrlRead($hInput_Passwort)
If $sBenutzername <> "" And $sPasswort <> "" Then
Switch _Login($sBenutzername, $sPasswort)
Case 0
MsgBox(16, "Error", "Benutzername ist nicht registriert!")
Case 1
MsgBox(32, "Info", "Erfolgreich eingeloggt!")
Case 2
MsgBox(16, "Error", "Passwort ist falsch!")
EndSwitch
Else
MsgBox(48, "Info", "Bitte einen Bentzernamen/Passwort angeben!")
EndIf
EndSwitch
WEnd
Func _Login($sBenutzername = "", $sPasswort = "")
$iRValue = _INetGetSource("http://autoit.secretgaming.de/login.php?benutzername=" & $sBenutzername & "&passwort=" & $sPasswort)
Switch $iRValue
Case 0
Return 0
Case 1
Return 1
Case 2
Return 2
EndSwitch
EndFunc ;==>_Login
config.php
Code:
$host = "localhost"; $user = "webxx"; $pass = "xxx"; $dbase = "usr_webxx_1";
Code:
<?php
include 'config.php';
mysql_connect($host, $user, $pass);
mysql_select_db($dbase);
$Benutzername = mysql_real_escape_string($HTTP_GET_VARS['benutzername']);
$Passwort = mysql_real_escape_string($HTTP_GET_VARS['passwort']);
$result = mysql_query("SELECT * FROM User_Daten WHERE Benutzername='" . $Benutzername . "'");
$row = mysql_fetch_row($result);
if ($row)
{
// Benutzername Vorhanden
$Dbmd5Passwort = $row[1];
if (md5($Passwort) == $Dbmd5Passwort)
{
// Passwort Stimmt
echo 1;
}
else
{
// Passwort Stimmt Nicht
echo 2;
}
}
else
{
// Benutzername Nicht Vorhanden
echo 0;
}
?>
MfG