dolibarr 20.0.0
test_sessionlock.php
1<?php
2
3if (!defined('NOREQUIREUSER')) {
4 define('NOREQUIREUSER', '1');
5}
6if (!defined('NOREQUIREDB')) {
7 define('NOREQUIREDB', '1');
8}
9if (!defined('NOREQUIRESOC')) {
10 define('NOREQUIRESOC', '1');
11}
12if (!defined('NOREQUIRETRAN')) {
13 define('NOREQUIRETRAN', '1');
14}
15if (!defined('NOSTYLECHECK')) {
16 define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
17}
18if (!defined('NOREQUIREMENU')) {
19 define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
20}
21if (!defined('NOREQUIREHTML')) {
22 define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
23}
24if (!defined('NOREQUIREAJAX')) {
25 define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
26}
27if (!defined("NOLOGIN")) {
28 define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
29}
30// If you don't need session management (can't be logged if no session used). You must also set
31// NOCSRFCHECK, NOTOKENRENEWAL, NOLOGIN
32// Disable module with GETPOST('disablemodules') won't work. Variable 'dol_...' will not be set.
33// $_SESSION are then simple vars if sessions are not active.
34// TODO We can close session with session_write_close() as soon as we just need read access everywhere in code.
35if (!defined("NOSESSION")) {
36 define("NOSESSION", '1');
37}
38
39
40// Special
41// We add header and output some content before the include of main.inc.php !!
42// Because we need to So we can make
43header("Content-type: text/html; charset=UTF8");
44
45// Security options
46header("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)
47header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks)
48
49
50print "Legend:<br>\n";
51print 'PHP_SESSION_DISABLED='.PHP_SESSION_DISABLED."<br>\n";
52print 'PHP_SESSION_NONE='.PHP_SESSION_NONE."<br>\n";
53print 'PHP_SESSION_ACTIVE='.PHP_SESSION_ACTIVE."<br>\n";
54print '<br>';
55
56print 'session_status='.session_status().' (before main.inc.php)';
57print '<br>';
58
59// Load Dolibarr environment
60require '../../main.inc.php';
61
62// Security
63if ($dolibarr_main_prod) {
65}
66
67
68/*
69 * View
70 */
71
72print 'session_status='.session_status().' (after main.inc.php)';
73print '<br>';
74
75//print 'a'.$_SESSION['disablemodules'].'b';
76
77print "\n<br>This page is visible. It means you are not locked by another page called in same session.";
78
79//session_write_close();
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.