Okay, this is probably something very stupid, but I get an error on this line:
Code:
$id = (int)$link->query("SELECT id FROM keys WHERE `key`='{$key}' LIMIT 1")[0]['id'];
saying that the [ is invalid. I can't see why...