Example #1
0
<?php

$root = realpath(dirname(__FILE__));
include_once "{$root}/config.php";
include_once "{$root}/common.php";
if (dhIsLogin()) {
    dhRedirect('index');
}
if (dhIsPost()) {
    $name = dhPost('name');
    if (dhValid(array('name' => 'required'))) {
        die('die');
    }
}
dhTheme('lostpassword');
Example #2
0
function dhNValid($argv = null)
{
    return !dhValid($argv);
}
Example #3
0
<?php

$root = realpath(dirname(__FILE__));
include_once "{$root}/config.php";
include_once "{$root}/common.php";
if (dhIsLogin()) {
    dhRedirect('index');
}
if (dhIsPost()) {
    $isValid = dhValid(array('fullname' => 'required', 'name' => 'required', 'pass' => 'required', 'pass2' => array('required' => true, 'equal' => 'pass'), 'question' => 'required', 'anwser' => 'required'));
    if ($isValid) {
        dhQueryInsert('users', array('fullname' => dhPost('fullname'), 'name' => dhPost('name'), 'pass' => md5(dhPost('pass')), 'question' => dhPost('question'), 'anwser' => dhPost('anwser'), 'register' => time()));
        dhRedirect('register-success', array('name', dhPost('name')));
    }
}
dhTheme('register');
Example #4
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');