Ejemplo n.º 1
0
<?php

require_once "../config.php";
require_once ABSPATH . "/header.php";
require_once ABSPATH . "/footer.php";
session_start();
date_default_timezone_set(TIMEZONE);
get_login_status();
show_header('api', $is_logged_in, URLROOT);
?>
<div class='content_box'>
    <h3>API pages</h3>
    <ul>
        <li><a href="api/getDepth.php">getDepth.php</a><br/>
        <li><a href="api/getTrades.php">getTrades.php</a><br/>
        <li><a href="api/ticker.php">ticker.php</a><br/>
    </ul>
</div>
<?php 
show_footer($is_logged_in, $is_admin, $is_verified);
Ejemplo n.º 2
0
function switcher($page)
{
    global $is_logged_in, $is_admin, $is_verified;
    try {
        $lock = false;
        if (!preg_match("/^[0-9_a-z]*\$/", $page)) {
            $page = 'junk';
        }
        // delay showing the header when logging in until we know whether the login worked or not
        if ($page != 'download' && $page != 'login' && $page != 'graph') {
            show_header($page, $is_logged_in);
        }
        if ($is_logged_in) {
            get_user_lock($lock = $is_logged_in);
        }
        addlog(LOG_SWITCHER, sprintf("[%s] visit page '%s'", getenv("REMOTE_ADDR"), $page));
        switch ($page) {
            ////////////////////////////////////////////////////////////////////////
            // for general consumption
            ////////////////////////////////////////////////////////////////////////
            case '404':
            case 'graph':
            case 'help':
            case 'news':
            case 'orderbook':
            case 'test':
            case 'trade':
            case 'view_trades':
                include "{$page}.php";
                break;
                ////////////////////////////////////////////////////////////////////////
                // for logged in users only
                ////////////////////////////////////////////////////////////////////////
            ////////////////////////////////////////////////////////////////////////
            // for logged in users only
            ////////////////////////////////////////////////////////////////////////
            case 'api':
            case 'deposit':
            case 'identity':
            case 'place_order':
            case 'profile':
            case 'statement':
            case 'turn_on_duo':
            case 'view_order':
            case 'view_request':
            case 'withdraw':
                if ($is_logged_in) {
                    include "{$page}.php";
                } else {
                    log_badpage($page);
                }
                break;
                ////////////////////////////////////////////////////////////////////////
                // for admin only
                ////////////////////////////////////////////////////////////////////////
            ////////////////////////////////////////////////////////////////////////
            // for admin only
            ////////////////////////////////////////////////////////////////////////
            case 'add_cash':
            case 'bank':
            case 'commission':
            case 'docs':
            case 'download':
            case 'freeze':
            case 'users':
                if ($is_admin) {
                    include "{$page}.php";
                } else {
                    log_badpage($page);
                }
                break;
            case 'login':
                if (!$is_logged_in) {
                    include "login.php";
                    // we just tried to log in, so check whether or not it worked before showing the footer
                    get_login_status();
                } else {
                    addlog(LOG_LOGIN, "  already logged in");
                    log_badpage($page);
                }
                break;
            case 'logout':
                setcookie('autologin', FALSE, time() - 60 * 60 * 24 * 365);
                logout();
            default:
                sleep(3);
                log_badpage($page);
                break;
        }
        // debugging for session stuff
        if (0) {
            echo "<div class='content_box'>\n";
            echo "<h3>Debug</h3>\n";
            echo "<p>\n";
            echo "session id: ", session_id(), "<br/>\n";
            echo "session age: ", time() - $_SESSION['creation_time'], " seconds<br/>\n";
            if (isset($inactivity)) {
                echo "you were inactive for {$inactivity} seconds<br/>\n";
            }
            echo "MAX_IDLE_MINUTES_BEFORE_LOGOUT = ", MAX_IDLE_MINUTES_BEFORE_LOGOUT, " minutes = ", MAX_IDLE_MINUTES_BEFORE_LOGOUT * 60, " seconds<br/>\n";
            echo "MAX_SESSION_ID_LIFETIME = ", MAX_SESSION_ID_LIFETIME, " minutes = ", MAX_SESSION_ID_LIFETIME * 60, " seconds<br/>\n";
            echo "</p></div>\n";
        }
    } catch (Error $e) {
        global $shown_header;
        report_exception($e, SEVERITY::ERROR);
        // Same as below, but flag + log this for review,
        if (!$shown_header) {
            show_header($page, $is_logged_in);
        }
        echo "<div class='content_box'><h3>{$e->getTitle()}</h3>";
        echo "<p>{$e->getMessage()}</p></div>";
    } catch (Problem $e) {
        global $shown_header;
        if (!$shown_header) {
            show_header($page, $is_logged_in);
        }
        echo "<div class='content_box'><h3>{$e->getTitle()}</h3>";
        echo "<p>{$e->getMessage()}</p></div>";
    } catch (Exception $e) {
        global $shown_header;
        if (!$shown_header) {
            show_header($page, $is_logged_in);
        }
        echo "<div class='content_box'><h3>Technical difficulties</h3>";
        echo "<p>{$e->getMessage()}</p></div>";
    }
    show_footer($is_logged_in, $is_admin, $is_verified);
    if ($lock) {
        release_lock($lock);
    }
}
Ejemplo n.º 3
0
/** 
 * Luo HTML vastaussailio
 * \ingroup kysymys
 * @param $question_id integer
 */
function create_answers_box($question_id)
{
    echo "<table><tr><td>";
    // to sort the answers of the given question
    require "./handlers/make_a_thread/fetch_answers.php";
    require './forms/lomake_answer.php';
    // LOGIN at the bottom
    if (!get_login_status()) {
        include "./views/login.php";
    }
    echo "</div>";
    // to end container two
    echo "</td><td><div class='right_bar'>";
    create_global_tag_count_box_for_a_question($question_id);
    echo "</div></td></tr></table>";
}
Ejemplo n.º 4
0
<body>
<div id="outer_body">

    <div id="header_container">
        <div id="header_logo"></div>
        <div id="header">
            <div class="corner top_left_normal"></div>
            <div class="corner top_right_normal"></div>
            <div id="header_contents_status">
                <div id="header_contents_status_software_version"><?php 
print file_get_contents("VERSION");
?>
</div>
                <div id="header_contents_status_login_status"><?php 
print get_login_status();
?>
</div>
            </div> <!-- header_contents_status -->
            <div id="portal_title"><?php 
print $firstthingsfirst_portal_title;
?>
</div>
<?php 
# TEMPORARY SOLUTION
if (isset($_GET['action']) && $_GET['action'] == ACTION_GET_LOGIN_PAGE) {
    echo "            <div id=\"page_title\">" . translate("LABEL_PLEASE_LOGIN") . "</div>\n";
} else {
    echo "            <div id=\"page_title\">&nbsp;</div>\n";
}
?>