Fix JSON handling

This commit is contained in:
Kumi 2020-09-03 09:26:26 +02:00
parent af208db0a4
commit ac52f56357

View file

@ -10,9 +10,7 @@ use PHPMailer\PHPMailer\Exception;
$mailer = new PHPMailer(true);
try {
if (!$_POST) throw new Exception("There is nothing here.");
$json = json_decode(file_get_contents('php://input'));
if (!$json = json_decode(file_get_contents('php://input'), true)) throw new Exception("There is nothing here.");
if (!$json["key"]) throw new Exception("What's the code word?");