02.06.2013 Views

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

/*<br />

* Build the markup<br />

*/<br />

return <br />

Event Description<br />

$event->description<br />

<br />

<br />

<br />

<br />

or cancel<br />

<br />

<br />

FORM_MARKUP;<br />

}<br />

}<br />

?><br />

private function _loadEventData($id=NULL) {...}<br />

private function _createEventObj() {...}<br />

private function _loadEventById($id) {...}<br />

Adding a Token to the Form<br />

If you look at the preceding form, there’s a hidden input named token that holds a session value, also<br />

called token. This is a security measure to prevent cross-site request forgeries (CSRF), which are form<br />

submissions that are faked <strong>by</strong> submitting a form to your app’s processing file from somewhere other<br />

than the form itself. This is a common tactic used <strong>by</strong> spammers to send multiple forged entry<br />

submissions, which is annoying, potentially harmful, <strong>and</strong> definitely undesirable.<br />

169

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!