Example: How to use Cross-Site Request Forgery (CSRF) form protection
- 1: <?php
- 3: /**
- 4: * Nette\Forms example 8
- 5: *
- 6: * - Cross-Site Request Forgery (CSRF) form protection
- 7: */
- 26: // Step 2: Check if form was submitted?
- 29: // Step 2c: Check if form is valid
- 36: // this is the end, my friend :-)
- 38: }
- 39: }
- 43: // Step 3: Render form
- 44: ?>
- 45: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- 46: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- 47: <head>
- 48: <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- 49: <meta http-equiv="content-language" content="en" />
- 51: <title>Nette\Forms example 8 | Nette Framework</title>
- 53: <style type="text/css">
- 54: <!--
- 55: .required {
- 56: color: darkred
- 57: }
- 59: fieldset {
- 60: padding: .5em;
- 61: margin: .3em 0;
- 62: background: #EAF3FA;
- 63: border: 1px solid #b2d1eb;
- 64: }
- 66: input.button {
- 67: font-size: 120%;
- 68: }
- 70: th {
- 71: width: 8em;
- 72: text-align: right;
- 73: }
- 74: -->
- 75: </style>
- 76: </head>
- 78: <body>
- 79: <h1>Nette\Forms example 8</h1>
- 82: </body>
- 83: </html>