Created
September 25, 2016 14:48
-
-
Save steffengrahl/1d43e627d21865eca0208867d41409e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL); | |
if (isset($_POST['submit'])) { | |
$email = ''; | |
$username = ''; | |
$passwort = ''; | |
$passwort2 = ''; | |
$vorname = ''; | |
$nachname = ''; | |
$mysqli = new mysqli("localhost","root","","user"); | |
if($mysqli->connect_errno) { | |
die('Verbindung zur Datenbank gescheitert. <br>'.$mysqli->connect_error); | |
} | |
if (isset($_POST['email']) && !empty($_POST['email'])) { | |
$email = $mysqli->real_escape_string($_POST['email']); | |
} | |
if (isset($_POST['username']) && !empty($_POST['username'])) { | |
$username = $mysqli->real_escape_string($_POST['username']); | |
} | |
if (isset($_POST['passwort']) && !empty($_POST['passwort'])) { | |
$passwort = $mysqli->real_escape_string($_POST['passwort']); | |
} | |
if (isset($_POST['passwort2']) && !empty($_POST['passwort2'])) { | |
$passwort2 = $mysqli->real_escape_string($_POST['passwort2']); | |
} | |
if (isset($_POST['vorname']) && !empty($_POST['vorname'])) { | |
$vorname = $mysqli->real_escape_string($_POST['vorname']); | |
} | |
if (isset($_POST['nachname']) && !empty($_POST['nachname'])) { | |
$nachname = $mysqli->real_escape_string($_POST['nachname']); | |
} | |
$eintrag="INSERT INTO | |
`anmeldung` (`email`, `username`, `password`, `vorname`, `nachname`) | |
VALUES ('$email', '$username', '$passwort', '$vorname', '$nachname');"; | |
if (!$mysqli->query($eintrag)) { | |
echo htmlspecialchars($eintrag); | |
} else { | |
echo "Neuer Nutzer erfolgreich eingetragen."; | |
} | |
} else { | |
die('Access denied'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment