LEPTON CMS 7.0.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
45function get_leptoken()
46{
47 // [1] -- first $_GET
48 $leptoken = filter_input(
49 INPUT_GET,
50 "leptoken",
51 FILTER_VALIDATE_REGEXP,
52 [
53 "options" => [
54 "regexp" => "~^[a-zA-Z0-9\.]{32}$~",
55 "default" => NULL
56 ]
57 ]
58 );
59 // [2] -- not found - look for the $_POST
60 if( NULL === $leptoken )
61 {
62 $leptoken = filter_input(
63 INPUT_POST,
64 "leptoken",
65 FILTER_VALIDATE_REGEXP,
66 [
67 "options" => [
68 "regexp" => "~^[a-zA-Z0-9\.]{32}$~",
69 "default" => NULL
70 ]
71 ]
72 );
73 }
74 // [3] --- not found -- look for a diff. name
75 if( NULL === $leptoken )
76 {
77 $leptoken = filter_input(
78 INPUT_GET,
79 "amp;leptoken",
80 FILTER_VALIDATE_REGEXP,
81 [
82 "options" => [
83 "regexp" => "~^[a-zA-Z0-9\.]{32}$~",
84 "default" => NULL
85 ]
86 ]
87 );
88 }
89
90 return ( $leptoken ?? "" );
91}
92