Esempio n. 1
0
<?php

$root = realpath(dirname(__FILE__));
include_once "{$root}/config.php";
include_once "{$root}/common.php";
if (dhIsLogin()) {
    dhRedirect('index');
}
$loginFail = false;
if (dhIsPost()) {
    $name = dhPost('name');
    $pass = dhPost('pass');
    $isValid = dhValid(array('name' => 'required', 'pass' => 'required'));
    $pass = md5($pass);
    if ($isValid) {
        $data = dhQuery("SELECT u.id_users\n             FROM users u\n             WHERE u.name = '{$name}'\n               AND u.pass = '******'");
        if ($data) {
            dhLogin($data[0]['id_users']);
            dhQueryUpdate('users', array('login' => time()), "id_users={$data[0]['id_users']}");
            dhRedirect('index');
        }
        $loginFail = true;
    }
}
dhTheme('login');
Esempio n. 2
0
<?php

$root = realpath(dirname(__FILE__));
include_once "{$root}/config.php";
include_once "{$root}/common.php";
if (!dhIsLogin()) {
    dhRedirect('index');
}
if (dhIsPost()) {
    if (dhValid(array('netname' => 'required'))) {
        $netid = dhPost('netid', 0);
        $netname = dhPost('netname', 'WORKGROUP');
        dhQueryUpdate('networks', array('netname' => $netname), "id_networks = '" . $netid . "'");
        if (dhConfig('useModRewrite')) {
            dhRedirect('networks', array('n' => $netid));
        } else {
            dhRedirect('networks', array('edit' => urlencode($netname)));
        }
    }
}
if (dhHasGet('n')) {
    $netid = dhGet('n');
}
$networks = dhQuery("SELECT n.id_networks\n          , n.netname\n     FROM networks n\n     WHERE n.id_networks = '{$netid}'\n       AND n.id_users = '" . dhUID() . "'");
if ($networks) {
    $network = array_shift($networks);
}
dhTheme('networks-edit');