4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on April 08, 2005, 12:07:25 AM
-
This little "MOD" will log and show Most Ever Users Online
In Version 2 added logging most members and guest online separately as well as their total number.
If u have intstalled the first version, u'll need to uninstall it first.
Please look in the next reply for the uninstall instructions.
There are only 3 files to modify:
includes/sessions.php
lang/<yourlanguage>/main.php
templates/<yourtemlplate>/whos_online.html (I chosed this temlplate, but u can add the changes to any template(s) u wish.)
--------------- [ Installation ] ----------------
Step 1
Open includes/sessions.php
Find:
$whos_online = $site_template->parse_template("whos_online");
Insert above:
//-----------------------------
//---Most ever users online----
//-----------------------------
$most = explode("|", $config['most_users']);
$most_total = explode(",", $most[0]);
$most_registered = explode(",", $most[1]);
$most_guests = explode(",", $most[2]);
$update = 0;
if ($num_total_online > $most_total[0])
{
$most_total[0] = $num_total_online;
$most_total[1] = time();
$most[0] = $most_total[0].",".$most_total[1];
$update = 1;
}
if ($num_registered_online > $most_registered[0])
{
$most_registered[0] = $num_registered_online;
$most_registered[1] = time();
$most[1] = $most_registered[0].",".$most_registered[1];
$update = 1;
}
if ($num_guests_online > $most_guests[0])
{
$most_guests[0] = $num_guests_online;
$most_guests[1] = time();
$most[2] = $most_guests[0].",".$most_guests[1];
$update = 1;
}
if ($update) {
$config['most_users'] = implode("|", $most);
$sql = "UPDATE ".SETTINGS_TABLE."
SET setting_value = '".$config['most_users']."'
WHERE setting_name = 'most_users'";
$site_db->query($sql);
}
$site_template->register_vars(array(
"mueo" => $most_total[0],
"mueo_date" => format_date($config['date_format'].", ".$config['time_format'], $most_total[1]),
"mueo_registered" => $most_registered[0],
"mueo_registered_date" => format_date($config['date_format'].", ".$config['time_format'], $most_registered[1]),
"mueo_guests" => $most_guests[0],
"mueo_guests_date" => format_date($config['date_format'].", ".$config['time_format'], $most_guests[1]),
"lang_mueo" => $lang['mueo'],
"lang_mueo_total" => $lang['mueo_total'],
"lang_mueo_date" => $lang['mueo_date'],
"lang_mueo_registered" => $lang['mueo_registered'],
"lang_mueo_guests" => $lang['mueo_guests'],
));
//End Most Ever Online
Step 2
Open lang/<yourlanguage>/main.php
At the very end, above closing ?> insert this:
$lang['mueo'] = "Most users ever online was";
$lang['mueo_date'] = "on";
$lang['mueo_total'] = "Total";
$lang['mueo_registered'] = "Members";
$lang['mueo_guests'] = "Guests";
Step 3
Open temlates/<yourtemplate>/whos_online.html
Insert this:
{lang_mueo}:<br />
{lang_mueo_total}: <B>{mueo}</B> {lang_mueo_date} {mueo_date}<br />
{lang_mueo_registered}: <B>{mueo_registered}</B> {lang_mueo_date} {mueo_registered_date}<br />
{lang_mueo_guests}: <B>{mueo_guests}</B> {lang_mueo_date} {mueo_guests_date}<br />
(design is your task ;))
Step 4
Download "MEUO Install v2 (http://gallery.vano.org/file13dl)" file
Extract it into root of your 4images directory. And run the install_mueo.php (http://yoursite/install_mueo.php)
Upload all modified files.
NOTE: first time u open any page, u might get some error messages, but after refresh everything should be fine.
-
If you installed previous version (v1) or this mod, you will need uninstall it:
Remove from includes/sessions.php:
//-----------------------------
//---Most ever users online----
//-----------------------------
if ($num_total_online > preg_replace("/,[0-9]+/", "",$config['most_users'])) {
$most_users = $num_total_online.",".time();
$config['most_users'] = $most_users; //ensure that this will be displayed right now, not after second refresh
$sql = "UPDATE ".SETTINGS_TABLE."
SET setting_value = '$most_users'
WHERE setting_name = 'most_users'";
$site_db->query($sql);
}
And "mueo" => preg_replace("/,[0-9]+/", "",$config['most_users']),
"mueo_date" => format_date($config['date_format'].", ".$config['time_format'], preg_replace("/[0-9]+,/", "", $config['most_users'])),
"lang_mueo" => $lang['mueo'],
"lang_mueo_date" => $lang['mueo_date'],
(Optional) Remove from lang/<yourlanguage>/main.php :
$lang['mueo'] = "Most users ever online was ";
$lang['mueo_date'] = "on";
(Optional) Remove from templates/<yourtemplate>/whos_online.html :
{lang_mueo} <B>{mueo}</B> {lang_mueo_date} {mueo_date}
-
Great nice Mod, thanx :lol:
and i'm waiting for the Flag mod in the whois online template ;)
-
Step 1: u need insert the code ABOVE and not BELOW!
-
Step 1: u need insert the code ABOVE and not BELOW!
Can u give me an example please?
-
Can u give me an example please?
sorry, what example?
a
b
c
"a" - is above "b"
"b" - is above "c", but below "a"
"c" - is below "b"
-
Do i have to leave "install_meuo.php" in main category?
Script Works great.
-
any installation or setup scripts should be deleted to prevent accidental reinstall.
-
any installation or setup scripts should be deleted to prevent accidental reinstall.
thats what i did before, but as soon as i deleted instalation script i got errors and i couldn't view my website. so i added it back on b/c i remember i could use it while i still had installation file, and then it worked.
-
Should it only start working in the end of the first day?
I'm asking this because all I get is dots:
:
:
:
:
:(
-
Step 1
Insert above
-
I did that V@no
array($num_registered_online,$num_invisible_online,$num_guests_online), $lang['user_online_detail']),
));
//-----------------------------
//---Most ever users online----
//-----------------------------
$most = explode("|", $config['most_users']);
$most_total = explode(",", $most[0]);
$most_registered = explode(",", $most[1]);
$most_guests = explode(",", $most[2]);
$update = 0;
if ($num_total_online > $most_total[0])
{
$most_total[0] = $num_total_online;
$most_total[1] = time();
$most[0] = $most_total[0].",".$most_total[1];
$update = 1;
}
if ($num_registered_online > $most_registered[0])
{
$most_registered[0] = $num_registered_online;
$most_registered[1] = time();
$most[1] = $most_registered[0].",".$most_registered[1];
$update = 1;
}
if ($num_guests_online > $most_guests[0])
{
$most_guests[0] = $num_guests_online;
$most_guests[1] = time();
$most[2] = $most_guests[0].",".$most_guests[1];
$update = 1;
}
if ($update) {
$config['most_users'] = implode("|", $most);
$sql = "UPDATE ".SETTINGS_TABLE."
SET setting_value = '".$config['most_users']."'
WHERE setting_name = 'most_users'";
$site_db->query($sql);
}
$site_template->register_vars(array(
"mueo" => $most_total[0],
"mueo_date" => format_date($config['date_format'].", ".$config['time_format'], $most_total[1]),
"mueo_registered" => $most_registered[0],
"mueo_registered_date" => format_date($config['date_format'].", ".$config['time_format'], $most_registered[1]),
"mueo_guests" => $most_guests[0],
"mueo_guests_date" => format_date($config['date_format'].", ".$config['time_format'], $most_guests[1]),
"lang_mueo" => $lang['mueo'],
"lang_mueo_total" => $lang['mueo_total'],
"lang_mueo_date" => $lang['mueo_date'],
"lang_mueo_registered" => $lang['mueo_registered'],
"lang_mueo_guests" => $lang['mueo_guests'],
));
//End Most Ever Online
$whos_online = $site_template->parse_template("whos_online");
But all I get is those
:
:
:
:
-
I've installed it on my home.html, but already tryed on whos_online.html and not working either.
MUEO table modification was installed, language main.php was updated as long as session.php
V@no I'm leaving here my session.php in full because I've already added other mods, so see if something's wrong please:
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: sessions.php *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.1 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (Lizenz.txt) für weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (Licence.txt) for further information. *
* *
*************************************************************************/
if (!defined('ROOT_PATH')) {
die("Security violation");
}
//-----------------------------------------------------
//--- Start Configuration -----------------------------
//-----------------------------------------------------
define('SESSION_NAME', 'sessionid');
$user_table_fields = array(
"user_id" => "user_id",
"user_level" => "user_level",
"user_name" => "user_name",
"user_password" => "user_password",
"user_email" => "user_email",
"user_showemail" => "user_showemail",
"user_allowemails" => "user_allowemails",
"user_invisible" => "user_invisible",
"user_joindate" => "user_joindate",
"user_activationkey" => "user_activationkey",
"user_lastaction" => "user_lastaction",
"user_location" => "user_location",
"user_lastvisit" => "user_lastvisit",
"user_comments" => "user_comments",
"user_homepage" => "user_homepage",
"user_icq" => "user_icq"
);
//-----------------------------------------------------
//--- End Configuration -------------------------------
//-----------------------------------------------------
function get_user_table_field($add, $user_field) {
global $user_table_fields;
return (!empty($user_table_fields[$user_field])) ? $add.$user_table_fields[$user_field] : "";
}
class Session {
var $session_id;
var $user_ip;
var $user_location;
var $current_time;
var $session_timeout;
var $mode = "get";
var $session_info = array();
var $user_info = array();
function Session() {
global $config;
$this->session_timeout = $config['session_timeout'] * 60;
$this->user_ip = $this->get_user_ip();
$this->user_location = $this->get_user_location();
$this->current_time = time();
// Stop adding SID to URLs
@ini_set('session.use_trans_sid', 0);
session_name(urlencode(SESSION_NAME));
session_start();
$this->demand_session();
}
function set_cookie_data($name, $value, $permanent = 1) {
$cookie_expire = ($permanent) ? $this->current_time + 60 * 60 * 24 * 365 : 0;
$cookie_name = COOKIE_NAME.$name;
setcookie($cookie_name, $value, $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
}
function read_cookie_data($name) {
global $HTTP_COOKIE_VARS;
$cookie_name = COOKIE_NAME.$name;
return (isset($HTTP_COOKIE_VARS[$cookie_name])) ? $HTTP_COOKIE_VARS[$cookie_name] : false;
}
function get_session_id() {
if (SID == '') {
$this->mode = "cookie";
}
$this->session_id = session_id();
}
function demand_session() {
$this->get_session_id();
if (!$this->load_session_info()) {
$this->delete_old_sessions();
$user_id = ($this->read_cookie_data("userid")) ? intval($this->read_cookie_data("userid")) : GUEST;
$this->start_session($user_id);
}
else {
$this->user_info = $this->load_user_info($this->session_info['session_user_id']);
$update_cutoff = ($this->user_info['user_id'] != GUEST) ? $this->current_time - $this->user_info['user_lastaction'] : $this->current_time - $this->session_info['session_lastaction'];
if ($update_cutoff > 60) {
$this->update_session();
$this->delete_old_sessions();
}
}
}
function start_session($user_id = GUEST, $login_process = 0) {
global $site_db;
$this->user_info = $this->load_user_info($user_id);
if ($this->user_info['user_id'] != GUEST && !$login_process) {
if ($this->read_cookie_data("userpass") === $this->user_info['user_password'] && $this->user_info['user_level'] > USER_AWAITING) {
$this->set_cookie_data("userpass", $this->user_info['user_password']);
}
else {
$this->set_cookie_data("userpass", "", 0);
$this->user_info = $this->load_user_info(GUEST);
}
}
//if (!$login_process) {
$sql = "REPLACE INTO ".SESSIONS_TABLE."
(session_id, session_user_id, session_lastaction, session_location, session_ip)
VALUES
('$this->session_id', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
$site_db->query($sql);
//}
$this->session_info['session_user_id'] = $this->user_info['user_id'];
$this->session_info['session_lastaction'] = $this->current_time;
$this->session_info['session_location'] = $this->user_location;
$this->session_info['session_ip'] = $this->user_ip;
if ($this->user_info['user_id'] != GUEST) {
$this->user_info['user_lastvisit'] = (!empty($this->user_info['user_lastaction'])) ? $this->user_info['user_lastaction'] : $this->current_time;
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location', ".get_user_table_field("", "user_lastvisit")." = ".$this->user_info['user_lastvisit']."
WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
$site_db->query($sql);
}
$this->set_cookie_data("lastvisit", $this->user_info['user_lastvisit']);
$this->set_cookie_data("userid", $this->user_info['user_id']);
return true;
}
function login($user_name = "", $user_password = "", $auto_login = 0, $set_auto_login = 1) {
global $site_db, $user_table_fields;
if (empty($user_name) || empty($user_password)) {
return false;
}
$sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_password")."
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_name")." = '$user_name' AND ".get_user_table_field("", "user_level")." <> ".USER_AWAITING;
$row = $site_db->query_firstrow($sql);
$user_id = (isset($row[$user_table_fields['user_id']])) ? $row[$user_table_fields['user_id']] : GUEST;
$user_password = md5($user_password);
if ($user_id != GUEST) {
if ($row[$user_table_fields['user_password']] == $user_password) {
$sql = "UPDATE ".SESSIONS_TABLE."
SET session_user_id = $user_id
WHERE session_id = '$this->session_id'";
$site_db->query($sql);
if ($set_auto_login) {
$this->set_cookie_data("userpass", ($auto_login) ? $user_password : "");
}
$this->start_session($user_id, 1);
return true;
}
}
return false;
}
function logout($user_id) {
global $site_db;
$sql = "DELETE FROM ".SESSIONS_TABLE."
WHERE session_id = '$this->session_id' OR session_user_id = $user_id";
$site_db->query($sql);
$this->set_cookie_data("userpass", "", 0);
$this->set_cookie_data("userid", GUEST);
$this->session_info = array();
return true;
}
function delete_old_sessions() {
global $site_db;
$expiry_time = $this->current_time - $this->session_timeout;
$sql = "DELETE FROM ".SESSIONS_TABLE."
WHERE session_lastaction < $expiry_time";
$site_db->query($sql);
return true;
}
function update_session() {
global $site_db;
$sql = "UPDATE ".SESSIONS_TABLE."
SET session_lastaction = $this->current_time, session_location = '$this->user_location'
WHERE session_id = '$this->session_id'";
$site_db->query($sql);
$this->session_info['session_lastaction'] = $this->current_time;
$this->session_info['session_location'] = $this->user_location;
$this->session_info['session_ip'] = $this->user_ip;
if ($this->user_info['user_id'] != GUEST) {
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location'
WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
$site_db->query($sql);
}
return;
}
function generate_session_id() {
return session_id();
}
function return_session_info() {
return $this->session_info;
}
function return_user_info() {
return $this->user_info;
}
function freeze() {
return;
}
function load_session_info() {
if (@ini_get('register_globals')) {
session_register('__session');
if (!isset($GLOBALS['__session'])) {
$GLOBALS['__session'] = array();
}
$this->session_info = &$GLOBALS['__session'];
} else {
if (isset($_SESSION)) {
if (!isset($_SESSION['__session'])) {
$_SESSION['__session'] = array();
}
$this->session_info = &$_SESSION['__session'];
} else {
if (!isset($GLOBALS['HTTP_SESSION_VARS']['__session'])) {
$GLOBALS['HTTP_SESSION_VARS']['__session'] = array();
}
$this->session_info = &$GLOBALS['HTTP_SESSION_VARS']['__session'];
}
}
if (!isset($this->session_info['session_user_id'])) {
return false;
}
return $this->session_info;
}
function load_user_info($user_id = GUEST) {
global $site_db, $user_table_fields;
if ($user_id != GUEST) {
$sql = "SELECT u.*, l.*
FROM ".USERS_TABLE." u, ".LIGHTBOXES_TABLE." l
WHERE ".get_user_table_field("u.", "user_id")." = $user_id AND l.user_id = ".get_user_table_field("u.", "user_id");
$user_info = $site_db->query_firstrow($sql);
if (!$user_info) {
$sql = "SELECT *
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_id")." = $user_id";
$user_info = $site_db->query_firstrow($sql);
if ($user_info) {
$lightbox_id = get_random_key(LIGHTBOXES_TABLE, "lightbox_id");
$sql = "INSERT INTO ".LIGHTBOXES_TABLE."
(lightbox_id, user_id, lightbox_lastaction, lightbox_image_ids)
VALUES
('$lightbox_id', ".$user_info[$user_table_fields['user_id']].", $this->current_time, '')";
$site_db->query($sql);
$user_info['lightbox_lastaction'] = $this->current_time;
$user_info['lightbox_image_ids'] = "";
}
}
}
if (empty($user_info[$user_table_fields['user_id']])) {
$user_info = array();
$user_info['user_id'] = GUEST;
$user_info['user_level'] = GUEST;
$user_info['user_lastaction'] = $this->current_time;
$user_info['user_lastvisit'] = ($this->read_cookie_data("lastvisit")) ? $this->read_cookie_data("lastvisit") : $this->current_time;
}
foreach ($user_table_fields as $key => $val) {
if (isset($user_info[$val])) {
$user_info[$key] = $user_info[$val];
}
elseif (!isset($user_info[$key])) {
$user_info[$key] = "";
}
}
return $user_info;
}
function set_session_var($var_name, $value) {
$this->session_info[$var_name] = $value;
return true;
}
function get_session_var($var_name) {
if (isset($this->session_info[$var_name])) {
return $this->session_info[$var_name];
}
return '';
}
function drop_session_var($var_name) {
unset($this->session_info[$var_name]);
}
function get_user_ip() {
global $HTTP_SERVER_VARS, $HTTP_ENV_VARS;
$ip = (!empty($HTTP_SERVER_VARS['REMOTE_ADDR'])) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ((!empty($HTTP_ENV_VARS['REMOTE_ADDR'])) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv("REMOTE_ADDR"));
$ip = preg_replace("/[^\.0-9]+/", "", $ip);
return substr($ip, 0, 50);
}
function get_user_location() {
global $self_url;
return (defined("IN_CP")) ? "Control Panel" : preg_replace(array("/([?|&])action=[^?|&]*/", "/([?|&])mode=[^?|&]*/", "/([?|&])phpinfo=[^?|&]*/", "/([?|&])printstats=[^?|&]*/", "/[?|&]".URL_ID."=[^?|&]*/", "/[?|&]l=[^?|&]*/", "/[&?]+$/"), array("", "", "", "", "", "", ""), addslashes($self_url));
}
/* ORIGINAL CODE
function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
*/
function url($url, $amp = "&") {
global $l, $user_info;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
$url = str_replace('&', '&', $url);
if (!defined('IN_CP')) {
if (strstr($url, 'index.php')) {
$url = str_replace('index.php', '', $url);
}
elseif (strstr($url, 'search.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('search.php', 'search.htm', $url);
}
}
elseif (strstr($url, 'lightbox.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('lightbox.php', 'lightbox.htm', $url);
}
}
elseif (strstr($url, 'categories.php')) {
if (strstr($url, 'cat_id=') && strstr($url, 'page=')) {
preg_match('#cat_id=([0-9]+)&?#', $url, $matches1);
preg_match('#page=([0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('categories.php', 'cat'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('cat_id='.$matches1[1].'&', '', $query);
$query = str_replace('&cat_id='.$matches1[1], '', $query);
$query = str_replace('cat_id='.$matches1[1], '', $query);
$query = str_replace('page='.$matches2[1].'&', '', $query);
$query = str_replace('&page='.$matches2[1], '', $query);
$query = str_replace('page='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
elseif (strstr($url, 'cat_id=')) {
preg_match('#cat_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('categories.php', 'cat'.$matches[1].'.htm', $url);
$query = str_replace('cat_id='.$matches[1].'&', '', $query);
$query = str_replace('&cat_id='.$matches[1], '', $query);
$query = str_replace('cat_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('categories.php', 'cat.htm', $url);
}
}
elseif (strstr($url, 'details.php?image_id=')) {
if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('image_id='.$matches1[1].'&', '', $query);
$query = str_replace('&image_id='.$matches1[1], '', $query);
$query = str_replace('image_id='.$matches1[1], '', $query);
$query = str_replace('mode='.$matches2[1].'&', '', $query);
$query = str_replace('&mode='.$matches2[1], '', $query);
$query = str_replace('mode='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.$matches[1].'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
elseif (strstr($url, 'postcards.php?image_id=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
if ($this->mode == "get" && strstr($url, $this->session_id)) {
$url .= strpos($url, '?') !== false ? '&' : '?';
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') ? '&' : '?';
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
return $url;
}
} //end of class
//-----------------------------------------------------
//--- Start Session -----------------------------------
//-----------------------------------------------------
define('COOKIE_NAME', '4images_');
define('COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIE_SECURE', '0');
$site_sess = new Session();
// Get Userinfo
$session_info = $site_sess->return_session_info();
$user_info = $site_sess->return_user_info();
//-----------------------------------------------------
//--- Get User Caches ---------------------------------
//-----------------------------------------------------
$num_total_online = 0;
$num_visible_online = 0;
$num_invisible_online = 0;
$num_registered_online = 0;
$num_guests_online = 0;
$user_online_list = "";
$prev_user_ids = array();
$prev_session_ips = array();
if (defined("GET_USER_ONLINE") && ($config['display_whosonline'] == 1 || $user_info['user_level'] == ADMIN)) {
$time_out = time() - 300;
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible")."
FROM ".SESSIONS_TABLE." s
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = s.session_user_id)
WHERE s.session_lastaction >= $time_out
ORDER BY ".get_user_table_field("u.", "user_id")." ASC, s.session_ip ASC";
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
if ($row['session_user_id'] != GUEST && (isset($row['user_id']) && $row['user_id'] != GUEST)) {
if (!isset($prev_user_ids[$row['session_user_id']])) {
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 1 : 0;
$invisibleuser = ($is_invisible) ? "*" : "";
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>", $row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];
if (!$is_invisible || $user_info['user_level'] == ADMIN) {
$user_online_list .= ($user_online_list != "") ? ", " : "";
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
}
(!$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
$num_registered_online++;
}
$prev_user_ids[$row['session_user_id']] = 1;
}
else {
if (!isset($prev_session_ips[$row['session_ip']])) {
$num_guests_online++;
}
}
$prev_session_ips[$row['session_ip']] = 1;
}
$num_total_online = $num_registered_online + $num_guests_online;
//$num_invisible_online = $num_registered_online - $num_visible_online;
$site_template->register_vars(array(
"num_total_online" => $num_total_online,
"num_invisible_online" => $num_invisible_online,
"num_registered_online" => $num_registered_online,
"num_guests_online" => $num_guests_online,
"user_online_list" => $user_online_list,
"lang_user_online" => str_replace('{num_total_online}', $num_total_online, $lang['user_online']),
"lang_user_online_detail" => str_replace(array('{num_registered_online}','{num_invisible_online}','{num_guests_online}'), array($num_registered_online,$num_invisible_online,$num_guests_online), $lang['user_online_detail']),
));
//-----------------------------
//---Most ever users online----
//-----------------------------
$most = explode("|", $config['most_users']);
$most_total = explode(",", $most[0]);
$most_registered = explode(",", $most[1]);
$most_guests = explode(",", $most[2]);
$update = 0;
if ($num_total_online > $most_total[0])
{
$most_total[0] = $num_total_online;
$most_total[1] = time();
$most[0] = $most_total[0].",".$most_total[1];
$update = 1;
}
if ($num_registered_online > $most_registered[0])
{
$most_registered[0] = $num_registered_online;
$most_registered[1] = time();
$most[1] = $most_registered[0].",".$most_registered[1];
$update = 1;
}
if ($num_guests_online > $most_guests[0])
{
$most_guests[0] = $num_guests_online;
$most_guests[1] = time();
$most[2] = $most_guests[0].",".$most_guests[1];
$update = 1;
}
if ($update) {
$config['most_users'] = implode("|", $most);
$sql = "UPDATE ".SETTINGS_TABLE."
SET setting_value = '".$config['most_users']."'
WHERE setting_name = 'most_users'";
$site_db->query($sql);
}
$site_template->register_vars(array(
"mueo" => $most_total[0],
"mueo_date" => format_date($config['date_format'].", ".$config['time_format'], $most_total[1]),
"mueo_registered" => $most_registered[0],
"mueo_registered_date" => format_date($config['date_format'].", ".$config['time_format'], $most_registered[1]),
"mueo_guests" => $most_guests[0],
"mueo_guests_date" => format_date($config['date_format'].", ".$config['time_format'], $most_guests[1]),
"lang_mueo" => $lang['mueo'],
"lang_mueo_total" => $lang['mueo_total'],
"lang_mueo_date" => $lang['mueo_date'],
"lang_mueo_registered" => $lang['mueo_registered'],
"lang_mueo_guests" => $lang['mueo_guests'],
));
//End Most Ever Online
$whos_online = $site_template->parse_template("whos_online");
$site_template->register_vars("whos_online", $whos_online);
unset($whos_online);
unset($prev_user_ids);
unset($prev_session_ips);
}
?>
-
very nice mod, works great see http://gallery.steves-network.com how it works its under "Currently Active Users"
-
A weakness has been discovered. In your includes/sessions.php file,
find :
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
with :
$user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $row['session_user_id'], $url_show_profile) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id']);
Merry Christmas.
-
This MOD must take the usefull RESPECT for Va@no :wink:
Very simple but also very nice - day for day I love 4img more and more :mrgreen:
-
when i try to run the install_meou.php i get this error
Parse error: parse error in /home/sites/site6/web/foto/install_meuo.php on line 138
what can i do to fix that
-
make sure you uploaded that file in ASCII mode not BINARY
-
Thx
no it works
-
I need a mod which can show: who was online 5 days ago and the total member registered
thanks :cry:
-
tested on 1.7.2 :D
and it works :lol:
-
hello V@no!
Download "MEUO Install v2" file
don't work! can you fix this? THX!!
-
file attached to the post now.
-
perfect! thank you! :D
-
Hallo
Ich habe diesen Mod denke ich richtig instaliert.
Er zeigt mir auch alles an .
Nur komm ich seit dem nicht mehr in den Admin control Panel .
Woran kann das liegen ?
Nach der installation stand dieses da :
Database successfuly updated!
1. Done
INSERT INTO 4images_settings (setting_name, setting_value) VALUES ('most_users', '0,0|0,0|0,0')
Das ist der Link zu der Seite.
http://ecards.terravisions.de/index.php
P.S. das einzige was zu sehen ist sind diese 2 << oben links.
Vielen Dank im vorraus.
LG Doreen
-
I have this installed and it works fine except for the date is showing up as being January of this year. Anyway to fix the date? Everything else shows up just fine on it.
-
I have this installed and it works fine except for the date is showing up as being January of this year. Anyway to fix the date? Everything else shows up just fine on it.
In includes/sessions.php file,
find:
$site_template->register_vars(array(
"mueo" => $most_total[0],
"mueo_date" => format_date($config['date_format'].", ".$config['time_format'], $most_total[1]),
"mueo_registered" => $most_registered[0],
"mueo_registered_date" => format_date($config['date_format'].", ".$config['time_format'], $most_registered[1]),
"mueo_guests" => $most_guests[0],
"mueo_guests_date" => format_date($config['date_format'].", ".$config['time_format'], $most_guests[1]),
"lang_mueo" => $lang['mueo'],
"lang_mueo_total" => $lang['mueo_total'],
"lang_mueo_date" => $lang['mueo_date'],
"lang_mueo_registered" => $lang['mueo_registered'],
"lang_mueo_guests" => $lang['mueo_guests'],
));
replace:
$site_template->register_vars(array(
"mueo" => $most_total[0],
"mueo_date" => format_date($config['date_format']." ".$config['time_format'], $most_total[1]),
"mueo_registered" => $most_registered[0],
"mueo_registered_date" => format_date($config['date_format']." ".$config['time_format'], $most_registered[1]),
"mueo_guests" => $most_guests[0],
"mueo_guests_date" => format_date($config['date_format']." ".$config['time_format'], $most_guests[1]),
"lang_mueo" => $lang['mueo'],
"lang_mueo_total" => $lang['mueo_total'],
"lang_mueo_date" => $lang['mueo_date'],
"lang_mueo_registered" => $lang['mueo_registered'],
"lang_mueo_guests" => $lang['mueo_guests'],
));
format_date is 2 constant - no for 3. ;)
-
Is no same code ... I remove first comma in format_date line (all). ;)
-
format_date is 2 constant - no for 3. <--- Can't work? Have I to remove {lang_mueo_total}: <b>{mueo}</b>, then 2 members and 2 guests, without total? Is shit! ;-)
No need for remove any thing axcept for replace code I post before ...
-
Ok, we have a deal for other things too. Can you check then.
Please no offtopic.
-
hi
how change the date format
this MOD used this date
Most users ever online was:
Total: 1 on 23.01.2008, 23:47
Miembros: 1 on 23.01.2008, 23:47
Visitantes: 0 on 31.12.1969, 16:00
i like this
Most users ever online was:
Total: 1 on 23.January.2008, 23:47
Miembros: 1 on 23.January.2008, 23:47
Visitantes: 0 on 31.December.1969, 16:00
thanks
-
Hallo,
bei mir zählt der MOD nicht richtig.
Ich benutze die Version 1.7.4
Beispiel zu sehen unter http://www.fp-foto.de
Bin für Hinweise dankbar.
Viele Grüße
Suricata
-
works great! Thx a lot!!!
-
Hello could anybody tell me if this mode works also for 1.7.6 ? I feel on this forum like total ignorant , I like 4images more and more especially when i see some special websites, I'm trying to start to install most simpliest mods like Mini-TOP , some home page statistics etc , till now I did't manage to get to put on my website any of them , everytime I finish with many red errors on the upper left corner before the header , I think that I make all the time the same simple error (for you simple), but i dont know what kind of error, I use bluehost.com hosting PHP 5.2.8 - MySQL database , 1.7.6 version of 4images , http://www.dancersrecruit.com/pictures/ , can anybody help me ? I would like to install more difficult mods but now I can only dream about it -:)
Would be grateful for any help , Daniel
-
A weakness has been discovered. In your includes/sessions.php file,
find :
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
with :
$user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $row['session_user_id'], $url_show_profile) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id']);
Merry Christmas.
does this have to be done also?
4ella it worked on 1.7.7 for me...
-
No, it was for v1.7.1
-
thanks V@no !
-
Thank you!
-
can we display details members who was online?
-
what kind of details?
-
what kind of details?
i mean members was online with list!