LEPTON CMS 7.2.0
feel free to keep it strictly simple...
Loading...
Searching...
No Matches
function.get_leptoken.php
Go to the documentation of this file.
1<?php
2
18// include secure.php to protect this file and the whole CMS!
19if(!defined("SEC_FILE")){define("SEC_FILE",'/framework/secure.php' );}
20if (defined('LEPTON_PATH')) {
21 include LEPTON_PATH.SEC_FILE;
22} else {
23 $oneback = "../";
24 $root = $oneback;
25 $level = 1;
26 while (($level < 10) && (!file_exists($root.SEC_FILE))) {
27 $root .= $oneback;
28 $level += 1;
29 }
30 if (file_exists($root.SEC_FILE)) {
31 include $root.SEC_FILE;
32 } else {
33 trigger_error(sprintf("[ <b>%s</b> ] Can't include secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
34 }
35}
36// end include secure file
37
38
44function get_leptoken(): string
45{
46 // [1] -- first $_GET
47 $leptoken = filter_input(
48 INPUT_GET,
49 "leptoken",
50 FILTER_VALIDATE_REGEXP,
51 [
52 "options" => [
53 "regexp" => "~^[a-zA-Z0-9\.]{32}$~",
54 "default" => NULL
55 ]
56 ]
57 );
58 // [2] -- not found - look for the $_POST
59 if( NULL === $leptoken )
60 {
61 $leptoken = filter_input(
62 INPUT_POST,
63 "leptoken",
64 FILTER_VALIDATE_REGEXP,
65 [
66 "options" => [
67 "regexp" => "~^[a-zA-Z0-9\.]{32}$~",
68 "default" => NULL
69 ]
70 ]
71 );
72 }
73 // [3] --- not found -- look for a diff. name
74 if( NULL === $leptoken )
75 {
76 $leptoken = filter_input(
77 INPUT_GET,
78 "amp;leptoken",
79 FILTER_VALIDATE_REGEXP,
80 [
81 "options" => [
82 "regexp" => "~^[a-zA-Z0-9\.]{32}$~",
83 "default" => NULL
84 ]
85 ]
86 );
87 }
88
89 return ( $leptoken ?? "" );
90}