Compare commits
2 Commits
e0fdda6fb8
...
c4f611c81e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4f611c81e | ||
|
|
cb0d01101f |
@@ -185,11 +185,11 @@ or error to the user.
|
|||||||
To use it :
|
To use it :
|
||||||
require ("domframework/form.php");
|
require ("domframework/form.php");
|
||||||
$errors = array ();
|
$errors = array ();
|
||||||
$f = new form ();
|
$f = new Form ();
|
||||||
// Check CSRF and get the provided values if they exists
|
// Check CSRF and get the provided values if they exists
|
||||||
$values = $f->values ();
|
$values = $f->values ();
|
||||||
// Define here the fields (can be done multiple times)
|
// Define here the fields (can be done multiple times)
|
||||||
$field = new formfield ($name, $label);
|
$field = new Formfield ($name, $label);
|
||||||
// Add the parameters to the field
|
// Add the parameters to the field
|
||||||
$fields[] = $field;
|
$fields[] = $field;
|
||||||
unset ($field);
|
unset ($field);
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ class Form
|
|||||||
|
|
||||||
if ($this->csrf === TRUE)
|
if ($this->csrf === TRUE)
|
||||||
{
|
{
|
||||||
$csrf = new csrf ();
|
$csrf = new Csrf ();
|
||||||
$csrf->field = $this->formName."[".$this->csrfField."]";
|
$csrf->field = $this->formName."[".$this->csrfField."]";
|
||||||
$res .= $csrf->displayFormCSRF ();
|
$res .= $csrf->displayFormCSRF ();
|
||||||
$this->csrfToken = $csrf->getToken ();
|
$this->csrfToken = $csrf->getToken ();
|
||||||
@@ -433,7 +433,7 @@ class Form
|
|||||||
public function checkToken ($tokenFromUser)
|
public function checkToken ($tokenFromUser)
|
||||||
// {{{
|
// {{{
|
||||||
{
|
{
|
||||||
$csrf = new csrf ();
|
$csrf = new Csrf ();
|
||||||
$csrf->field = $this->csrfField;
|
$csrf->field = $this->csrfField;
|
||||||
// The checkThenDeleteToken method check the token and except if there is a
|
// The checkThenDeleteToken method check the token and except if there is a
|
||||||
// problem. If there is no problem, it delete the token
|
// problem. If there is no problem, it delete the token
|
||||||
@@ -598,7 +598,7 @@ class Form
|
|||||||
|
|
||||||
/** The definition of a formfield
|
/** The definition of a formfield
|
||||||
*/
|
*/
|
||||||
class formfield
|
class Formfield
|
||||||
{
|
{
|
||||||
/** The form name
|
/** The form name
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user