News:

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

Main Menu

user_info['ip'] ...

Started by alexandervba, April 11, 2011, 12:05:45 PM

Previous topic - Next topic

alexandervba

so I do

$member = $starter;

?

Arantor

Or substitute $starter into the rest of the code above...

alexandervba

This is what I tried now:

// Here we will check the accounts we validate if they have plural accounts
// Get topic starter's ip and name

loadMemberData(array($starter), false, 'normal');
loadMemberContext($starter);

$ip =  $user_profile[$starter['id']]['ip'];
$name = $user_profile[$starter['id']]['name'];

// Try to find other members on the forum who had the same ip....
$IPmemberList = '';
$dbresult = db_query("
SELECT
ID_MEMBER, realName
FROM {$db_prefix}members
WHERE memberIP = '$ip' OR memberIP2 = '$ip'", __FILE__, __LINE__);
while($memRow = mysql_fetch_assoc($dbresult))
{
$IPmemberList .= $memRow['realName'] . "\n";
}
mysql_free_result($dbresult);

// Include any IP's that match other forum members....
$memberMatches = '';
if (!empty($IPmemberList))
{
$memberMatches = $txt['ls_matched_members'] . "\n" . $IPmemberList;

// Here we create the post in leaderboards if the approved member has plural accounts

$msgOptions = array(
'id' => 0,
'subject' => 'Multiaccount Warning: ' . $name,
'body' => 'IP: ' . $ip . '[br][br]' . $memberMatches,
'icon' => 'xx',
'smileys_enabled' => 1,
'attachments' => array(),
'description' => '',
);
$topicOptions = array(
'id' => 0,
'board' => 2.0,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => 1997,
'update_post_count' => 1,
);
   
require_once($sourcedir . '/Subs-Post.php');
createPost($msgOptions, $topicOptions, $posterOptions);
}


But I still get this error:

8: Undefined index: 2
File: /home/foerscom/public_html/forums/Sources/Display.php
Line: 1384

8: Undefined index: 2
File: /home/foerscom/public_html/forums/Sources/Display.php
Line: 1385


Im pretty sure that the "2" stands for my member ID, but its not supposed to be mine...

Here is the entire function btw, so you can see where I am getting $starter...

function ApproveApplication()
{
   global $db_prefix, $topic, $context, $sourcedir, $user_profile;

   if (empty($topic))
      fatal_lang_error(472, false);

   isAllowedTo('admin_forum');

   checkSession('get');

   global $txt;
   $request = db_query("
      SELECT t.ID_MEMBER_STARTED, t.ID_BOARD, m.subject
      FROM {$db_prefix}topics AS t
         INNER JOIN {$db_prefix}messages AS m ON (m.ID_MSG = t.ID_FIRST_MSG)
      WHERE t.ID_TOPIC = $topic
      LIMIT 1", __FILE__, __LINE__);
   list ($starter, $board, $subject) = mysql_fetch_row($request);
   mysql_free_result($request);

   if (empty($starter))
      fatal_lang_error(472, false);

   require_once('Subs-Members.php');
   addMembersToGroup($starter, 32, 'force_primary');

   $msgOptions = array(
      'id' => 0,
      'subject' => addslashes($txt['response_prefix'] . $subject),
      'body' => '[center][color=red]Thanks for Applying to Final Ownage Elite.[/color][/Center]
 
[b]Your application has now been approved!
You should complete following steps to complete your application:[/b]

[b]1.[/b] Insert your IRC nickname [url=http://www.foe-rs.com/forums/index.php?action=profile;sa=forumProfile]into your profile[/url] in the correct field.
    => Please ensure that your IRC nick exactly matches your nickname you use on IRC and is [b]registered[/b]!
[b]2.[/b] Join "[color=red][b]#Foe_Pk[/b][/color]" to check if you are allowed to get in (refer to the [url=http://www.foe-rs.com/forums/index.php?topic=8812.0]Application Process[/url] for help).
[b]3.[/b] Join and add "[color=red][b]Foe Channel[/b][/color]" clanchat to check if you have the friends icon in the clanchat, if not pm an [color=red]Operator[/color] in IRC.

If you need help with IRC, make sure to read [url=http://www.foe-rs.com/forums/index.php?topic=2289.0]Foe IRC & Teamspeak Support[/url] first.

If you have any other questions, feel free to reply to your application or pm a [color=orange]Halfop[/color] or [color=red]Operator[/color] in IRC.',
      'icon' => 'xx',
      'smileys_enabled' => 1,
      'attachments' => array(),
      'description' => '',
   );
   $topicOptions = array(
      'id' => $topic,
      'board' => $board,
      'mark_as_read' => true,
   );
   $posterOptions = array(
      'id' => $context['user']['id'],
      'update_post_count' => 1,
   );

   require_once($sourcedir . '/Subs-Post.php');
   createPost($msgOptions, $topicOptions, $posterOptions);
   
   $pmfrom = array(
   'id' => $context['user']['id'],
   'name' => $context['user']['username'],
   'username' => 'Admin'
);
$pmto = array(
'to' => array($starter),
'bcc' => array()
);

require_once($sourcedir . '/Subs-Post.php');
sendpm($pmto, 'Your Application Has Been Approved!', '[center][color=red]Thanks for Applying to Final Ownage Elite.[/color][/Center]
 
[b]Your application has now been approved![/b]

Please read the approval reply on your application carefully.
Before we can accept your application, you must complete it first!

If you need help with IRC or teamspeak, make sure to read [url=http://www.foe-rs.com/forums/index.php?topic=2289.0]Foe IRC & Teamspeak Support[/url] first.

If you have any other questions, feel free to reply to your application or pm a [color=orange]Halfop[/color] or [color=red]Operator[/color] in IRC.', 0, $pmfrom);


// Here we will check the accounts we validate if they have plural accounts
// Get topic starter's ip and name

loadMemberData(array($starter), false, 'normal');
loadMemberContext($starter);

$ip =  $user_profile[$starter['id']]['ip'];
$name = $user_profile[$starter['id']]['name'];

// Try to find other members on the forum who had the same ip....
$IPmemberList = '';
$dbresult = db_query("
SELECT
ID_MEMBER, realName
FROM {$db_prefix}members
WHERE memberIP = '$ip' OR memberIP2 = '$ip'", __FILE__, __LINE__);
while($memRow = mysql_fetch_assoc($dbresult))
{
$IPmemberList .= $memRow['realName'] . "\n";
}
mysql_free_result($dbresult);

// Include any IP's that match other forum members....
$memberMatches = '';
if (!empty($IPmemberList))
{
$memberMatches = $txt['ls_matched_members'] . "\n" . $IPmemberList;

// Here we create the post in leaderboards if the approved member has plural accounts

$msgOptions = array(
'id' => 0,
'subject' => 'Multiaccount Warning: ' . $name,
'body' => 'IP: ' . $ip . '[br][br]' . $memberMatches,
'icon' => 'xx',
'smileys_enabled' => 1,
'attachments' => array(),
'description' => '',
);
$topicOptions = array(
'id' => 0,
'board' => 2.0,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => 1997,
'update_post_count' => 1,
);
   
require_once($sourcedir . '/Subs-Post.php');
createPost($msgOptions, $topicOptions, $posterOptions);
}

redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
}

texasman1979

What is starter exactly, array? Name its elements. Single value? What is it sposed to have in it?
SMF 2.0.4
SimplePortal 2.3.5

LOGIC is a FOUR letter word! :)


Arantor

You need to just pass the user id itself to loadMemberData, i.e. $starter['id'].

alexandervba

The way I call this function is by pressing a custom made Moderation button inside a topic. When I press the button "approve application", the rank of $starter (the person who started the topic) is changed to membergroup 32:

   if (empty($starter))
      fatal_lang_error(472, false);

   require_once('Subs-Members.php');
   addMembersToGroup($starter, 32, 'force_primary');


Also a reply is made and a pm is sent to this person, as you can see in the function in my post above.

Now I want to add a part in the function to check for multiaccounters...

alexandervba


alexandervba


butchs

You will need to look up the ip in the members database.  For SMF 2.x it iwll be something like this:

$ip_to_lookup;  //  this is what you want ot find

$qresult = $smcFunc['db_query']('', '
SELECT
id_group, member_ip, member_ip2, is_activated
FROM {db_prefix}members
WHERE member_ip = {string:ipofuser}
OR member_ip2 = {string:ipofuser}',
array(
'ipofuser' => $ip_to_lookup,
)
);
if ($smcFunc['db_num_rows']($qresult) > 0) {
while ($row = $smcFunc['db_fetch_assoc']($qresult)) {
//  here is where you will handle the result.   If you have data here this is possibly a duplicated member.  Problem is that ips change every 24 hours so I would suggst other checks and balances
} }
$smcFunc['db_free_result']($qresult);

I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

alexandervba

O.o

too bad im running 1.1.13 and i have no idea how queries like that work =/

thx for ur help anyways!

Advertisement: