2019-09-13 11:50:17 +00:00
< ? php
2021-11-24 19:53:17 +00:00
//define("NOLOGIN",1); // This means this output page does not require to be logged.
//if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
//if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1');
if ( ! defined ( 'NOREQUIRESOC' )) {
define ( 'NOREQUIRESOC' , '1' );
}
//if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
if ( ! defined ( 'NOSTYLECHECK' )) {
define ( 'NOSTYLECHECK' , '1' ); // Do not check style html tag into posted data
}
//if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
//if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
//if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
if ( ! defined ( " NOLOGIN " )) {
define ( " NOLOGIN " , '1' ); // If this page is public (can be called outside logged session)
}
2019-09-13 11:50:17 +00:00
2022-09-07 18:08:59 +00:00
// Load Dolibarr environment
2026-02-10 12:56:04 +00:00
@ include '../../main.inc.php' ;
/**
2026-03-29 14:08:28 +00:00
* @ var DoliDB $db
* @ var HookManager $hookmanager
* @ var Translate $langs
*
2026-02-10 12:56:04 +00:00
* @ var string $dolibarr_main_prod
2026-03-29 14:08:28 +00:00
* @ var string $dolibarr_main_test
2026-02-10 12:56:04 +00:00
*/
2021-11-24 19:53:17 +00:00
// Security
2026-03-29 14:08:28 +00:00
if ( ! empty ( $dolibarr_main_prod ) || empty ( $dolibarr_main_test )) {
2026-03-29 19:32:22 +00:00
accessforbidden ( 'Access forbidden when $dolibarr_main_prod is set to 1 or $dolibarr_main_test is NOT set to 1 into conf.php' );
2021-11-24 19:53:17 +00:00
}
/*
* View
*/
2019-09-13 11:50:17 +00:00
2022-07-11 18:18:03 +00:00
header ( " Content-type: text/html; charset=UTF8 " );
// Security options
header ( " X-Content-Type-Options: nosniff " ); // With the nosniff option, if the server says the content is text/html, the browser will render it as text/html (note that most browsers now force this option to on)
header ( " X-Frame-Options: SAMEORIGIN " ); // Frames allowed only if on same domain (stop some XSS attacks)
2019-09-13 11:50:17 +00:00
?>
2021-02-19 14:46:59 +00:00
This is a form to test if a CSRF exists into a Dolibarr page .< br >
2019-09-13 11:50:17 +00:00
< br >
2021-11-22 01:35:55 +00:00
- Change url to send request to into this file ( URL to a hard coded page on a server B ) < br >
2021-02-19 14:46:59 +00:00
- Open this form into a virtual server A .< br >
- Send the request to the virtual server B by clicking submit .< br >
- Check that Anticsrf protection is triggered .< br >
2019-09-13 11:50:17 +00:00
< br >
< ? php
2021-02-19 14:46:59 +00:00
$urltosendrequest = " http://127.0.0.1/dolibarr/htdocs/user/group/card.php " ;
2019-09-13 11:50:17 +00:00
print 'urltosendrequest = ' . $urltosendrequest . '<br><br>' ;
?>
2021-12-26 14:41:09 +00:00
Test post
2019-09-13 11:50:17 +00:00
< form method = " POST " action = " <?php echo $urltosendrequest ; ?> " target = " _blank " >
<!-- < input type = " hidden " name = " token " value = " 123456789 " > -->
< input type = " text " name = " action " value = " add " >
< input type = " text " name = " nom " value = " New group test " >
< input type = " submit " name = " submit " value = " Submit " >
2021-12-26 14:41:09 +00:00
</ form >
Test logout
< html >
< body >
< script > history . pushState ( '' , '' , '/' ) </ script >
< form action = " http://localhostgit/dolibarr_dev/htdocs/user/logout.php " >
< input type = " submit " value = " Submit request " />
</ form >
< script >
document . forms [ 0 ] . submit ();
</ script >
</ body >
</ html >