X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=admin%2Fdb%2Fusers_db.inc;h=8e215a20222f736330edd537fd070fb7cbbe56a5;hb=f821f29324e963437132a3f6fa7c57fcef5c5f0e;hp=221bc77c832d2e4399d82d5a3ae081cb856d6190;hpb=c4591429c1440bf6813a9793e4895b46367a3ccb;p=fa-stable.git diff --git a/admin/db/users_db.inc b/admin/db/users_db.inc index 221bc77c..8e215a20 100644 --- a/admin/db/users_db.inc +++ b/admin/db/users_db.inc @@ -101,6 +101,17 @@ function get_user_by_login($user_id) //----------------------------------------------------------------------------------------------- +function get_user_by_email($email) +{ + $sql = "SELECT * FROM ".TB_PREF."users WHERE email=".db_escape($email); + + $result = db_query($sql, "could not get user for email $email"); + + return db_fetch($result); +} + +//----------------------------------------------------------------------------------------------- + function delete_user($id) { $sql="DELETE FROM ".TB_PREF."users WHERE id=".db_escape($id); @@ -160,10 +171,10 @@ function check_user_activity($id) //----------------------------------------------------------------------------------------------- function show_users_online() { - global $show_users_online, $db; - - if (!isset($show_users_online) || $show_users_online == 0 || !defined('TB_PREF') || - !isset($_SESSION['get_text']) || !isset($db)) + global $db, $GetText, $SysPrefs; + + if (!isset($SysPrefs->show_users_online) || $SysPrefs->show_users_online == 0 || !defined('TB_PREF') || + !isset($GetText) || !isset($db)) return ""; $result = db_query("SHOW TABLES LIKE '".TB_PREF."useronline'"); if (db_num_rows($result) == 1) @@ -197,7 +208,7 @@ function show_users_online() } // Add user to database - db_query("INSERT INTO ".TB_PREF."useronline (timestamp, ip, file) VALUES ('". $timestamp ."','". $ip ."','". $_SERVER['PHP_SELF'] ."')"); + db_query("INSERT INTO ".TB_PREF."useronline (timestamp, ip, file) VALUES ('". $timestamp ."',". db_escape($ip) .",". db_escape($_SERVER['PHP_SELF']) .")"); //Remove users that were not online within $timeoutseconds. db_query("DELETE FROM ".TB_PREF."useronline WHERE timestamp<". $timeout); @@ -210,4 +221,3 @@ function show_users_online() return "$users ".($users == 1 ? _("user online") : _("users online")); } -?> \ No newline at end of file