示例#1
0
文件: db.php 项目: switchUA/stuff
function db_QueryFetchHash($query)
{
    $res = db_Fetch(db_doQuery($query));
    foreach ($res as $data) {
        $ret[$data['id']] = $data;
    }
    return $ret;
}
示例#2
0
function node_GetPosts($limit = 10, $offset = 0)
{
    global $NODE_SCHEMA;
    db_Connect();
    $items = db_Fetch("SELECT * FROM `" . CMW_TABLE_NODE . "` WHERE " . "`time_published` != " . "'0000-00-00 00:00:00'" . " AND " . "`type`=" . "\"post\"" . " ORDER BY `time_published` DESC" . " LIMIT " . $limit . " OFFSET " . $offset . ";", $NODE_SCHEMA);
    return $items;
}
示例#3
0
function user_GetIdAndHashByMail($mail)
{
    db_Connect();
    // TODO: Use time-attack safe fetch function
    $data = db_Fetch("SELECT `node` AS `id`,`hash` FROM `" . CMW_TABLE_USER . "` WHERE " . "`mail`=\"" . $mail . "\"" . " LIMIT 1" . ";");
    if (count($data)) {
        return $data[0];
    }
    return null;
}