Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
<?php
20 - 2
include_once('php/dnsexit.php');
2 - 3
 
4
if (isset($_GET["target"])) {
5
 
6
    $location = base64_decode($_GET["target"]);
28 - 7
 
9 - 8
    saveRedirect();
2 - 9
    printHeader();
10
    printMessage($location);
11
    printFooter();
12
 
28 - 13
    if ($location != "#") {
14
        echo '<script type="text/javascript">setTimeout( function() { location.href="' . $location . '"; }, 250);</script>';
15
    }
2 - 16
 
17
    exit;
18
 
19
} else {
20
 
21
    header("Location: https://www.findcheapmusic.com/index.php");
22
 
23
    exit;
24
 
25
}
26
 
27
function printHeader() {
28
    echo '<!DOCTYPE html>';
29
    echo '<html lang="en">';
30
    echo '<head>';
9 - 31
    echo '    <title>FindCheapMusic Transfer Page</title>';
2 - 32
    echo '    <meta charset="UTF-8">';
33
    echo '    <meta name="viewport" content="width=device-width, initial-scale=1.0">';
34
    echo '    <style>';
35
    echo '    html, body { margin: 0; padding: 0; width: 100%; height: 100%; display: table; }';
36
    echo '    #content { display: table-cell; text-align: center; vertical-align: middle; }';
37
    echo '    </style>';
38
    echo '</head>';
39
    echo '<body>';
40
    echo '    <div id="content">';
41
}
42
 
43
function printMessage($location) {
9 - 44
    echo '<h1>FindCheapMusic Transfer Page</h1>';
45
    echo '<p>You are now leaving FindCheapMusic.com. <a href="' . $location . '">Press here</a> if the page doesn\'t load.';
2 - 46
}
47
 
48
function printFooter() {
49
    echo '    </div>';
50
    echo '</body>';
51
    echo '</html>';
52
    echo '';
53
}
9 - 54
 
55
function saveRedirect() {
56
    include_once('php/sessions_db.php');
57
    include_once('php/cryptor.php');
58
 
59
    $configFile = parse_ini_file("../MyFiles/config/cheapmusic.ini",true);
60
    $crypt = Cryptor::getInstance($configFile['cryptor']);
61
    $tmpSessionTab = (isset($_POST["sessionTab"]) && $_POST["sessionTab"] > 0 ? $_POST["sessionTab"] : null);
62
    $handler = MySessionHandler::getInstance($tmpSessionTab, $configFile['mysqli']);
63
    unset($configFile);
64
 
65
    ini_set("session.cookie_httponly", 1);
66
    ini_set("session.cookie_secure", 1);
67
    session_set_save_handler($handler, true);
11 - 68
    @session_start();
9 - 69
 
20 - 70
    $_sess_db = MySessionHandler::getDBSessionId();
9 - 71
 
72
    $access = mysqli_real_escape_string($_sess_db, time());
73
    $url = mysqli_real_escape_string($_sess_db, base64_decode($_GET["target"]));
74
 
75
    $sql = "INSERT
76
            INTO transfers
28 - 77
            (sessId, access, url, userId)
78
            VALUES  ('" . session_id() . "', '$access', '$url', NULL)"; // bugbug userId
9 - 79
 
28 - 80
    if (!mysqli_query($_sess_db, $sql)) {
81
        error_log("Error: " . $sql . " | " . mysqli_error($_sess_db));
82
    }
9 - 83
}
2 - 84
?>