예제 #1
1
/**
 * Default method for user login, can be overwritten with 'try_log_user' trigger.
 * @see try_log_user()
 *
 * @param string $username
 * @param string $password
 * @param bool $remember_me
 * @return bool
 */
function pwg_login($success, $username, $password, $remember_me)
{
    if ($success === true) {
        return true;
    }
    // we force the session table to be clean
    pwg_session_gc();
    global $conf;
    // retrieving the encrypted password of the login submitted
    $query = '
SELECT ' . $conf['user_fields']['id'] . ' AS id,
       ' . $conf['user_fields']['password'] . ' AS password
  FROM ' . USERS_TABLE . '
  WHERE ' . $conf['user_fields']['username'] . ' = \'' . pwg_db_real_escape_string($username) . '\'
;';
    $row = pwg_db_fetch_assoc(pwg_query($query));
    if (isset($row['id']) and $conf['password_verify']($password, $row['password'], $row['id'])) {
        log_user($row['id'], $remember_me);
        trigger_notify('login_success', stripslashes($username));
        return true;
    }
    trigger_notify('login_failure', stripslashes($username));
    return false;
}
예제 #2
0
    case 'history_detail':
        $query = '
DELETE
  FROM ' . HISTORY_TABLE . '
;';
        pwg_query($query);
        break;
    case 'history_summary':
        $query = '
DELETE
  FROM ' . HISTORY_SUMMARY_TABLE . '
;';
        pwg_query($query);
        break;
    case 'sessions':
        pwg_session_gc();
        break;
    case 'feeds':
        $query = '
DELETE
  FROM ' . USER_FEED_TABLE . '
  WHERE last_check IS NULL
;';
        pwg_query($query);
        break;
    case 'database':
        do_maintenance_all_tables();
        break;
    case 'c13y':
        include_once PHPWG_ROOT_PATH . 'admin/include/check_integrity.class.php';
        $c13y = new check_integrity();