|
67 | 67 | $username = 'admin'; |
68 | 68 | $password = 'pass'; |
69 | 69 |
|
| 70 | + if (isset($_GET['logout'])) { |
| 71 | + setcookie('auth_reset', '1', time() + 60, '/'); |
| 72 | +
|
| 73 | + $clean_uri = strtok($_SERVER['REQUEST_URI'], '?'); |
| 74 | + $is_https = ( |
| 75 | + (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] === 1)) || |
| 76 | + (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') |
| 77 | + ); |
| 78 | +
|
| 79 | + header('Location: http'.($is_https ? 's' : '').'://'.$_SERVER['HTTP_HOST'].$clean_uri); |
| 80 | + exit; |
| 81 | + } |
| 82 | +
|
| 83 | + if (isset($_COOKIE['auth_reset'])) { |
| 84 | + setcookie('auth_reset', '', time() - 3600, '/'); |
| 85 | +
|
| 86 | + header('WWW-Authenticate: Basic realm="phpCacheAdmin Login"'); |
| 87 | + header('HTTP/1.0 401 Unauthorized'); |
| 88 | + exit('You have been logged out.'); |
| 89 | + } |
| 90 | +
|
70 | 91 | if ( |
71 | 92 | !isset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) || |
72 | 93 | $_SERVER['PHP_AUTH_USER'] !== $username || $_SERVER['PHP_AUTH_PW'] !== $password |
73 | 94 | ) { |
74 | 95 | header('WWW-Authenticate: Basic realm="phpCacheAdmin Login"'); |
75 | 96 | header('HTTP/1.0 401 Unauthorized'); |
76 | | -
|
77 | 97 | exit('Incorrect username or password!'); |
78 | 98 | } |
79 | | -
|
80 | | - // Use this section for the logout. It will display a link in the sidebar. |
81 | | - if (isset($_GET['logout'])) { |
82 | | - $is_https = ( |
83 | | - (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] === 1)) || |
84 | | - (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') |
85 | | - ); |
86 | | -
|
87 | | - header('Location: http'.($is_https ? 's' : '').'://reset:reset@'.($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])); |
88 | | - } |
89 | 99 | },*/ |
90 | 100 | // Decoding / Encoding functions |
91 | 101 | 'converters' => [ |
|
132 | 142 | ], |
133 | 143 | // Customizations |
134 | 144 | //'timezone' => 'Europe/Bratislava', // Leave empty (or commented out) to get it automatically obtained. |
135 | | - 'time-format' => 'd. m. Y H:i:s', |
136 | | - 'decimal-sep' => ',', |
137 | | - 'thousands-sep' => ' ', |
138 | | - 'list-view' => 'table', // table/tree - default key list view |
| 145 | + 'timeformat' => 'd. m. Y H:i:s', |
| 146 | + 'decimalsep' => ',', |
| 147 | + 'thousandssep' => ' ', |
| 148 | + 'listview' => 'table', // table/tree - default key list view |
139 | 149 | 'panelrefresh' => 30, // In seconds, refresh interval for panels - default 30 |
140 | 150 | 'metricsrefresh' => 60, // In seconds, refresh interval for metrics - default 60 |
141 | 151 | 'metricstab' => 1440, // Default tab in metrics, 60 - Last hour, 1440 - Last day, 10080 - Last week, 43200 - Last month - default 1440 |
142 | 152 | 'hash' => 'pca', // Any random string to secure metrics DB file |
143 | 153 | 'tmpdir' => __DIR__.'/tmp', |
144 | 154 | //'pcapath' => 'vendor/robinn/phpcacheadmin/', // Path to the package when installed via composer. User for assets. |
| 155 | + //'url' => '/', // URL to the package, e.g., /phpcacheadmin |
145 | 156 | ]; |
0 commit comments