1
Inspired by a
post on XOOPSfr.org where a utility was proposed to find the posts in newbbex done from the same IP address in order to detect eg users with multiple aliases, I adapted it for use with Newbb/CBB and the English language. Save next code in a php file at /modules/newbb/ with a name of your choice, eg. searchip.php .
include '../../mainfile.php'; // placement in modules/newbb
include XOOPS_ROOT_PATH.'/header.php';
global $xoopsDB, $xoopsConfig;
if (is_object($xoopsUser))
{
$groupsok = $xoopsUser->getGroups();
}
else
{
$groupsok=99;
}
if (!in_array("1", $groupsok)) //if member of webmasters group - Adapt to allow other groups
{
redirect_header(XOOPS_ROOT_PATH."/index.php",5, "You have insufficient rights to view this page.");
exit();
}
$message_remerciement = "";
if (!empty($_POST['envoi']))
{
$posterip = $_POST['posterip'];
$nposterip = ip2long($posterip);
if (($nposterip != -1) && ($nposterip != FALSE))
{
$sql = "select * from `".$xoopsDB->prefix("bb_posts")."` where `poster_ip` = ".$nposterip." ORDER BY `".$xoopsDB->prefix("bb_posts")."`.`post_time` ASC;";
$result = $xoopsDB->query($sql);
if (mysql_num_rows($result) == 0)
{
$message_remerciement = "No posts found with IP address :".$posterip.".";
}
else
{
$message_remerciement = "Found IP address : ".$posterip."
";
}
while($data = mysql_fetch_assoc($result))
{
$message_remerciement .= "Used by /userinfo.php?uid=".$data['uid']."" target="_blank">".XoopsUser::getUnameFromId($data['uid'])." in /modules/newbb/viewtopic.php?viewmode=flat&topic_id=".$data['topic_id']."&forum=".$data['forum_id']."" target="_blank">this thread (".date('d/m/Y - H:i:s', $data['post_time']).")
";
}//end while
if (mysql_num_rows($result) == 0)
{
$message_remerciement .= "";
}
}//end if
else
{
$message_remerciement = "You have to enter a valid IP address.";
}
}
?>
Search IP in newBB/CBB forum
=$_SERVER['PHP_SELF']?>">Search another IP address. /index.php">Back to home.
if ($message_remerciement) {
echo("");
echo(stripslashes($message_remerciement));
include XOOPS_ROOT_PATH.'/footer.php';
echo("");
exit();
}
?>
include XOOPS_ROOT_PATH.'/footer.php';
?>