diff --git a/process-signup.php b/process-signup.php new file mode 100644 index 0000000..c2dc8f7 --- /dev/null +++ b/process-signup.php @@ -0,0 +1,80 @@ +real_escape_string($_POST["nfc"])); + +$result = $mysqlinfc->query($sqlnfc); +$user = $result->fetch_row(); +print_r($user); +print_r($user[0]); + +if ($user[0] > 0 ) { + $mysqli = require __DIR__ . "/database.php"; + + $sql = "INSERT INTO user (name, email, password_hash, nfc) + VALUES (?, ?, ?, ?)"; + + $stmt = $mysqli->stmt_init(); + + if ( ! $stmt->prepare($sql)) { + die("SQL error: " . $mysqli->error); + } + + $stmt->bind_param("ssss", + $_POST["name"], + $_POST["email"], + $password_hash, + $_POST["nfc"]); + + if ($stmt->execute()) { + header("Location: signup-success.html"); + exit; + + } else { + if ($mysqli->errno === 1062) { + die("email already taken"); + } else { + die($mysqli->error . " " . $mysqli->errno); + } + } +} else { + echo "no"; +} + +?>