Commit 312e73b3 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Added parameters escape

parent 2c09dd0a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -37,8 +37,9 @@ $fb = new Facebook\Facebook([
        ]);

$helper = $fb->getRedirectLoginHelper();
if (isset($_GET['state'])) {
    $helper->getPersistentDataHandler()->set('state', $_GET['state']);
$state = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_STRING);
if ($state !== null) {
    $helper->getPersistentDataHandler()->set('state', $state);
}

try {
+4 −3
Original line number Diff line number Diff line
@@ -44,9 +44,10 @@ if (isset($_REQUEST['logout'])) {
    unset($_SESSION['access_token']);
}

if (isset($_GET['code'])) {
$code = filter_input(INPUT_GET, 'code', FILTER_SANITIZE_STRING);
if ($code !== null) {
// An access token has been returned from the auth URL.
    $client->authenticate($_GET['code']);
    $client->authenticate($code);
    $_SESSION['access_token'] = $client->getAccessToken();
}

@@ -63,7 +64,7 @@ if ($client->getAccessToken()) {
        $res = $service->people->get('people/me', array('requestMask.includeField' => 'person.names,person.email_addresses'));
    } catch (Google_Service_Exception $e) {
        echo '<p>' . json_encode($e->getErrors()) . '</p>';
        $thisPage = $PROTOCOL . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
        $thisPage = $PROTOCOL . $_SERVER['HTTP_HOST'] . htmlspecialchars($_SERVER["PHP_SELF"], ENT_QUOTES, "utf-8");
        echo '<p><a href="' . $thisPage . '?logout">Click here to unset the access token</a></p>';
    }