News:

Wondering if this will always be free?  See why free is better.

Main Menu

Unidentified Index Error Help

Started by FrizzleFried, July 14, 2014, 09:37:28 PM

Previous topic - Next topic

FrizzleFried

I am getting a TON of these errors:


http://www.xxx.com/index.php?action=profile&sa=forumProfile&u=
8: Undefined index: member
File: /home2/ahaforum/public_html/Sources/Mtamip.php
Line: 50

8: Undefined index: member
Apply Filter: Only show the errors from this file
File: /home2/ahaforum/public_html/Sources/Mtamip.php
Line: 51

Those two right after one another... up to about 64,000 of them since June evidently.   Any idea where I can look?


Sir Osis of Liver

It's to do with a mod you have installed.  Post a list of your mods.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Why not just cut to the chase and look directly at Mtamip.php where the error is coming from?

FrizzleFried

Lines 50 and 51:

31: // <![CDATA[
32: var mtamip = jQuery.noConflict();
33: mtamip(function(){
34: mtamip(\'#tab-container\').easytabs();
35: });
36: // ]]>
37:  </script>';
38:  }
39: }
40:
41: function Mtamip_menu_buttons()
42: {
43: global $context, $modSettings, $settings, $boardurl, $txt, $scripturl;
44:
45:  $action = !empty($context['current_action']) ? (string) $context['current_action'] : '';
46: $area = !empty($_REQUEST['area']) ? (string)$_REQUEST['area'] : '';
47:
48: if (!empty($modSettings['mtaimp_limit']) && ($area == "summary" || empty($area)) && $action == "profile")
49: {
50: MyTopicsAndMessagesInProfile_Topics($context['member']['id']);
51: MyTopicsAndMessagesInProfile_Messages($context['member']['id']);
52: }
53:
54: }
55:
56: function Mtamip_buffer($buffer)
57: {
58: global $forum_copyright, $context, $sourcedir;
59:
60: require_once($sourcedir . '/QueryString.php');
61: ob_sessrewrite($buffer);
62:
63: if (empty($context['deletforum']))
64: {
65: $context['deletforum'] = base64_decode('IHwgPGEgc3R5bGU9ImZvbnQtc2l6ZToxMHB4OyIgaHJlZj0iaHR0cDovL3d3dy5zbWZzaW1wbGUuY29tIiB0aXRsZT0iVG9kbyBwYXJhIHR1IGZvcm8gU01GIj5Nb2RzIGJ5IFNNRlNpbXBsZS5jb208L2E+');
66: $buffer = str_replace($forum_copyright, $forum_copyright.$context['deletforum'],$buffer);
67: }
68: return $buffer;
69: }
70:
71: function MyTopicsAndMessagesInProfile_Topics($memID)


Does that help?

Sir Osis of Liver

Not sure, but don't think that's a valid index.  You can try $context['user']['id'], or maybe $user_info['id'] (you'll have to globalize it).

Just tested it, it's ng.  Either of the above should work.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

FrizzleFried

That seemed to work.  Thank you.

:)

Arantor

I'd be skeptical to be honest.

$context['user']['id'] and $context['member']['id'] are different things. The first one is the current user's id. The second will be the user id of the account being looked at in the profile area (which is where the whole 'action' being 'profile' comes in)

I'd be very wary of whatever behaviour is being invoked here looking at the wrong user account.

Sir Osis of Liver

#7
Hard to tell from the code bit what exactly it's supposed to do, but I see your point.  If $context['member']['id'] is valid, why is it causing an error?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

That's just it, I have no idea what it's supposed to do... I don't recognise the mod in question.

As for why it's not valid in this case, that's interesting but possibly related to the fact that ;u is specified but empty in the URL which could confuse it.

Kindred

UGH!    and it's one of THJOSE mods that SMF Simple forces a copyright into the buffer using base64 decode.

UNCOOL in the extreme.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sir Osis of Liver

OTH, since the problem wasn't that the mod isn't working, it's just logging errors, you could comment out the two lines, or stick if (isset($context['member']['id'])) in front of them.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

FrizzleFried

Quote from: Krash on July 16, 2014, 11:22:05 PM
OTH, since the problem wasn't that the mod isn't working, it's just logging errors, you could comment out the two lines, or stick if (isset($context['member']['id'])) in front of them.

Since it only happens to GUEST it's not a big deal since my forum is PRIVATE and guests have zero access.

:)

Would it be better if I go back and comment it out or just leave it as "user" since the errors did go away?

Sir Osis of Liver

It happens to guests because $context['member']['id'] is undefined for guests, they don't hve a member id.  This should allow the code to do what it's supposed to do (whatever that is), and eliminate the guest errors -



if (!empty($modSettings['mtaimp_limit']) && ($area == "summary" || empty($area)) && $action == "profile")
{

if (isset($context['member']['id']))
{
MyTopicsAndMessagesInProfile_Topics($context['member']['id']);
MyTopicsAndMessagesInProfile_Messages($context['member']['id']);
}

}



Careful with the brackets.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Why not more simply:

if (!empty($modSettings['mtaimp_limit']) && ($area == "summary" || empty($area)) && $action == "profile" && !empty($context['member']['id']))
{

MyTopicsAndMessagesInProfile_Topics($context['member']['id']);
MyTopicsAndMessagesInProfile_Messages($context['member']['id']);

}


Technically, you're only half right. It only happens when 1) it's a guest and 2) it's a guest trying to view a profile of themselves. That's the circumstance where $context['member']['id'] will be undefined.

This is a bug in the mod that the mod author should remedy.

Sir Osis of Liver

It's more obvious (to me, anyway) what the edit does.

Quote from: ‽ on July 17, 2014, 03:02:27 PM
Technically, you're only half right. It only happens when 1) it's a guest and 2) it's a guest trying to view a profile of themselves. That's the circumstance where $context['member']['id'] will be undefined.

Yes, but how often would that happen, unless it's bots doing it?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

It shouldn't generally happen. There's normally no reason for a bot to go to action=profile where u= empty.

Sir Osis of Liver

Well then, a guest can't go to profile (they don't see the button), so something else must have caused 64,000 errors.  In any event, the edit should fix it.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

FrizzleFried

Quote from: ‽ on July 17, 2014, 03:02:27 PM
Why not more simply:

if (!empty($modSettings['mtaimp_limit']) && ($area == "summary" || empty($area)) && $action == "profile" && !empty($context['member']['id']))
{

MyTopicsAndMessagesInProfile_Topics($context['member']['id']);
MyTopicsAndMessagesInProfile_Messages($context['member']['id']);

}


Technically, you're only half right. It only happens when 1) it's a guest and 2) it's a guest trying to view a profile of themselves. That's the circumstance where $context['member']['id'] will be undefined.

This is a bug in the mod that the mod author should remedy.

Guests have zero access... so I am not sure how they can try to view their profile since they can't get past the login screen?

Kindred

anyone can hit any url they want by typing it in directly....

I can trigger the error by goig to your site at the URL mentioned... whether I *SEE* anything or not, the system has to at leats load the variables for the page before it can know that I was not permitted to view it.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

Where, exactly, is this mod being triggered? Because the main code flow through profile will negate guests calling their own profile... is it to do with a menu or something?

Advertisement: