예제 #1
0
         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"]);
                 }
             }
         }
     }
     die(json_encode($response));
 }
 if ($_POST["action"] == "getinfo") {
예제 #2
0
 public function setCookies()
 {
     $facepunch = new facepunch();
     $facepunch->setUserID($this->sessionToUserID(session_id()));
     //Set cookies
     setcookie("fpusername", $facepunch->getUsername());
     setcookie("fpid", $facepunch->currentUserID());
     unset($facepunch);
 }