Esempio n. 1
0
<?php

ob_start('ob_gzhandler');
require_once $_SERVER['DOCUMENT_ROOT'] . '/class/autoload.php';
use NERDZ\Core\Db;
$user = new NERDZ\Core\User();
if (!$user->isLogged()) {
    die(NERDZ\Core\Utils::jsonResponse('error', $user->lang('REGISTER')));
}
$viewonline = empty($_SESSION['mark_offline']) ? '1' : '0';
if (Db::NO_ERRNO != Db::query(array('UPDATE "users" SET "last" = NOW(), "viewonline" = :on WHERE "counter" = :id', array(':on' => $viewonline, ':id' => $_SESSION['id'])), Db::FETCH_ERRNO)) {
    die(NERDZ\Core\Utils::jsonResponse('error', 'Time'));
}
if (!($o = Db::query(array('SELECT "remote_addr","http_user_agent" FROM "users" WHERE "counter" = :id', array(':id' => $_SESSION['id'])), Db::FETCH_OBJ))) {
    die(NERDZ\Core\Utils::jsonResponse('error', $user->lang('ERROR')));
}
if (empty($o->remote_addr) || empty($_SESSION['remote_addr']) || $o->remote_addr != $_SERVER['REMOTE_ADDR']) {
    if (Db::NO_ERRNO != Db::query(array('UPDATE "users" SET "remote_addr" = :addr WHERE "counter" = :id', array(':addr' => $_SERVER['REMOTE_ADDR'], ':id' => $_SESSION['id'])), Db::FETCH_ERRNO)) {
        die(NERDZ\Core\Utils::jsonResponse('error', 'IP'));
    }
    $_SESSION['remote_addr'] = $_SERVER['REMOTE_ADDR'];
}
if (empty($o->http_user_agent) || empty($_SESSION['http_user_agent']) || $o->http_user_agent != $_SERVER['HTTP_USER_AGENT']) {
    if (Db::NO_ERRNO != Db::query(array('UPDATE "users" SET "http_user_agent" = :uag WHERE "counter" = :id', array(':uag' => htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8'), ':id' => $_SESSION['id'])), Db::FETCH_ERRNO)) {
        die(NERDZ\Core\Utils::jsonResponse('error', 'UA'));
    }
    $_SESSION['http_user_agent'] = $_SERVER['HTTP_USER_AGENT'];
}
die(NERDZ\Core\Utils::jsonResponse('ok', 'OK'));
Esempio n. 2
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/class/autoload.php';
$user = new NERDZ\Core\User();
if (!($logged = $user->isLogged())) {
    die($user->lang('REGISTER'));
}
$prj = isset($_GET['action']) && $_GET['action'] == 'project';
$truncate = true;
$path = 'home';
require $_SERVER['DOCUMENT_ROOT'] . '/pages/common/postlist.html.php';
Esempio n. 3
0
<?php

ob_start('ob_gzhandler');
require_once $_SERVER['DOCUMENT_ROOT'] . '/class/autoload.php';
$user = new NERDZ\Core\User();
$tplcfg = $user->getTemplateCfg();
if ($user->isLogged()) {
    die(header("Location: home.php"));
}
ob_start(array('NERDZ\\Core\\Utils', 'minifyHTML'));
?>
    <!DOCTYPE html>
    <html lang="<?php 
echo $user->getBoardLanguage();
?>
">
    <head>
    <meta name="description" content="NERDZ is a mix between a social network and a forum. You can share your code, enjoy information technology, talk about nerd stuff and more. Join in!" />
    <title><?php 
echo NERDZ\Core\Utils::getSiteName();
?>
 - Password</title>
<?php 
$headers = $tplcfg->getTemplateVars('reset');
require_once $_SERVER['DOCUMENT_ROOT'] . '/pages/common/jscssheaders.php';
?>
    </head>
    <?php 
ob_flush();
?>
<body>
Esempio n. 4
0
<?php

// require_once $prj, $path variables
if (!isset($prj, $path)) {
    die('$prj, $path required');
}
ob_start('ob_gzhandler');
require_once $_SERVER['DOCUMENT_ROOT'] . '/class/autoload.php';
use NERDZ\Core;
ob_start(array('NERDZ\\Core\\Utils', 'minifyHTML'));
$user = new NERDZ\Core\User();
$messages = new NERDZ\Core\Messages();
$logged = $user->isLogged();
// boards
$id = isset($_POST['id']) && is_numeric($_POST['id']) ? $_POST['id'] : false;
$limit = isset($_POST['limit']) ? NERDZ\Core\Security::limitControl($_POST['limit'], 10) : 10;
$beforeHpid = isset($_POST['hpid']) && is_numeric($_POST['hpid']) ? $_POST['hpid'] : false;
// homepage
if (isset($_POST['onlyfollowed'])) {
    $lang = false;
    $onlyfollowed = true;
} else {
    $lang = isset($_POST['lang']) ? $_POST['lang'] : false;
    $onlyfollowed = false;
}
$vote = isset($_POST['vote']) && is_string($_POST['vote']) ? trim($_POST['vote']) : false;
//search
$specific = isset($_GET['specific']);
$action = isset($_GET['action']) && $_GET['action'] === 'profile' ? 'profile' : 'project';
$search = !empty($_POST['q']) ? trim(htmlspecialchars($_POST['q'], ENT_QUOTES, 'UTF-8')) : false;
//rewrite $path if searching not in home