//-----------------------------------------------------------------------------------------------
+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);
//-----------------------------------------------------------------------------------------------
function show_users_online()
{
- global $show_users_online, $db, $GetText;
-
- if (!isset($show_users_online) || $show_users_online == 0 || !defined('TB_PREF') ||
+ 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'");
}
// 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);
return "$users ".($users == 1 ? _("user online") : _("users online"));
}
-?>
\ No newline at end of file