Jump to content
MakeWebGames

(not working) Auto Multi IP Check


canibalstew

Recommended Posts

I am sure this is totally wrong but I am not so good at foreach and such. Please contribute what you can for everyones use.

 

 

<?php
include "globals.php";
/**
* Canibalstew@author 
* Canibalstew@copyright 2009
*/
$ipscan=mysql_query("SELECT COUNT(userid) AS username, lastip FROM users WHERE userid > 0 GROUP BY lastip",$c);
$ipw=mysql_fetch_array($ipscan);
while()
$id=$ipw['userid'];
foreach($id as $user)
{
$num=++;
$ip2=mysql_query("SELECT userid FROM users WHERE lastip IN ({$user1['lastip']}) AND userid!={$user1['userid']} ",$c);   	


}
$counted=count($ip2);
if($counted > 1)
{
$ip3=mysql_fetch_array($ip2);
echo("{$ip3['username']}
");
}
else
{
exit;
}
Link to comment
Share on other sites

Guest Sniko`

Re: (not working) Auto Multi IP Check

 

I am sure this is totally wrong but I am not so good at foreach and such. Please contribute what you can for everyones use.

 

 

<?php
include "globals.php";
/**
* Canibalstew@author 
* Canibalstew@copyright 2009
*/
$ipscan=mysql_query("SELECT COUNT(userid) AS username, lastip FROM users WHERE userid > 0 GROUP BY lastip",$c);
$ipw=mysql_fetch_array($ipscan);
while()
$id=$ipw['userid'];
foreach($id as $user)
{
$num=++;
$ip2=mysql_query("SELECT userid FROM users WHERE lastip IN ({$user1['lastip']}) AND userid!={$user1['userid']} ",$c);   	


}
$counted=count($ip2);
if($counted > 1)
{
$ip3=mysql_fetch_array($ip2);
echo("{$ip3['username']}
");
}
else
{
exit;
}

 

if it doesnt work - whats the error?

Link to comment
Share on other sites

Re: (not working) Auto Multi IP Check

a quick scan over it says its possibly because the while function is empty....

<?php
include "globals.php";
/**
* Canibalstew@author 
* Canibalstew@copyright 2009
*/
$ipscan=mysql_query("SELECT COUNT(userid) AS username, lastip FROM users WHERE userid > 0 GROUP BY lastip",$c);
$ipw=mysql_fetch_array($ipscan);
while()     //<---- function is empty?
$id=$ipw['userid'];
foreach($id as $user)
{
$num=++;
$ip2=mysql_query("SELECT userid FROM users WHERE lastip IN ({$user1['lastip']}) AND userid!={$user1['userid']} ",$c);   	


}
$counted=count($ip2);
if($counted > 1)
{
$ip3=mysql_fetch_array($ip2);
echo("{$ip3['username']}
");
}
else
{
exit;
}

 

if it doesnt work - whats the error?

Link to comment
Share on other sites

Re: (not working) Auto Multi IP Check

lol... ok this is an incomplete or not working script as it never worked properly eventually would be set to do same as ip search and mass ban together but time is scarce for me atm so I posted it to allow a community perspective on it and figured it could grow and become a working mod for everyone's use.

Link to comment
Share on other sites

Re: (not working) Auto Multi IP Check

Little bored right now, so just put this together:

 

<?php
/*
Coded by Danny [php Scene]
Mccode version 2.0
*/
include ('globals.php');

// Insert user_level IDs here, e.g 2 = admin.
$userlevels = array(2, 3);

// Deny file access to players, only admins and secretaries.
if(!in_array($ir['user_level'], $userlevels)){ exit('Go away.'); }

$query = mysql_query("SELECT `userid`, `username`, `lastip` FROM `users`");
echo '
<h2>Duplicate IP Checker</h2>
<table>';

while($data = mysql_fetch_object($query)){

$select_dup = mysql_query("SELECT `userid`, `username`, `lastip` FROM `users` WHERE `lastip` = '{$data->lastip}' AND `userid` != '{$data->userid}'");

if(mysql_num_rows($select_dup)){

	$dup_data = mysql_fetch_object($select_dup);

	echo '<tr>
			<td>[url="viewuser.php?u='.$dup_data->userid.'"]'.$dup_data->username.'[/url] ['.$dup_data->lastip.'] same IP as [url="viewuser.php?u='.$data->userid.'"]'.$data->username.'[/url] ['.$data->lastip.']</td>
		</tr>';
}


}
echo '</table>';

$h->endpage();
?>

 

I suppose it could be a little better optimized, yet it does the job of selecting out users with the same ip.

Link to comment
Share on other sites

  • 11 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...