Skip to content

Instantly share code, notes, and snippets.

@ghedipunk
Created May 30, 2015 14:44
Show Gist options
  • Save ghedipunk/be70a61671a50f158016 to your computer and use it in GitHub Desktop.
Save ghedipunk/be70a61671a50f158016 to your computer and use it in GitHub Desktop.
<?php
/**
* templates/comment-form.php
*
* NOTE: THIS IS PART OF AN EXAMPLE OF VERY INSECURE CODE! DO NOT USE THIS!
*/
?>
<?php if ($user->isLoggedIn())
{
?>
<form action="/submit.php">
<?php displayValidationMessages($_SESSION['formstate']['comment-form']['messages']); ?>
<input type="hidden" name="formid" value="comment-form" />
<input type="hidden" name="csrf-token" value="<?php generateCsrfToken($user); ?>" />
<input type="hidden" name="current-article" value="<?php echo getCurrentArticle(); ?>" />
<textarea rows="4" columns="30" name="comment">
<?php
if(!empty($_SESSION['formstate']['comment-form']['comment']))
{
echo $_SESSION['formstate']['comment-form']['comment'];
}
?>
</textarea>
<?php
} // end if ($user->isLoggedIn())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment