connect_error) { echo("An error occured, please try later"); exit(); } $stmt = $con->prepare("SELECT action FROM `confirmation-pending` WHERE id = ?;"); $stmt->bind_param("s", $_GET["id"]); $stmt->execute(); $result = $stmt->get_result(); $res = $result->fetch_assoc(); $stmt->close(); if ($res == Null) { echo("Invalid Link"); exit(); } $res = json_decode($res["action"]); $action = $res->action; if ($action == "signup") { $stmt = $con->prepare("INSERT INTO `aircraft-devs` (acid, user) VALUES (?, ?);"); $stmt->bind_param("ss", $res->acid, $res->email); $stmt->execute(); $stmt->close(); $stmt = $con->prepare("DELETE FROM `confirmation-pending` WHERE id = ?;"); $stmt->bind_param("s", $_GET["id"]); $stmt->execute(); $stmt->close(); echo("You're successfully signed up"); } else if ($action == "signoff") { if ($res->acid == "all") { $stmt = $con->prepare("DELETE FROM `aircraft-devs` WHERE user = ?;"); $stmt->bind_param("s", $res->email); $stmt->execute(); $stmt->close(); echo("You're successfully signed off from all aircraft"); } else { $stmt = $con->prepare("DELETE FROM `aircraft-devs` WHERE user = ? AND acid = ?;"); $stmt->bind_param("ss", $res->email, $res->acid); $stmt->execute(); $stmt->close(); echo("Your successfully signed off from " . $res->acid); } $stmt = $con->prepare("DELETE FROM `confirmation-pending` WHERE id = ?;"); $stmt->bind_param("s", $_GET["id"]); $stmt->execute(); $stmt->close(); } } else { echo("Invalid link"); } ?>