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