Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // forbinder til til databasen
- include "include/connect_to_database.php";
- // tager værdierne som brugeren sætter ind i create_account.php
- $fuldeNavn = mysqli_real_escape_string($connect, $_POST['fullname']);
- $email = mysqli_real_escape_string($connect, $_POST['email']);
- $password = mysqli_real_escape_string($connect, $_POST['password']);
- $password1 = mysqli_real_escape_string($connect, $_POST['password1']);
- $profession = mysqli_real_escape_string($connect, $_POST['profession']);
- $uddannelse = mysqli_real_escape_string($connect, $_POST['uddannelse']);
- if (!isset($fullname) or !isset($email) or !isset($password) or !$password1) or !isset($profession) or !isset($uddannelse) {
- if (!isset($fullname)) {
- echo "Udfyld fulde navn";
- }
- if (!isset($email)) {
- echo "Udfyld email";
- }
- if (!isset($password)) {
- echo "Udfyld password";
- }
- if (!isset($password1)) {
- echo "Udfyld gentag password";
- }
- if (!isset($profession)) {
- echo "Udfyld profession";
- }
- if (!isset($uddannelse)) {
- echo "Udfyld uddannelse";
- }
- }
- else{
- if ($password != $password1) {
- echo "Adgangskoderne skal være de samme";
- }else{
- // Indsætter alle værdierne ind i en sql string
- $sql = "INSERT INTO users(fullname, email, password, proffession, uddannelse) VALUES ('$fuldeNavn', '$email', '$password', '$profession', '$uddannelse') ";
- // Tjekker om sql_query'en var successfuld.
- $query = mysqli_query($connect, $sql);
- if (!$query) {
- echo "der er sket en fejl";
- }else{
- echo "bruger oprettet. ";
- echo "velkommen " . $fuldeNavn;
- }
- }
- }
- // Lukker forbindelsen
- mysqli_close($connect);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement