Commit 2ba1d5bb authored by Dries's avatar Dries
Browse files

- Simplified the session code (PostgreSQL update).

parent 3123d7e6
......@@ -21,11 +21,11 @@ function sess_close() {
function sess_read($key) {
global $user;
$uid = (isset($user->uid)) ? $user->uid : 0;
$result = db_query_range("SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = '%s' AND u.status < 3", $key, 0, 1);
if (!db_num_rows($result)) {
db_query("INSERT INTO {sessions} (sid, uid, hostname, timestamp) VALUES ('%s', %d, '%s', %d)", $key, $uid, $_SERVER["REMOTE_ADDR"], time());
db_query("INSERT INTO {sessions} (sid, uid, hostname, timestamp) VALUES ('%s', 0, '%s', %d)", $key, $_SERVER["REMOTE_ADDR"], time());
$result = db_query("SELECT u.* FROM {users} u WHERE u.uid = 0");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment