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