Example #1
0
function dhNetworks()
{
    static $networks = null;
    if (null === $networks) {
        $networks = dhQuery("SELECT n.id_networks\n                  , n.netname\n             FROM networks n\n             WHERE n.id_users = '" . dhUID() . "'");
    }
    return $networks;
}
Example #2
0
function dhConfig($name)
{
    static $config = array();
    if (sizeof($config) == 0) {
        $data = dhQuery("SELECT c.name, c.value\n             FROM config c");
        foreach ((array) $data as $row) {
            $config[$row['name']] = $row['value'];
        }
    }
    if (isset($config[$name])) {
        return $config[$name];
    } else {
        return null;
    }
}
Example #3
0
<?php

$root = realpath(dirname(__FILE__));
include_once "{$root}/config.php";
include_once "{$root}/common.php";
if (!dhIsLogin()) {
    dhRedirect('index');
}
if (dhHasGet('n')) {
    $id = dhGet('n');
    $networks = dhQuery("SELECT n.id_networks\n              , n.netname\n         FROM networks n\n         WHERE n.id_networks = '{$id}'");
    if ($networks) {
        $network = array_shift($networks);
        $netname = $network['netname'];
        dhQueryDelete('networks', "id_networks = '{$id}'");
        if (dhConfig('useModRewrite')) {
            dhRedirect('networks');
        } else {
            dhRedirect('networks', array('delete' => $netname));
        }
        exit;
    }
}
dhRedirect('networks');
Example #4
0
function dhQueryDelete($table, $where)
{
    return dhQuery("DELETE FROM {$table}\n         WHERE " . dhWhereSQL($where));
}
Example #5
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');
Example #6
0
<?php

$root = realpath(dirname(__FILE__));
include_once "{$root}/config.php";
include_once "{$root}/common.php";
if (!dhIsLogin()) {
    dhRedirect('index');
}
if (dhHasGet('action')) {
    switch (dhGet('action')) {
        case 'add':
            include_once "{$root}/networks-add.php";
            exit;
            break;
        case 'edit':
            include_once "{$root}/networks-edit.php";
            exit;
            break;
        case 'delete':
            include_once "{$root}/networks-delete.php";
            exit;
            break;
    }
}
if (dhHasGet('n')) {
    $networks = dhQuery("SELECT n.id_networks\n              , n.netname\n              , n.created\n              , n.modified\n         FROM networks n\n         WHERE n.id_networks = '" . dhGet('n') . "'");
    if ($networks) {
        $network = array_shift($networks);
    }
}
dhTheme('networks');
Example #7
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');