5if (!defined(
'NOREQUIRESOC')) {
6 define(
'NOREQUIRESOC',
'1');
9if (!defined(
'NOSTYLECHECK')) {
10 define(
'NOSTYLECHECK',
'1');
15if (!defined(
"NOLOGIN")) {
16 define(
"NOLOGIN",
'1');
20@include
'../../main.inc.php';
31if (!empty($dolibarr_main_prod) || empty($dolibarr_main_test)) {
32 accessforbidden(
'Access forbidden when $dolibarr_main_prod is set to 1 or $dolibarr_main_test is NOT set to 1 into conf.php');
40header(
"Content-type: text/html; charset=UTF8");
43header(
"X-Content-Type-Options: nosniff");
44header(
"X-Frame-Options: SAMEORIGIN");
47This is a form to test
if a CSRF exists into a Dolibarr page.<br>
49- Change url to send request to into
this file (URL to a hard coded page on a server B)<br>
50- Open
this form into a
virtual server A.<br>
51- Send the request to the
virtual server B by clicking submit.<br>
52- Check that Anticsrf protection is triggered.<br>
56 $urltosendrequest =
"http://127.0.0.1/dolibarr/htdocs/user/group/card.php";
57 print
'urltosendrequest = '.$urltosendrequest.
'<br><br>';
61<form method=
"POST" action=
"<?php echo $urltosendrequest; ?>" target=
"_blank">
62<!-- <input
type=
"hidden" name=
"token" value=
"123456789"> -->
63<input
type=
"text" name=
"action" value=
"add">
64<input
type=
"text" name=
"nom" value=
"New group test">
65<input
type=
"submit" name=
"submit" value=
"Submit">
72 <script>history.pushState(
'',
'',
'/')</script>
73 <form action=
"http://localhostgit/dolibarr_dev/htdocs/user/logout.php">
74 <input
type=
"submit" value=
"Submit request" />
77 document.forms[0].submit();
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.