-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.php
More file actions
35 lines (27 loc) · 947 Bytes
/
header.php
File metadata and controls
35 lines (27 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
// setup
list($usec, $sec) = explode(" ", microtime());
$starttime=(float)$usec + (float)$sec;
require_once("headerDB.inc.php");
// get server IP
$servip = explode(".",$_SERVER['REMOTE_ADDR']);
$serv = $servip[0] . "." . $servip[1] . "." . $servip[2] . "." . $servip[3];
// check if https
if ($_SERVER["REQUEST_SCHEME"] == "https") $is_https = true;
else $is_https = false;
// check if special page to redirect to http
$to_http = false;
if ($_SERVER["HTTP_HOST"] == 'localhost') $to_http = true;
// redirect if needed
if (!$is_https && !$to_http) {
$url = 'https://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
nextScreen($url);
}
// check password
include("password_protect.php");
// header definition
if (!headers_sent()) {
$header="Content-Type: text/html; charset=" . $config['charset'];
header($header);
}
?>