Пример #1
0
$expectedDBVersion = $_POST['DBVersion'];
if (!CheckDBVersion($expectedDBVersion)) {
    //Invalid DB Version
    print "Success={$success}&Error='Invalid DB version'";
    return;
}
//Check if username is being used already
if (AccountExists($username) != 0) {
    print "Success={$success}&Error='Username already in use'";
    return;
}
//Login
$userID = CreateNewAccount($username, $password);
if ($userID == -1) {
    print "Success={$success}&Error='Unable to create new user'";
    return;
}
//There will never be an existing session for a new user, no sense in even checking for it
$sessionID = CreateNewSession($userID);
if ($sessionID == 0) {
    print "Success={$success}&Error='Could not acquire session'";
    return;
}
if (!InitSession($userID, $sessionID)) {
    print "Success={$success}&Error='Could not init session'";
    return;
}
//We have a session, return it
TouchSession($sessionID);
$success = 1;
print "Success={$success}&SessionID={$sessionID}&Username={$username}";
Пример #2
0
function ParseInput()
{
    global $TabList;
    global $BookmarkVars;
    global $GraphTabs;
    global $Refresh;
    // Preset refresh value. Any Input pasring routing may reset refresh to 0, to disable refresh
    $_SESSION['refresh'] = $Refresh;
    /* 
     * user input may come from forms or links (POST or GET data) due to normal
     * form processing. If a bookmark is specified in the URL, this overwrites other
     * input data. To simplify data input checks, the bookmark is handled as any other post request
     */
    ReportLog("ParseInput:");
    if (isset($_GET['bookmark'])) {
        // process bookmarkstring
        $_bookmark = Util::htmlentities(base64_decode(urldecode($_GET['bookmark'])));
        ReportLog("Bookmark: '{$_bookmark}'");
        $_vars = explode('|', $_bookmark);
        if (count($BookmarkVars) == count($_vars)) {
            for ($i = 0; $i < count($BookmarkVars); $i++) {
                if ($_vars[$i] != '-') {
                    $_varpath = explode('/', $BookmarkVars[$i]);
                    $_varname = count($_varpath) == 2 ? $_varpath[1] : $_varpath[0];
                    ReportLog("Bookmark: Set {$_varname}");
                    $_POST[$_varname] = $_vars[$i];
                }
            }
        } else {
            SetMessage('warning', "Bookmark processing error");
        }
    }
    // process tab
    if (!array_key_exists('tab', $_SESSION)) {
        // first time in this session
        // initialize some more vars in the SESSION var
        InitSession(count($BookmarkVars));
    } else {
        $_tab = $_SESSION['tab'];
    }
    // click on tab list
    if (array_key_exists('tab', $_GET)) {
        $_tab = $_GET['tab'];
    }
    // tab from bookmark overwrites other entries
    if (array_key_exists('tab', $_POST)) {
        $_tab = $_POST['tab'];
    }
    $tab_changed = 0;
    if ($_tab != $_SESSION['tab'] || $_SESSION['tab'] == NULL) {
        // _tab changed since last cycle
        if (array_key_exists('tablock', $_SESSION)) {
            // must not change tab right now
            SetMessage('error', $_SESSION['tablock']);
        } else {
            // Verify new tab
            if (!is_numeric($_tab) || ($_tab > count($TabList) || $_tab < 0)) {
                SetMessage('warning', "Requested Tab not available. Set default tab to " . $TabList[0]);
                $_tab = 0;
            }
            $_tab = (int) $_tab;
            $_SESSION['tab'] = $_tab;
            if (!isset($_GET['bookmark'])) {
                $tab_changed = 1;
            }
            ReportLog("Tab: Set tab to {$_tab}: " . $TabList[$_tab]);
        }
    }
    // rebuild profile list
    if ($tab_changed && $_SESSION['tab'] == 4) {
        unset($_SESSION['ProfileList']);
        unset($_SESSION['PluginList']);
        $profiles = GetProfiles();
        GetPlugins();
    }
    // process sub tab
    $_tab = -1;
    if (array_key_exists('sub_tab', $_GET)) {
        $_tab = strip_tags($_GET['sub_tab']);
    }
    if (array_key_exists('sub_tab', $_POST)) {
        $_tab = strip_tags($_POST['sub_tab']);
    }
    if ($_tab >= 0) {
        if (!is_numeric($_tab) || $_tab < 0) {
            $_tab = 0;
        }
        $_SESSION['sub_tab'] = $_tab;
        ReportLog("Subtab: Set tab to {$_tab}: " . $GraphTabs[$_tab]);
    }
    // process profileswitch
    if (!array_key_exists('profileswitch', $_SESSION)) {
        // this is fishy - InitSession should have set this
        SetMessage('error', "Missing session parameter 'profileswitch'");
        $_SESSION['refresh'] = 0;
        return array(FALSE, 0, 0);
    } else {
        $_profileswitch = $_SESSION['profileswitch'];
    }
    if (array_key_exists('profileswitch', $_POST)) {
        $_profileswitch = Util::htmlentities($_POST['profileswitch']);
    }
    // the alerting module only accepts profile live for now
    if ($_SESSION['tab'] == 3) {
        $_profileswitch = './live';
    }
    $profile_changed = 0;
    if ($_profileswitch != $_SESSION['profileswitch']) {
        if ($_profileswitch == "New Profile ...") {
            // make sure the profile admin page gets this request;
            $_SESSION['tab'] = 4;
            $_SESSION['new_profile'] = TRUE;
            $_SESSION['refresh'] = 0;
        } else {
            // process new profileswitch
            if (preg_match("/^(.+)\\/(.+)/", $_profileswitch, $matches)) {
                $_profilegroup = $matches[1];
                $_profilename = $matches[2];
                // Check if profilegroup/profilename exists
                $_found = FALSE;
                foreach ($_SESSION['ProfileList'] as $p) {
                    if ($p == $_profileswitch) {
                        $_found = TRUE;
                    }
                }
                if (!$_found) {
                    SetMessage('error', "Profile '{$_profilename}' does not exists in profile group '{$_profilegroup}'");
                    SetMessage('warning', "Fall back to profile live");
                    $_profilegroup = '.';
                    $_profilename = 'live';
                }
            } else {
                SetMessage('error', "Can not parse profileswitch");
                SetMessage('warning', "Fall back to profile live");
                $_profilegroup = '.';
                $_profilename = 'live';
            }
            $profile_changed = 1;
            $_SESSION['profile'] = $_profilename;
            $_SESSION['profilegroup'] = $_profilegroup;
            $_SESSION['profileswitch'] = $_profileswitch;
        }
    }
    $profileinfo = ReadProfile($_SESSION['profileswitch']);
    if ($profileinfo == FALSE) {
        SetMessage('warning', "Fall back to profile live");
        unset($_SESSION['ProfileList']);
        $profiles = GetProfiles();
        $_SESSION['profileswitch'] = './live';
        $_SESSION['profile'] = 'live';
        $_SESSION['profilegroup'] = '.';
        $profileinfo = ReadProfile('./live');
        if ($profileinfo == FALSE) {
            // double failure
            SetMessage('error', "Can't read profile 'live'");
            $_SESSION['refresh'] = 0;
            return array(FALSE, 0, 0);
        }
    }
    if ($profileinfo['status'] == 'new') {
        $_SESSION['tab'] = 4;
        $_SESSION['refresh'] = 0;
        $_SESSION['tablock'] = "A new profile needs to be completed first.";
    } else {
        unset($_SESSION['tablock']);
    }
    $_SESSION['profileinfo'] = $profileinfo;
    // no refresh for history profiles
    if (($profileinfo['type'] & 3) == 1) {
        $_SESSION['refresh'] = 0;
    }
    return array(TRUE, $tab_changed, $profile_changed);
}
Пример #3
0
<?php

global $glspojeni;
include "include/db.php";
include "include/funkce.php";
$glspojeni = MysqlSpojeni();
$GLOBALS["spojeni"] = $glspojeni;
if (!$_SESSION["id"]) {
    InitSession();
}
?>

<!DOCTYPE html>                    
<html lang="fr">
  <head>    
    <title><?php 
echo $_GET["title"];
?>
 constructions en madrier et ossature bois, accessoires en fer forgé </title>          
    <meta charset="UTF-8">
    <meta name="author" content="VV SOFT"/>          
    <meta name="keywords" content="<?php 
echo $_GET["title"];
?>
 constructions, en madrier, et ossature, bois, fer forgé, chalet, maison"/>    
    <meta name="description" content="<?php 
echo $_GET["title"];
?>
 constructions en madrier et ossature bois, accessoires en fer forgé"/>          
    <meta name="Robots" content="all, follow" />    
    <meta name="Googlebot" content="index,follow,archive" />