Esempio n. 1
0
if (isset($_GET['sortBy'])) {
    $sortBy = $_GET['sortBy'];
    $sdef = 1;
} else {
    $sortBy = $sortingTopics;
    $sdef = 0;
}
if (!($sortBy == 1 or $sortBy == 0 or $sortBy == 2)) {
    $sortBy = $sortingTopics;
}
if (isset($_POST['mode']) and $_POST['mode'] == 'login') {
    require $pathToFiles . 'bb_func_login.php';
}
if ($loginError == 0) {
    if (isset($_GET['mode']) and $_GET['mode'] == 'logout') {
        deleteMyCookie();
        if (isset($metaLocation)) {
            $meta_relocate = "{$main_url}/{$indexphp}";
            echo ParseTpl(makeUp($metaLocation));
            exit;
        } else {
            header("Location: {$main_url}/{$startIndex}");
            exit;
        }
    }
    user_logged_in();
    if ($user_id != 0 and isset($langu) and $langu = str_replace(array('.', '/', '\\'), '', $langu) and file_exists($pathToFiles . "lang/{$langu}.php")) {
        $lang = $langu;
    } elseif ($user_id == 0 and isset($_GET['setlang']) and $setlang = str_replace(array('.', '/', '\\'), '', $_GET['setlang']) and file_exists($pathToFiles . "lang/{$setlang}.php")) {
        $lang = $setlang;
        $indexphp .= 'setlang=' . $setlang . '&';
Esempio n. 2
0
<?php

ob_start();
include_once 'lib/functions.php';
$authValues = checkCookieExists("info");
$authValues = getCookieData($authValues);
$software = $authValues['software'];
$serverValues = checkCookieExists("serverdetails");
$serverValues = getCookieData($serverValues);
deleteMyCookie("info");
deleteMyCookie("serverdetails");
deleteMyCookie("apidetails");
$ip = $serverValues['serverAddresses']['public'][0];
include 'header3.php';
flush_buffers();
print "<h3>Deploying {$software} ..<h3>";
print "<h3>Waiting on the server to start up ..";
flush_buffers();
$i = 0;
$y = 2;
while (!checkSSH($ip)) {
    $i++;
    echo ".";
    sleep(1);
    flush_buffers();
    if ($i > 120) {
        print "<br /></h3>There seems to be a problem. It took longer than 120 seconds to start the build. You can check your <a href=\"https://manage.rackspacecloud.com/\">control panel</a> and visit the console of the server to see if it is responsive. You can try rebooting the server or <a href=\"/\">starting over</a>.</h3><br /> I'll try {$y} more timesy..";
        include 'footer2.php';
        flush_buffers();
        $i = 0;
        $y--;
Esempio n. 3
0
function user_logged_in()
{
    if (isset($GLOBALS['cook']) and trim($GLOBALS['cook']) != '') {
        $c = explode('|', $GLOBALS['cook']);
    } else {
        $c = getMyCookie();
    }
    $username = $c[0];
    $userpassword = $c[1];
    $exptime = $c[2] + 0;
    $returned = FALSE;
    $resetCookie = FALSE;
    if ($username == '') {
        $returned = FALSE;
        return;
    }
    $GLOBALS['user_usr'] = $username;
    $pasttime = $exptime - time();
    if (strlen($GLOBALS['admin_pwd']) == 32) {
        $user_pwd_cmp = $GLOBALS['admin_pwd'];
    } else {
        $user_pwd_cmp = writeUserPwd($GLOBALS['admin_pwd']);
    }
    if (isset($GLOBALS['loginsCase']) and $GLOBALS['loginsCase']) {
        $caseComp1 = $GLOBALS['caseComp'] . '(';
        $caseComp2 = ')';
        $usernameSql = strtolower($username);
    } else {
        $caseComp1 = '';
        $caseComp2 = '';
        $usernameSql = $username;
    }
    if (($username == $GLOBALS['admin_usr'] or isset($GLOBALS['loginsCase']) and $GLOBALS['loginsCase'] and strtolower($username) == strtolower($GLOBALS['admin_usr'])) and $userpassword == $user_pwd_cmp) {
        //if ($username==$GLOBALS['admin_usr'] and $userpassword==$GLOBALS['admin_pwd']) {
        $returned = TRUE;
        $GLOBALS['logged_user'] = 0;
        $GLOBALS['logged_admin'] = 1;
        $GLOBALS['user_id'] = 1;
        if ($row = db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserSheme']['user_sorttopics'][1] . ',' . $GLOBALS['dbUserSheme']['language'][1] . ', ' . $GLOBALS['dbUserSheme']['num_posts'][1], $GLOBALS['dbUserId'], '=', 1)) {
            $GLOBALS['user_sort'] = $row[0];
        }
        $GLOBALS['langu'] = $row[1];
        $GLOBALS['user_num_posts'] = $row[2];
        $username = $GLOBALS['admin_usr'];
        if ($pasttime <= $GLOBALS['cookie_renew']) {
            // if expiration time of cookie is less than defined in setup, we redefine it below
            $resetCookie = TRUE;
        }
    } elseif ($row = db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserId'] . ',' . $GLOBALS['dbUserSheme']['user_sorttopics'][1] . ',' . $GLOBALS['dbUserSheme']['language'][1] . ',' . $GLOBALS['dbUserAct'] . ',' . $GLOBALS['dbUserSheme']['user_password'][1] . ', ' . $GLOBALS['dbUserSheme']['username'][1] . ', ' . $GLOBALS['dbUserSheme']['num_posts'][1], $caseComp1 . $GLOBALS['dbUserSheme']['username'][1] . $caseComp2, '=', $usernameSql, '', 1)) {
        if ($row[4] == $userpassword) {
            $returned = TRUE;
            $GLOBALS['user_id'] = $row[0];
            $GLOBALS['user_sort'] = $row[1];
            $GLOBALS['logged_user'] = 1;
            $GLOBALS['logged_admin'] = 0;
            $GLOBALS['langu'] = $row[2];
            $GLOBALS['user_activity'] = $row[3];
            $username = $row[5];
            $GLOBALS['user_num_posts'] = $row[6];
            if ($pasttime <= $GLOBALS['cookie_renew']) {
                $resetCookie = TRUE;
            }
        } else {
            /* Preventing hijack */
            $username = '';
            $GLOBALS['user_usr'] = $username;
        }
    } else {
        $returned = FALSE;
        if ($pasttime <= $GLOBALS['cookie_renew']) {
            $userpassword = '';
            $resetCookie = TRUE;
        }
    }
    if ($resetCookie) {
        deleteMyCookie();
        setMyCookie($username, $userpassword, $GLOBALS['cookieexptime']);
    }
    return $returned;
}
Esempio n. 4
0
function user_logged_in()
{
    if (isset($GLOBALS['cook']) and trim($GLOBALS['cook']) != '') {
        $c = explode('|', $GLOBALS['cook']);
    } elseif (isset($_SESSION['minimalistBBSession'])) {
        $c = explode('|', $_SESSION['minimalistBBSession']);
    } else {
        $c = getMyCookie();
    }
    $username = $c[0];
    $userpassword = $c[1];
    $exptime = $c[2];
    $returned = FALSE;
    $resetCookie = FALSE;
    if ($username == '') {
        $returned = FALSE;
        return;
    }
    $GLOBALS['user_usr'] = $username;
    $pasttime = $exptime - time();
    if ($username == $GLOBALS['admin_usr'] and $userpassword == md5($GLOBALS['admin_pwd'])) {
        $returned = TRUE;
        $GLOBALS['logged_user'] = 0;
        $GLOBALS['logged_admin'] = 1;
        $GLOBALS['user_id'] = 1;
        if ($row = db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserSheme']['user_sorttopics'][1] . ',' . $GLOBALS['dbUserSheme']['language'][1], $GLOBALS['dbUserId'], '=', 1)) {
            $GLOBALS['user_sort'] = $row[0];
        }
        $GLOBALS['langu'] = $row[1];
        if ($pasttime <= $GLOBALS['cookie_renew']) {
            // if expiration time of cookie is less than defined in setup, we redefine it below
            $resetCookie = TRUE;
        }
    } elseif ($userpassword != '' and $row = db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserId'] . ',' . $GLOBALS['dbUserSheme']['user_sorttopics'][1] . ',' . $GLOBALS['dbUserSheme']['language'][1] . ',' . $GLOBALS['dbUserAct'], $GLOBALS['dbUserId'], '=', $GLOBALS['USER']->user_id, '', 1)) {
        $returned = TRUE;
        $GLOBALS['user_id'] = $row[0];
        $GLOBALS['user_sort'] = $row[1];
        $GLOBALS['logged_user'] = 1;
        $GLOBALS['logged_admin'] = 0;
        $GLOBALS['langu'] = $row[2];
        $GLOBALS['user_activity'] = $row[3];
        //modify based on geograph user status
        global $USER;
        if ($USER->hasPerm('admin')) {
            $GLOBALS['logged_user'] = 0;
            $GLOBALS['logged_admin'] = 1;
        }
        if ($pasttime <= $GLOBALS['cookie_renew']) {
            $resetCookie = TRUE;
        }
    } else {
        $returned = FALSE;
        if ($pasttime <= $GLOBALS['cookie_renew']) {
            $userpassword = '';
            $resetCookie = TRUE;
        }
    }
    if ($resetCookie) {
        deleteMyCookie();
        setMyCookie($username, $userpassword, $GLOBALS['cookieexptime']);
    }
    return $returned;
}