0) { header("Location: ../index.php?error=duplicate&original=".$original); exit(); } else { $sql = "INSERT INTO users (uidUsers, firstUsers, lastUsers, pwdUsers, permissionUsers) VALUES (?,?,?,?,?)"; $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sql)) { header("Location: ../index.php?error=sqlerror&original=".$original); exit(); } else { $hashedPwd = password_hash($pwd, PASSWORD_DEFAULT); mysqli_stmt_bind_param($stmt, 'sssss', $uid, $firstname, $lastname, $hashedPwd, $permissions); mysqli_stmt_execute($stmt); $sql = "DELETE FROM newusers WHERE uidUsers = ?"; $stmt = mysqli_stmt_init($conn); if(!mysqli_stmt_prepare($stmt, $sql)) { header("Location: ../login.php?error=sqlerror&original=".$original); exit(); } else { mysqli_stmt_bind_param($stmt, 's', $original); mysqli_stmt_execute($stmt); header("Location: ../page2.php?permissions=".$permissions."&firstname=".$firstname); } } } } } } else { header("Location: ../../login.php"); exit(); }