Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | function csrfAction($key = '') { |
||
|
|||
13 | $result = new \Server\Result(); |
||
14 | $key = (string)$key; |
||
15 | if (!$key) { |
||
16 | $result->success = false; |
||
17 | return $result->send(); |
||
18 | } |
||
19 | $_SESSION['csrf'][$key] = Tools::randomString(); |
||
20 | $result->content = $_SESSION['csrf'][$key]; |
||
21 | $result->send(); |
||
22 | } |
||
23 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.