Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Update url shortener sample #1212

Conversation

michaelbausor
Copy link
Contributor

cc @sirdarckcat

Addressing issues raised in #1197 (b/37360079)

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 2, 2017

function generateCsrfToken()
{
$_SESSION['csrf_token'] = bin2hex(openssl_random_pseudo_bytes(32));

This comment was marked as spam.

This comment was marked as spam.

$_SESSION['csrf_token'] = bin2hex(openssl_random_pseudo_bytes(32));
}

function validateCsrfToken()

This comment was marked as spam.

$_SESSION['access_token'] = $client->getAccessToken();
} else {
$invalidCsrf = true;
generateCsrfToken();

This comment was marked as spam.

<a href="<?= $_SERVER['PHP_SELF'] ?>">Create another</a>
<a href="<?= htmlspecialchars($_SERVER['PHP_SELF']); ?>">Create another</a>
<?php endif ?>
<?php if (isset($invalidCsrf) && $invalidCsrf): ?>

This comment was marked as spam.

<input name="url" class="url" type="text">
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>" />

This comment was marked as spam.

@@ -60,7 +60,13 @@
* local access token in this case
************************************************/
if (isset($_REQUEST['logout'])) {
unset($_SESSION['access_token']);
if (validateCsrfToken()) {

This comment was marked as spam.

@bshaffer
Copy link
Contributor

closing in favor of #1240

@bshaffer bshaffer closed this Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants