dolibarr 20.0.0
test_arrays.php
1<?php
2//define("NOLOGIN",1); // This means this output page does not require to be logged.
3//if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
4//if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1');
5if (!defined('NOREQUIRESOC')) {
6 define('NOREQUIRESOC', '1');
7}
8//if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
9if (!defined('NOSTYLECHECK')) {
10 define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
11}
12//if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
13//if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
14//if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
15if (!defined("NOLOGIN")) {
16 define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
17}
18
19// Load Dolibarr environment
20require '../../main.inc.php';
21
22// Security
23if ($dolibarr_main_prod) {
24 accessforbidden('Access forbidden when $dolibarr_main_prod is set to 1');
25}
26
27
28
29/*
30 * View
31 */
32
33$form = new Form($db);
34
35$usedolheader = 1; // 1 = Test inside a dolibarr page, 0 = Use hard coded header
36
37// HEADER
38//--------
39
40if (empty($usedolheader)) {
41 header("Content-type: text/html; charset=UTF8");
42
43 // Security options
44 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)
45 header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks)
46 ?>
47 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
48 <html>
49 <head>
50 <meta name="robots" content="noindex,nofollow" />
51 <meta name="author" content="Dolibarr Development Team">
52 <title>Test page</title>
53 <!-- Includes for JQuery (Ajax library) -->
54 <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/css/base/jquery-ui.css" />
55 <!-- <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css" /> -->
56 <link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php<?php echo (GETPOST("dol_use_jmobile") == 1) ? '?dol_use_jmobile=1&dol_optimize_smallscreen=1' : ''; ?>" />
57 <!-- Includes JS for JQuery -->
58 <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery.min.js"></script>
59 <!-- migration fixes for removed Jquery functions -->
60 <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery-migrate.min.js"></script>
61 <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.min.js"></script>
62 <!-- <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/media/js/jquery.dataTables.js"></script> -->
63 <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/select2/select2.min.js?version=4.0.0-beta"></script>
64 </head>
65
66 <body style="padding: 10px;">
67
68
69 <?php
70} else {
71 $arraycss = array();
72 $arrayjs = array();
73 /*
74 $arraycss=array('/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css',
75 '/includes/jquery/plugins/datatables/extensions/Buttons/css/buttons.dataTables.min.css',
76 '/includes/jquery/plugins/datatables/extensions/ColReorder/css/colReorder.dataTables.min.css'
77 );
78 $arrayjs=array('/includes/jquery/plugins/datatables/media/js/jquery.dataTables.js',
79 '/includes/jquery/plugins/datatables/extensions/Buttons/js/dataTables.buttons.js',
80 '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.colVis.min.js',
81 '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.html5.min.js',
82 '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.flash.min.js',
83 '/includes/jquery/plugins/datatables/extensions/Buttons/js/buttons.print.min.js',
84 '/includes/jquery/plugins/datatables/extensions/ColReorder/js/dataTables.colReorder.min.js',
85 '/includes/jszip/jszip.min.js',
86 '/includes/pdfmake/pdfmake.min.js',
87 '/includes/pdfmake/vfs_fonts.js'
88 );
89 */
90
91 llxHeader('', '', '', '', 0, 0, $arrayjs, $arraycss);
92}
93
94
95// CONTENT
96//---------
97?>
98
99<h2>
100This page is a sample of page using tables. It is designed to make test with<br>
101</h2>
102<div class="wordbreak">
103- css (add parameter &amp;theme=newtheme to test another theme or edit css of current theme)<br>
104- jmobile (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?dol_use_jmobile=1&dol_optimize_smallscreen=1'; ?>">dol_use_jmobile=1&amp;dol_optimize_smallscreen=1</a> and switch to small screen < 570 to enable with emulated jmobile)<br>
105- no javascript / usage for bind people (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?nojs=1'; ?>">nojs=1</a> to force disable javascript)<br>
106- tablednd<br>
107</div>
108
109
110<br><hr><br>Example 0a : Table with div+div+div containing a select that should be overflowed and truncated => Use this to align text or form<br>
111
112<div class="tagtable centpercent">
113 <div class="tagtr">
114 <div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work -->
115 <select name="hidedetails" class="centpercentonsmartphone"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select>
116 </div>
117 <div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work -->
118 <select name="hidedetails" class="centpercentonsmartphone"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select>
119 </div>
120 </div>
121</div>
122
123<br><hr><br>Example 0b: Table with div+form+div containing a select that should be overflowed and truncated => Use this to align text or form<br>
124
125<div class="tagtable centpercent">
126 <form action="xxx" method="POST" class="tagtr">
127 <div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work -->
128 <select name="hidedetails" class="centpercentonsmartphone"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select>
129 </div>
130 <div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work -->
131 <select name="hidedetails" class="centpercentonsmartphone"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select>
132 </div>
133 </form>
134</div>
135
136<br><hr><br>Example 0c: Table with table+tr+td containing a select that should be overflowed and truncated => Use this to align text or form<br>
137
138<table class="centpercent">
139 <tr>
140 <td class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work -->
141 <select name="hidedetails" class="centpercentonsmartphone"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select>
142 </td>
143 <td class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;"> <!-- If you remove max-width, the jmobile overflow does not work -->
144 <select name="hidedetails" class="centpercentonsmartphone"><option>aaaaaaaaaaaaaaafd sf sf gfd gfds fsd gfd fhfg hf dhfg hg fhfgdhfgdh gh gfdhdgf h gfdh dfhg dfgh dfgh fdgh gfd hfd hfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select>
145 </td>
146 </tr>
147</table>
148
149
150
151
152<br><hr><br>Example 1 : Standard table/thead/tbody/tr/th-td (no class pair/impair on td) => Use this if you need the drag and drop for lines or for long result tables<br>
153
154
155<script type="text/javascript">
156/*jQuery(document).ready(function() {
157$(document).ready(function() {
158 var table = $('#tablelines3').DataTable( {
159 scrollY: "300px",
160 scrollX: true,
161 scrollCollapse: true,
162 paging: false,
163 fixedColumns: {
164 leftColumns: 1,
165 rightColumns: 1
166 }
167 } );
168} );
169});*/
170</script>
171
172
173<?php
174include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
175$productspecimen = new Product($db);
176$productspecimen->initAsSpecimen();
177$object = $productspecimen;
178
179$sortfield = 'aaa';
180$sortorder = 'ASC';
181$tasksarray = array(1, 2, 3); // To force having several lines
182$tagidfortablednd = 'tablelines3';
183if (!isset($moreforfilter)) {
184 $moreforfilter = '';
185}
186if (!empty($conf->use_javascript_ajax)) {
187 include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
188}
189
190$nav = '';
191$nav .= '<form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?mode=show_peruser'.$param.'">';
192if ($actioncode || GETPOSTISSET('actioncode')) {
193 $nav .= '<input type="hidden" name="actioncode" value="'.$actioncode.'">';
194}
195if ($status || GETPOSTISSET('status')) {
196 $nav .= '<input type="hidden" name="status" value="'.$status.'">';
197}
198if ($filter) {
199 $nav .= '<input type="hidden" name="filter" value="'.$filter.'">';
200}
201if ($filtert) {
202 $nav .= '<input type="hidden" name="filtert" value="'.$filtert.'">';
203}
204if ($socid) {
205 $nav .= '<input type="hidden" name="socid" value="'.$socid.'">';
206}
207if (isset($showbirthday) && $showbirthday) {
208 $nav .= '<input type="hidden" name="showbirthday" value="1">';
209}
210if (isset($pid) && $pid) {
211 $nav .= '<input type="hidden" name="projectid" value="'.$pid.'">';
212}
213if ($type) {
214 $nav .= '<input type="hidden" name="type" value="'.$type.'">';
215}
216if ($usergroup) {
217 $nav .= '<input type="hidden" name="usergroup" value="'.$usergroup.'">';
218}
219$nav .= $form->selectDate($dateselect ?? '', 'dateselect', 0, 0, 1, '', 1, 0);
220$nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
221$nav .= '</form>';
222
223$limit = 10;
224print_barre_liste('Title of my list', 12, $_SERVER["PHP_SELF"], '', '', '', 'Text in middle', 20, 500, '', 0, $nav, '', $limit, 0, 0, 1);
225
226$moreforfilter .= '<div class="divsearchfield">';
227$moreforfilter .= $langs->trans('This is a select list for a filter A (no combo forced)').': ';
228$cate_arbo = array('field1' => 'value1a into the select list A', 'field2' => 'value2a');
229$moreforfilter .= $form->selectarray('search_aaa', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 0); // List with no js combo
230$moreforfilter .= '</div>';
231
232$moreforfilter .= '<div class="divsearchfield">';
233$moreforfilter .= $langs->trans('This is a select list for a filter B (auto combo)').': ';
234$cate_arbo = array('field1' => 'value1b into the select list B', 'field2' => 'value2b');
235$moreforfilter .= $form->selectarray('search_bbb', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', -1); // List with js combo auto
236$moreforfilter .= '</div>';
237
238$moreforfilter .= '<div class="divsearchfield">';
239$moreforfilter .= $langs->trans('This is a select list for a filter C (combo forced)').': ';
240$cate_arbo = array('field1' => 'value1c into the select list C', 'field2' => 'value2c');
241$moreforfilter .= $form->selectarray('search_ccc', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced
242$moreforfilter .= '</div>';
243
244$moreforfilter .= '<div class="divsearchfield">';
245$moreforfilter .= $langs->trans('This is a select list for a filter D (combo forced)').': ';
246$cate_arbo = array('field1' => 'value1d into the select list D', 'field2' => 'value2d');
247$moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced
248$moreforfilter .= '</div>';
249
250if (!empty($moreforfilter)) {
251 print '<div class="liste_titre liste_titre_bydiv centpercent">';
252 print $moreforfilter;
253 $parameters = array();
254 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
255 print $hookmanager->resPrint;
256 print '</div>';
257}
258
259?>
260
261<table class="stripe row-border order-column centpercent tagtable liste<?php echo $moreforfilter ? " listwithfilterbefore" : ""; ?>" id="tablelines3">
262<thead>
263<tr class="liste_titre">
264<?php print getTitleFieldOfList($langs->trans('title1'), 0, $_SERVER["PHP_SELF"], 'aaa', '', '', 'align="left"', $sortfield, $sortorder); ?>
265<?php print getTitleFieldOfList($langs->trans('title2'), 0, $_SERVER["PHP_SELF"], 'bbb', '', '', 'align="center"', $sortfield, $sortorder); ?>
266<?php print getTitleFieldOfList($langs->trans('title3'), 0, $_SERVER["PHP_SELF"], 'ccc', '', '', 'align="right"', $sortfield, $sortorder); ?>
267</tr>
268</thead>
269<tbody>
270<tr class="pair"><td><?php echo $productspecimen->getNomUrl(1); ?></td><td class="center">b1</td><td class="tdlineupdown right">c1</td></tr>
271<tr class="impair nowrap"><td>a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2</td><td align="center">b2</td><td class="tdlineupdown right">c2</td></tr>
272<tr class="pair"><td>a3</td><td class="center">b3</td><td class="tdlineupdown right">c3</td></tr>
273</tbody>
274</table>
275
276
277<br>
278
279
280<!--
281<br><hr><br>Example 1b : Table using tags: table/thead/tbody/tr/th-td + dataTable => Use this for short result tables<br>
282
283<script type="text/javascript">
284$(document).ready(function(){
285 $('#idtableexample2').dataTable( {
286 <?php
287 if ($optioncss == 'print') {
288 print '\'dom\': \'lfrtip\',';
289 } else {
290 print '\'dom\': \'Blfrtip\',';
291 }
292 ?>
293 "colReorder": true,
294 'buttons': [
295 'colvis','copy', 'csv', 'excel', 'pdf', 'print'
296 ],
297 "sPaginationType": "full_numbers",
298 "lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "<?php echo $langs->trans('All'); ?>"]],
299 "oLanguage": {
300 "sLengthMenu": "<?php echo $langs->trans('Show'); ?> _MENU_ <?php echo $langs->trans('Entries'); ?>",
301 "sSearch": "<?php echo $langs->trans('Search'); ?>:",
302 "sZeroRecords": "<?php echo $langs->trans('NoRecordsToDisplay'); ?>",
303 "sInfoEmpty": "<?php echo $langs->trans('NoEntriesToShow'); ?>",
304 "sInfoFiltered": "(<?php echo $langs->trans('FilteredFrom'); ?> _MAX_ <?php echo $langs->trans('TotalEntries'); ?>)",
305 "sInfo": "<?php echo $langs->trans('Showing'); ?> _START_ <?php echo $langs->trans('To'); ?> _END_ <?php echo $langs->trans('WTOf'); ?> _TOTAL_ <?php echo $langs->trans('Entries'); ?>",
306 "oPaginate": {
307 "sFirst": "<?php echo $langs->transnoentities('First'); ?>",
308 "sLast": "<?php echo $langs->transnoentities('Last'); ?>",
309 "sPrevious": "<?php echo $langs->transnoentities('Previous'); ?>",
310 "sNext": "<?php echo $langs->transnoentities('Next'); ?>"
311 }
312 },
313 "aaSorting": [[0,'desc']],
314/* To use in ajax mode
315 "bProcessing": true,
316 "stateSave": true,
317 "bServerSide": true,
318 "sAjaxSource": "../ajax.php",
319 "aoColumnDefs": [
320 { "bSortable": false, "aTargets": [ 2,3,4 ] }
321 ],
322*/
323 })
324});
325</script>
326 -->
327
328
329<br><hr><br>Example 2 : Table using tags: div.tagtable+(div|form).tagtr+div[.tagtd] => Use this for tables that need to have a different form for each line, but AVOID IT if possible (drag and drop of lines does not work for this case, also height of title can't be forced to a minimum)<br><br>
330
331
332<?php
333 $tasksarray = array(1, 2, 3); // To force having several lines
334$tagidfortablednd = 'tablelines';
335if (!empty($conf->use_javascript_ajax)) {
336 include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
337}
338?>
339<div class="tagtable centpercent liste_titre_bydiv" id="tablelines">
340 <div class="tagtr liste_titre">
341 <div class="tagtd">Title A<input type="hidden" name="cartitem" value="3"></div>
342 <div class="tagtd">title B</div>
343 <div class="tagtd">title C</div>
344 <div class="tagtd">title D</div>
345 </div>
346 <div class="pair tagtr">
347 <div class="tagtd">line4<input type="hidden" name="cartitem" value="3"></div>
348 <div class="tagtd">dfsdf</div>
349 <div class="tagtd"><input name="count" value="4" class="maxwidth50"></div>
350 <div class="tagtd tdlineupdown">bbbb</div>
351 </div>
352 <div class="impair tagtr">
353 <div class="tagtd">line5<input type="hidden" name="cartitemb" value="3"></div>
354 <div class="tagtd">dfsdf</div>
355 <div class="tagtd"><input name="countb" value="4" class="maxwidth50"></div>
356 <div class="tagtd tdlineupdown">bbbb</div>
357 </div>
358 <div class="pair tagtr">
359 <div class="tagtd">line6<input type="hidden" name="cartitem" value="3"></div>
360 <div class="tagtd">jghjgh</div>
361 <div class="tagtd">5</div>
362 <div class="tagtd tdlineupdown">lll</div>
363 </div>
364<!-- Using form into div make Firefox crazy (page loading does not end) -->
365<!-- <form class="liste_titre" method="POST" action="1.php">
366 <div>line1<input type="hidden" name="cartitem" value="1"></div>
367 <div><label><input type="checkbox" name="hidedetails" value="2"> A checkbox inside a cell</label></div>
368 <div><input name="count" value="4"></div>
369 <div><input type="submit" name="count2" class="button noshadow" value="aaa"></div>
370 </form>
371 <form class="impair" method="POST" action="2.php">
372 <div>line2<input type="hidden" name="cartitem" value="2"></div>
373 <div><select name="hidedetails"><option>aaaaaaaaaaaaaaafd sf sf gfd gfd gs fgdf gaaaa</option><option>gdfs gdf g sdfg dfg fdsg dsfg dfs gdfs gds fgs gdfdf gd</option></select></div>
374 <div><input name="countb" value="4"></div>
375 <div class="tdlineupdown"><input type="submit" value="xxx" class="button"></div>
376 </form>-->
377</div>
378
379
380
381
382<?php
383if (!empty($usedolheader)) {
384 llxFooter();
385} else { ?>
386</body>
387<?php } ?>
388
389</html>
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
Class to manage generation of HTML components Only common components must be here.
Class to manage products or services.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
treeview li table
No Email.
usage($program, $header)
Print the usage when executing scripts from install/.
Definition inc.php:94
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:139
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:142
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.