Ajout d'un exemple pour google recaptcha dans PHP

This commit is contained in:
Patrick Marchand 2018-11-26 18:41:45 +01:00
parent 34d60082fb
commit e99e0aac21

View file

@ -751,3 +751,27 @@ php_admin_value sendmail_path "/bin/true -t -i -f www-foo"
~~~
php_admin_value sendmail_path "/bin/true"
~~~
* `allow_url_fopen = Off` empêche dutiliser file_get_contents
La solution est dutiliser
(fsockopen())[https://secure.php.net/manual/fr/function.fsockopen.php]
plutôt que
(file_get_contents())[https://secure.php.net/manual/fr/function.file-get-contents.php].
Il faut faire attention parce que cette API est aussi vulnérable a
(certaines attaques)[https://www.owasp.org/index.php/PHP_Top_5].
Exemple pour (Google Recaptcha)[http://www.google.com/recaptcha/intro/v3.html]:
Remplacer
```
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
```
Par
```
$recaptcha = new \ReCaptcha\ReCaptcha($secret, new \ReCaptcha\RequestMethod\SocketPost());
```