Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

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