} } else { if (empty($profileNameF) === false) { $profile = Profile::getProfileByProfileNameF($pdo, $profileNameF); if ($profile !== null && $profile->getProfileId() === $_SESSION["profile"]->getProfileId()) { $reply->data = $profile; } } else { if (empty($profileNameL) === false) { $profile = Profile::getProfileByProfileNameL($pdo, $profileNameL); if ($profile !== null && $profile->getProfileId() === $_SESSION["profile"]->getProfileId()) { $reply->data = $profile; } } else { if (empty($profilePhone) === false) { $profile = Profile::getProfileByProfilePhone($pdo, $profilePhone); if ($profile !== null && $profile->getProfileId() === $_SESSION["profile"]->getProfileId()) { $reply->data = $profile; } } else { if (empty($profileVerify) === false) { $profile = Profile::getProfileByProfileVerify($pdo, $profileVerify); if ($profile !== null && $profile->getProfileId() === $_SESSION["profile"]->getProfileId()) { $reply->data = $profile; } } else { if (empty($current) === false) { $profile = Profile::getProfileByProfileId($pdo, $_SESSION["profile"]->getProfileId()); $reply->data = $profile; } }
// $pdo //Connect to mysql encrypted; verifyXsrf(); $requestContent = file_get_contents("php://input"); $requestObject = json_decode($requestContent); //grab the mySQL connection $pdo = connectToEncryptedMySQL("/etc/apache2/capstone-mysql/jpegery.ini"); try { $profile = Profile::getProfileByProfileEmail($pdo, $requestObject->emailHandlePhone); } catch (Exception $exception) { $profile = null; } if ($profile === null) { $profile = Profile::getProfileByProfileHandle($pdo, $requestObject->emailHandlePhone); } if ($profile === null) { $profile = Profile::getProfileByProfilePhone($pdo, $requestObject->emailHandlePhone); } // if login options cannot be verified throw exception if ($profile === null) { throw new \RuntimeException("User name or password is incorrect"); } $hash = hash_pbkdf2("sha512", $requestObject->password, $profile->getProfileSalt(), 262144); // if login credentials are valid; start session if (empty($profile) === false && $hash === $profile->getProfileHash()) { //Put the profile in the session. $reply->message = "Welcome to jpegery!"; $_SESSION["profile"] = $profile; } else { throw new \RuntimeException("User name or password is incorrect"); } } catch (Exception $exception) {