5if (!defined(
'NOREQUIRESOC')) {
6 define(
'NOREQUIRESOC',
'1');
9if (!defined(
'NOSTYLECHECK')) {
10 define(
'NOSTYLECHECK',
'1');
15if (!defined(
"NOLOGIN")) {
16 define(
"NOLOGIN",
'1');
20require
'../../main.inc.php';
23if ($dolibarr_main_prod) {
32header(
"Content-type: text/html; charset=UTF8");
35header(
"X-Content-Type-Options: nosniff");
36header(
"X-Frame-Options: SAMEORIGIN");
39This is a form to test
if a CSRF exists into a Dolibarr page.<br>
41- Change url to send request to into
this file (URL to a hard coded page on a server B)<br>
42- Open
this form into a
virtual server A.<br>
43- Send the request to the
virtual server B by clicking submit.<br>
44- Check that Anticsrf protection is triggered.<br>
48 $urltosendrequest =
"http://127.0.0.1/dolibarr/htdocs/user/group/card.php";
49 print
'urltosendrequest = '.$urltosendrequest.
'<br><br>';
53<form method=
"POST" action=
"<?php echo $urltosendrequest; ?>" target=
"_blank">
54<!-- <input
type=
"hidden" name=
"token" value=
"123456789"> -->
55<input
type=
"text" name=
"action" value=
"add">
56<input
type=
"text" name=
"nom" value=
"New group test">
57<input
type=
"submit" name=
"submit" value=
"Submit">
64 <script>history.pushState(
'',
'',
'/')</script>
65 <form action=
"http://localhostgit/dolibarr_dev/htdocs/user/logout.php">
66 <input
type=
"submit" value=
"Submit request" />
69 document.forms[0].submit();
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$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.