Marc-Senpai
Minecrafter
Hallöle,
Ich wollte eine Register php "klasse" schreiben.
Aber irgendwie klappt nichts. Bitte den fehler sagen.
Muss sagen das ich kein prof. bin (ich weiß prof. steht für Porfessor).
Freue mich über jede hilfe.
MfG marc
Ich wollte eine Register php "klasse" schreiben.
Aber irgendwie klappt nichts. Bitte den fehler sagen.
Muss sagen das ich kein prof. bin (ich weiß prof. steht für Porfessor).
HTML:
<!DOCTYPE html>
<html lang="de" >
<head>
<meta charset="UTF-8">
<title>+++++ | Registrierung</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<form class="login-form" action="register-funk.php" method="post">
<p class="login-text">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-lock fa-stack-1x"></i>
</span>
</p>
<input type="text" class="login-username" name="name" autofocus="true" required="true" placeholder="Dein Benutzername" />
<input type="password" class="login-password" required="true" name="password" placeholder="Dein Passwort" />
<input type="password" class="login-password" required="true" name="password2" placeholder="Passwort bestätigen" />
<input type="submit" name="Login" value="Registrieren" class="login-submit" />
</form>
<a href="index.php" class="login-forgot-pass">Zum Login?</a>
<div class="underlay-photo"></div>
<div class="underlay-black"></div>
</body>
</html>
PHP:
<?php
if(isset($_POST['Login'])) {
echo "2";
if ( isset($_POST['name']) and trim($_POST['name']) != ''
and
isset($_POST['password']) and trim($_POST['password']) != ''
and
isset($_POST['password2']) and trim($_POST['password2']) != ''){
echo "3";
if($_POST['password'] == $_POST['password2']) {
echo "4";
$name = $_POST['name'];
$pw = $_POST['password'];
echo "5";
$benutzer = file("users.txt");
for($i=0;$i < count($benutzer); $i++){
echo "6";
if($benutzer[$i] != $name){
echo "7";
$handle = fopen ("users.txt", w+);
fwrite ($handle, $name);
fclose ($handle);
}else
echo "Name schon vergeben";
}
}else
echo "Passwörter müssen übereinstimmen";
}else
echo "Bitte fülle alle Felder aus";
}else
echo "1";
?>
MfG marc