Esempio n. 1
0
     $response["error"] = "no key given";
 } else {
     // Time to do some magic.
     if (!$db->hasKey($_POST["key"])) {
         $response["error"] = "error in key, does not exist.";
     } else {
         if ($db->keyExpired($_POST["key"])) {
             $response["error"] = "key expired";
             // Delete the key.
             $db->deleteKey($_POST["key"]);
         } else {
             $facepunch = new facepunch();
             // Set the user id
             $facepunch->setUserID($db->getUserIDFromKey($_POST["key"]));
             // Check the user id's page for the key posted on their page.
             if ($facepunch->compareComments($_POST["key"])) {
                 $response["posted"] = "true";
                 // Create session
                 $session->createSession($facepunch->currentUserID());
                 $account->setPaths('../json/facepunch/', '../../images/facepunch/avatars/');
                 $account->checkInformation($facepunch->currentUserID());
                 // Delete the key.
                 $db->deleteKey($_POST["key"]);
             } else {
                 $response["error"] = "no key found";
                 // Delete the key.
                 $db->deleteKey($_POST["key"]);
             }
         }
     }
 }