Esempio n. 1
0
function auth()
{
    $id = mysql_escape_string($_POST['login']);
    $password = mysql_escape_string($_POST['password']);
    $query = mysql_query("SELECT * FROM tbl_auth WHERE id = '{$id}' and password ='******' limit 1");
    if (mysql_num_rows($query) == 1) {
        $_SESSION['auth'] = "1";
        $_SESSION['id'] = $id;
        $_SESSION['name'] = get_agency_name($id);
        //this is the first time we use this function to pull the agency name.
        $_SESSION['ses_start'] = date('Y-m-d-h-i-s');
        $_SESSION['log_ip'] = $_SERVER['REMOTE_ADDR'];
        log_activity('login');
        load_index();
    } else {
        $error_message = 'Sorry, try again! (your ip address has been recorded)';
        // This is an example of a generic log entry
        $_SESSION['extra'] = $id;
        //we set the extra var to the attemped user id
        $_SESSION['log_ip'] = $_SERVER['REMOTE_ADDR'];
        //we record the ip address
        log_activity('failed login');
        //we use a string to id the activity and write the log
        //  end of logging
        show_login($error_message);
    }
    //echo $query;
}
Esempio n. 2
0
    $index = array();
    if (file_exists('index.json')) {
        $index = json_decode(file_get_contents('index.json'), TRUE);
    }
    return $index;
}
function length_sort($a, $b)
{
    return strlen($b) - strlen($a);
}
function get_index_regex($index)
{
    $ids = array_keys($index);
    return '/\\^(' . join('|', $ids) . ')\\^/i';
}
$globalindex = load_index();
$globalindexregex = get_index_regex($globalindex);
for ($globalphase = 0; $globalphase < 2; ++$globalphase) {
    echo "Phase " . ($globalphase + 1) . "...\n";
    echo "posts...\n";
    process_directory('../Articles/_posts', 'update_article', $recurse = false);
    echo "modules...\n";
    process_directory('../Articles/_modules', 'update_module', $recurse = false);
    echo "sublayouts...\n";
    process_directory('../Articles/_sublayouts', 'update_sublayout', $recurse = false);
    echo "layouts...\n";
    process_directory('../Articles/_layouts', 'update_layout', $recurse = false);
    echo "pages...\n";
    process_directory('../Articles/_pages', 'update_page', $recurse = false);
}
if (!$nodirs) {
Esempio n. 3
0
</div>
<div class="text-justify col-lg-10 col-md-8 col-sm-7" id="Page">
<?php 
$path_parts = explode("/", trim($path, "/"));
switch ($path_parts[0]) {
    case "random":
    case "search":
    case "advanced-search":
        require_once dirname(__FILE__) . "/appmodules/search.mod.php";
        echo start_search($path_parts[0], $_GET);
        break;
    case "view":
        echo view_doc($path_parts[1], $path_parts[2]);
        break;
    default:
        echo load_index($path, $session);
}
?>
</div>
</div>
</div>
</body>
</html>

<?php 
function load_index($path, MCSession $curusr)
{
    if (empty($path) || $path == "/") {
        require_once dirname(__FILE__) . "/appmodules/series.mod.php";
        return list_projects($curusr, $_GET['q']);
    } else {