Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
<?php
13 - 2
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start();
3
 
2 - 4
if ($_SERVER["SERVER_NAME"] == "www.findcheapmusic.com") {
5
  header("Strict-Transport-Security: max-age=31536000; includeSubDomains; preload");
6
  header("X-Content-Type-Options: nosniff");
7
  header("X-XSS-Protection: 1; mode=block");
8
  header("Access-Control-Allow-Origin: *");
9
  header("Referrer-Policy: no-referrer");
10
  header("X-Frame-Options: SAMEORIGIN");
11
  header("Set-Cookie: ^(.*)$ $1;HttpOnly;Secure");
12
  header("Content-Security-Policy:  default-src 'none'; img-src 'self'; script-src 'unsafe-inline'; style-src 'unsafe-inline';frame-ancestors 'self'");
13
}
14
 
15
if (isset($_GET["target"])) {
16
 
17
    $location = base64_decode($_GET["target"]);
18
 
9 - 19
    saveRedirect();
2 - 20
    printHeader();
21
    printMessage($location);
22
    printFooter();
9 - 23
    saveRedirect();
2 - 24
 
25
    echo '<script type="text/javascript">setTimeout( function() { location.href="' . $location . '"; }, 250);</script>';
26
 
27
    exit;
28
 
29
} else {
30
 
31
    header("Location: https://www.findcheapmusic.com/index.php");
32
 
33
    exit;
34
 
35
}
36
 
37
function printHeader() {
38
    echo '<!DOCTYPE html>';
39
    echo '<html lang="en">';
40
    echo '<head>';
9 - 41
    echo '    <title>FindCheapMusic Transfer Page</title>';
2 - 42
    echo '    <meta charset="UTF-8">';
43
    echo '    <meta name="viewport" content="width=device-width, initial-scale=1.0">';
44
    echo '    <style>';
45
    echo '    html, body { margin: 0; padding: 0; width: 100%; height: 100%; display: table; }';
46
    echo '    #content { display: table-cell; text-align: center; vertical-align: middle; }';
47
    echo '    </style>';
48
    echo '</head>';
49
    echo '<body>';
50
    echo '    <div id="content">';
51
}
52
 
53
function printMessage($location) {
9 - 54
    echo '<h1>FindCheapMusic Transfer Page</h1>';
55
    echo '<p>You are now leaving FindCheapMusic.com. <a href="' . $location . '">Press here</a> if the page doesn\'t load.';
2 - 56
}
57
 
58
function printFooter() {
59
    echo '    </div>';
60
    echo '</body>';
61
    echo '</html>';
62
    echo '';
63
}
9 - 64
 
65
function saveRedirect() {
66
    include_once('php/sessions_db.php');
67
    include_once('php/cryptor.php');
68
 
69
    $configFile = parse_ini_file("../MyFiles/config/cheapmusic.ini",true);
70
    $crypt = Cryptor::getInstance($configFile['cryptor']);
71
    $tmpSessionTab = (isset($_POST["sessionTab"]) && $_POST["sessionTab"] > 0 ? $_POST["sessionTab"] : null);
72
    $handler = MySessionHandler::getInstance($tmpSessionTab, $configFile['mysqli']);
73
    unset($configFile);
74
 
75
    ini_set("session.cookie_httponly", 1);
76
    ini_set("session.cookie_secure", 1);
77
    session_set_save_handler($handler, true);
11 - 78
    @session_start();
9 - 79
 
80
    $_sess_db = $handler->getDBSessionId();
81
 
82
    $access = mysqli_real_escape_string($_sess_db, time());
83
    $url = mysqli_real_escape_string($_sess_db, base64_decode($_GET["target"]));
84
 
85
    $sql = "INSERT
86
            INTO transfers
87
            (sessId, access, url)
88
            VALUES  ('" . session_id() . "', '$access', '$url')";
89
 
90
    return mysqli_query($_sess_db, $sql);
91
}
2 - 92
?>