• Welcome to Simple Machines Community Forum. Please login or sign up.
December 06, 2021, 11:14:22 PM

News:

Follow SMF on Twitter.


SA Chat

Started by Diego Andrés, July 21, 2010, 10:36:59 PM

Previous topic - Next topic

Diego Andrés

February 11, 2020, 05:54:26 PM #1820 Last Edit: February 11, 2020, 06:05:39 PM by Diego Andrés
So don't really know what I'm doing but to my understanding I couldn't find another instance or usage of $password in the index.php so I did the following

Code (sachat/index.php) Select

//SMF Cookie autentication!!!
list ($member_id, $password) = initCookies();

Code (replace) Select

//SMF Cookie autentication!!!
$member_id = initCookies();


Code (sachat/Sources/Subs.php) Select

function initCookies() {
global $cookiename;

if (isset($_COOKIE[$cookiename]) && preg_match('~^a:[34]:\{i:0;(i:\d{1,6}|s:[1-8]:"\d{1,8}");i:1;s:(0|40):"([a-fA-F0-9]{40})?";i:2;[id]:\d{1,14};(i:3;i:\d;)?\}$~i', $_COOKIE[$cookiename]) == 1) {
list ($member_id, $password) = @unserialize($_COOKIE[$cookiename]);
$member_id = !empty($member_id) && strlen($password) > 0 ? (int) $member_id : 0;

return array($member_id, $password);
} elseif (isset($_COOKIE[$cookiename])) {
list ($member_id, $password) = @unserialize(stripslashes($_COOKIE[$cookiename]));
$member_id = !empty($member_id) && strlen($password) > 0 ? (int) $member_id : 0;

return array($member_id, $password);
}
}

Code (replace) Select
function initCookies() {
global $cookiename;

if (isset($_COOKIE[$cookiename]) && preg_match('~^a:[34]:\{i:0;(i:\d{1,6}|s:[1-8]:"\d{1,8}");i:1;s:(0|40):"([a-fA-F0-9]{40})?";i:2;[id]:\d{1,14};(i:3;i:\d;)?\}$~i', $_COOKIE[$cookiename]) == 1) {
list ($id_member, $password) = @unserialize($_COOKIE[$cookiename]);
$id_member = !empty($id_member) && strlen($password) > 0 ? (int) $id_member : 0;

return $id_member;
} elseif (isset($_COOKIE[$cookiename])) {
list ($id_member, $password, $login_span) = @unserialize($_SESSION['login_' . $cookiename]);
$id_member = !empty($id_member) && strlen($password) > 0 ? (int) $id_member : 0;

return $id_member;
}
}


And seems to be working on SMF 2.0.17

If anyone else with more knowledge about this can give the mod a look would be great and appreciated.  :laugh:




Also

Code (sachat/Sources/User.php) Select

$context['online_count'] = count(isset($context['friends']) ? $context['friends'] : null);
}
if ($type == 'list') {
$data = buddy_list_template();
return $data;
}
if ($type == 'count') {
return count(isset($context['friends']) ? $context['friends'] : null);
}

Code (replace) Select
$context['online_count'] = count(isset($context['friends']) ? $context['friends'] : []);
}
if ($type == 'list') {
$data = buddy_list_template();
return $data;
}
if ($type == 'count') {
return count(isset($context['friends']) ? $context['friends'] : []);
}

SMF Tricks - Free & Premium Responsive Themes for SMF.

aegersz

will give it a try later, thanks !
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

aegersz

There is no sachat/Sources directory so i am totally lost.


Quote from: Diego Andrés on February 11, 2020, 05:54:26 PM
So don't really know what I'm doing but to my understanding I couldn't find another instance or usage of $password in the index.php so I did the following

Code (sachat/index.php) Select

//SMF Cookie autentication!!!
list ($member_id, $password) = initCookies();

Code (replace) Select

//SMF Cookie autentication!!!
$member_id = initCookies();


Code (sachat/Sources/Subs.php) Select

function initCookies() {
global $cookiename;

if (isset($_COOKIE[$cookiename]) && preg_match('~^a:[34]:\{i:0;(i:\d{1,6}|s:[1-8]:"\d{1,8}");i:1;s:(0|40):"([a-fA-F0-9]{40})?";i:2;[id]:\d{1,14};(i:3;i:\d;)?\}$~i', $_COOKIE[$cookiename]) == 1) {
list ($member_id, $password) = @unserialize($_COOKIE[$cookiename]);
$member_id = !empty($member_id) && strlen($password) > 0 ? (int) $member_id : 0;

return array($member_id, $password);
} elseif (isset($_COOKIE[$cookiename])) {
list ($member_id, $password) = @unserialize(stripslashes($_COOKIE[$cookiename]));
$member_id = !empty($member_id) && strlen($password) > 0 ? (int) $member_id : 0;

return array($member_id, $password);
}
}

Code (replace) Select
function initCookies() {
global $cookiename;

if (isset($_COOKIE[$cookiename]) && preg_match('~^a:[34]:\{i:0;(i:\d{1,6}|s:[1-8]:"\d{1,8}");i:1;s:(0|40):"([a-fA-F0-9]{40})?";i:2;[id]:\d{1,14};(i:3;i:\d;)?\}$~i', $_COOKIE[$cookiename]) == 1) {
list ($id_member, $password) = @unserialize($_COOKIE[$cookiename]);
$id_member = !empty($id_member) && strlen($password) > 0 ? (int) $id_member : 0;

return $id_member;
} elseif (isset($_COOKIE[$cookiename])) {
list ($id_member, $password, $login_span) = @unserialize($_SESSION['login_' . $cookiename]);
$id_member = !empty($id_member) && strlen($password) > 0 ? (int) $id_member : 0;

return $id_member;
}
}


And seems to be working on SMF 2.0.17

If anyone else with more knowledge about this can give the mod a look would be great and appreciated.  :laugh:




Also

Code (sachat/Sources/User.php) Select

$context['online_count'] = count(isset($context['friends']) ? $context['friends'] : null);
}
if ($type == 'list') {
$data = buddy_list_template();
return $data;
}
if ($type == 'count') {
return count(isset($context['friends']) ? $context['friends'] : null);
}

Code (replace) Select
$context['online_count'] = count(isset($context['friends']) ? $context['friends'] : []);
}
if ($type == 'list') {
$data = buddy_list_template();
return $data;
}
if ($type == 'count') {
return count(isset($context['friends']) ? $context['friends'] : []);
}

The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Kindred

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.<br /><br />"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

aegersz

The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Diego Andrés

It's in the root directory of the forum  :o

SMF Tricks - Free & Premium Responsive Themes for SMF.

aegersz

February 11, 2020, 07:44:02 PM #1826 Last Edit: February 11, 2020, 07:56:46 PM by aegersz
Quote from: Diego Andrés on February 11, 2020, 07:38:16 PM
It's in the root directory of the forum  :o

Not on mine. I have no idea where that is other than the SMF Subs.php in Sources and User.php doesn't exist anywhere !
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Antechinus

Umm, this might be your problem. :)

Diego Andrés

I think you might not have the 1.0a1 version installed which seems to be the latest one according to the mod page  ;D
The cookie changes can be done in the functions.php file for that version that you are using, but I'd recommend using the latest one? Who knows how old the 0.1.5 version is  :o

SMF Tricks - Free & Premium Responsive Themes for SMF.

aegersz

February 13, 2020, 07:59:50 PM #1829 Last Edit: February 13, 2020, 08:19:40 PM by aegersz
I have version 0.1.5 Rev110  installed.

I installed the newest version and your changes but no luck. Looks like I'm doomed top sit on 0.15 for the interim.
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

-Rock Lee-

Quote from: aegersz on February 13, 2020, 07:59:50 PM
I have version 0.1.5 Rev110  installed.

I installed the newest version and your changes but no luck. Looks like I'm doomed top sit on 0.15 for the interim.

I downloaded the latest version of the modification to apply the changes to the installer and then install, it worked without problems with the suggested changes. That is, download version 1.0a1 Rev120 unzipped it to find the files to be edited, compressed it again to proceed to install and it worked in my test version that I am running 2.0.17.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code © 2020
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

aegersz

Quote from: aegersz on February 13, 2020, 07:59:50 PM
I have version 0.1.5 Rev110  installed.

Interestingly, the new version of SA Chat failed even before any 2.0.16 changes were applied.

I installed the newest version and your changes but no luck. Looks like I'm doomed top sit on 0.15 for the interim.
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

aegersz

February 13, 2020, 09:43:32 PM #1832 Last Edit: February 13, 2020, 10:08:41 PM by aegersz
I have other issues by the looks of it - the other version (Rev120) doesn't work on my 2.0.15 either.

Anyhow, thanks for your help.

EDIT: After all the changes, I had to remove the Live Clock mod and then it started working ! Thanks for your help.
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

kesulin

Quote from: Diego Andrés on February 11, 2020, 05:54:26 PM
So don't really know what I'm doing but to my understanding I couldn't find another instance or usage of $password in the index.php so I did the following

Code (sachat/index.php) Select

//SMF Cookie autentication!!!
list ($member_id, $password) = initCookies();

Code (replace) Select

//SMF Cookie autentication!!!
$member_id = initCookies();


Code (sachat/Sources/Subs.php) Select

function initCookies() {
global $cookiename;

if (isset($_COOKIE[$cookiename]) && preg_match('~^a:[34]:\{i:0;(i:\d{1,6}|s:[1-8]:"\d{1,8}");i:1;s:(0|40):"([a-fA-F0-9]{40})?";i:2;[id]:\d{1,14};(i:3;i:\d;)?\}$~i', $_COOKIE[$cookiename]) == 1) {
list ($member_id, $password) = @unserialize($_COOKIE[$cookiename]);
$member_id = !empty($member_id) && strlen($password) > 0 ? (int) $member_id : 0;

return array($member_id, $password);
} elseif (isset($_COOKIE[$cookiename])) {
list ($member_id, $password) = @unserialize(stripslashes($_COOKIE[$cookiename]));
$member_id = !empty($member_id) && strlen($password) > 0 ? (int) $member_id : 0;

return array($member_id, $password);
}
}

Code (replace) Select
function initCookies() {
global $cookiename;

if (isset($_COOKIE[$cookiename]) && preg_match('~^a:[34]:\{i:0;(i:\d{1,6}|s:[1-8]:"\d{1,8}");i:1;s:(0|40):"([a-fA-F0-9]{40})?";i:2;[id]:\d{1,14};(i:3;i:\d;)?\}$~i', $_COOKIE[$cookiename]) == 1) {
list ($id_member, $password) = @unserialize($_COOKIE[$cookiename]);
$id_member = !empty($id_member) && strlen($password) > 0 ? (int) $id_member : 0;

return $id_member;
} elseif (isset($_COOKIE[$cookiename])) {
list ($id_member, $password, $login_span) = @unserialize($_SESSION['login_' . $cookiename]);
$id_member = !empty($id_member) && strlen($password) > 0 ? (int) $id_member : 0;

return $id_member;
}
}


And seems to be working on SMF 2.0.17

If anyone else with more knowledge about this can give the mod a look would be great and appreciated.  :laugh:




Also

Code (sachat/Sources/User.php) Select

$context['online_count'] = count(isset($context['friends']) ? $context['friends'] : null);
}
if ($type == 'list') {
$data = buddy_list_template();
return $data;
}
if ($type == 'count') {
return count(isset($context['friends']) ? $context['friends'] : null);
}

Code (replace) Select
$context['online_count'] = count(isset($context['friends']) ? $context['friends'] : []);
}
if ($type == 'list') {
$data = buddy_list_template();
return $data;
}
if ($type == 'count') {
return count(isset($context['friends']) ? $context['friends'] : []);
}

¡works great!¡fantastic work!

thanks very much  :-*

Sir Osis of Liver

I've had this working on a forum in 2.0.15, but it disappears in .16/.17.  Can it be fixed?
"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

-Rock Lee-

Quote from: Sir Osis of Liver on February 16, 2020, 12:28:05 AM
I've had this working on a forum in 2.0.15, but it disappears in .16/.17.  Can it be fixed?

Did you try the solution I leave @Diego Andrés? I tried it and it worked!


Regards!
¡Regresando como cual Fenix! ~ Bomber Code © 2020
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Sir Osis of Liver

Finally got around to this.  Modded SA Chat code as per -

https://www.simplemachines.org/community/index.php?topic=391961.msg4046455#msg4046455

Works in 2.0.17.  Thanks.
"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

aegersz

The new version (even prior to any 2.0.16/17) does not show the correct number of online users.

Does anyone else have this problem ?

if i can get REV120 working correctly then I can't upgrade.

Can anybody help ?
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Sir Osis of Liver

Did the code edits posted above to 1.0a Rev120, upgraded 2.0.15 -> 2.0.17, and it seems to be working correctly.  Not a very busy forum, only myself and one other member active, but it's showing the one member.
"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

aegersz

in my dev system, i have 3 active online members and only one member shows the other 2.

Can you please try a third test user or something to see how if behaves ?
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Advertisement: