News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Error: 8: Undefined index: allowedips

Started by alexandervba, April 11, 2011, 09:39:11 AM

Previous topic - Next topic

alexandervba

Gotta reopen this, Im getting another similar error... :(

8: Undefined index: allowedips
File: /home/foerscom/public_html/forums/Themes/default/Profile.template.php
Line: 1454


This is part of profile.template.php:

// Login Security Mod
if ($modSettings['ls_allow_ip_security'])
{
global $user_info;

echo '<tr>
<td><b>', $txt['ls_ip_address_protection'], ':</b></td>
<td>'
,$txt['ls_current_ip_address'],$user_info['ip'],'<br />
<br />
<input type="text" name="allowedips" size="30" value="', $context['member']['allowedips'], '" />
<br /><span class="smalltext">',$txt['ls_ip_address_protection_note'],'</span>
</td>
</tr>';
}


Line 1454 is <input type="text" name="allowedips" size="30" value="', $context['member']['allowedips'], '" />

What should I do to fix this?

Kays

Hi, that code seems to belong to a security/IP related mod. Do you know which one? if not please post a list of your installed mods.

Can you also please attach Profile.php to a post?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods


Kays

I can make a suggestion to get rid of the error. But something isn't working properly as you shouldn't be getting that error in the first place. Unless the user has a blank IP address. You should be able to see that in the error message.

Parse the mod for your version SMF and verify that the changes to Profile.template.php are there. If you have a custom theme and it has a Profile.template.php then it needs to have those changes also.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods


Kays

If you change that code to the following, It will take care of the error.


// Login Security
$allowedips = !empty($_REQUEST['allowedips']) ? $_REQUEST['allowedips'] : 0;
if ($modSettings['ls_allow_ip_security'] && !empty($allowedips))
{
global $sourcedir;
require_once($sourcedir . '/Subs-LoginSecurity.php');
UpdateAllowedIPs($memID, $allowedips);
}


However, I do suspect that the mod is not functioning correctly since $_REQUEST['allowedips'] should be set since the code to do so is there. What is the ?action in the url in the error messages.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

alexandervba

The change u made is that similar to this:

if (isset($_REQUEST['allowedips']))
$allowedips = $_REQUEST['allowedips'];


I checked the mod and i parsed it in SMF 2 RC5 just to check it out, and it looks like he made a similar change to the mod than u made. So maybe that what you did, is the actual fix?

thx

Kays

Yes, basically. I also did make a change to line 606 so it uses $allowedips instead of $_REQUEST['allowedips']

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

alexandervba

Gotta reopen this, Im getting another similar error... :(

8: Undefined index: allowedips
File: /home/foerscom/public_html/forums/Themes/default/Profile.template.php
Line: 1454


This is part of profile.template.php:

// Login Security Mod
if ($modSettings['ls_allow_ip_security'])
{
global $user_info;

echo '<tr>
<td><b>', $txt['ls_ip_address_protection'], ':</b></td>
<td>'
,$txt['ls_current_ip_address'],$user_info['ip'],'<br />
<br />
<input type="text" name="allowedips" size="30" value="', $context['member']['allowedips'], '" />
<br /><span class="smalltext">',$txt['ls_ip_address_protection_note'],'</span>
</td>
</tr>';
}


Line 1454 is <input type="text" name="allowedips" size="30" value="', $context['member']['allowedips'], '" />

What should I do to fix this?

Kays

Try replacing that with:


<input type="text" name="allowedips" size="30" value="', empty($context['member']['allowedips']) ? 0 : $context['member']['allowedips'], '" />

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

alexandervba


Advertisement: