include '../model/set.php'; $array_post = array(); array_push($array_post, $_POST['surname']); array_push($array_post, $_POST['name']); array_push($array_post, $_POST['email']); array_push($array_post, $_POST['password']); array_push($array_post, $_POST['born']); array_push($array_post, $_POST['city']); array_push($array_post, $_POST['department']); array_push($array_post, $_POST['adress']); array_push($array_post, $_POST['phone']); $i = 0; $error = false; while ($i != sizeof($array_post)) { if (empty($array_post[$i])) { $error = true; } $i++; } if ($error == true) { header('Location: ../register.php?error=1'); } else { if (IsMember(hash('sha512', $_POST['email']))) { header('Location: ../register.php?error=2'); } else { $email = hash('sha512', $_POST['email']); $password = hash('sha512', $_POST['password']); AddMember($_POST['name'], $_POST['surname'], $email, $password, $_POST['born'], $_POST['city'], $_POST['department'], $_POST['adress'], $_POST['phone']); header('Location: ../index.php'); } }
<?php include_once 'data_access.php'; switch ($_SERVER["REQUEST_METHOD"]) { case 'GET': CheckMember($_GET['payload']); break; case 'POST': $postParameter = file_get_contents('php://input'); AddMember($postParameter); break; }