1
ghia
Find relationship IP - user on NewBB/CBB
  • 2008/12/5 18:36

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 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 .
<?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."<br /><br />";
        }

        while(
$data mysql_fetch_assoc($result))
        {
            
$message_remerciement .= "Used by <a href="".XOOPS_URL."/userinfo.php?uid=".$data['uid']."" target="_blank">".XoopsUser::getUnameFromId($data['uid'])."</a> in <a href="".XOOPS_URL."/modules/newbb/viewtopic.php?viewmode=flat&topic_id=".$data['topic_id']."&forum=".$data['forum_id']."" target="_blank">this thread</a> (".date('d/m/Y - H:i:s'$data['post_time']).")<br />";
        }
//end while
        
if (mysql_num_rows($result) == 0
        {
            
$message_remerciement .= "";
        }
    }
//end if
    
else 
    {
        
$message_remerciement "You have to enter a valid IP address.";
    }
}
?>
<html>
<head>
<title>Search IP in newBB/CBB forum</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script  type="text/javascript">

function verifSelection() 
{
    if (window.document.mail_form.posterip.value == "") 
    {
        alert("Please enter an IP address! eg. 76.54.32.10");
        return false;
    } 
    return true;
} // End of function

</script>
</head>

<body>
<a href="<?=$_SERVER['PHP_SELF']?>">Search another IP address.</a>&nbsp;&nbsp;&nbsp;<a href="<?php XOOPS_ROOT_PATH ?>/index.php">Back to home.</a><br /><br />
<?php
if ($message_remerciement) {
    echo(
"<font face=Verdana size=2>");
    echo(
stripslashes($message_remerciement));
    include 
XOOPS_ROOT_PATH.'/footer.php';
    echo(
"</body></html>");
    exit();
}
?>
<form name="mail_form" method="post" action="<?=$_SERVER['PHP_SELF']?>" onsubmit="return verifSelection();">

<table border="0" align="left">
<tr>
    <td>
        <font face="Verdana" size="2">IP Address </font><input name="posterip" type="text">
        <input type="reset" name="Reset" value="Clear">          
        <input type="submit" name="envoi" value="Search">
    </td>
</tr>
</table>
</form>
<?php
include XOOPS_ROOT_PATH.'/footer.php';
?>
</body>
</html>

2
trabis
Re: Find relationship IP - user on NewBB/CBB
  • 2008/12/6 0:33

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Nice tip, thanks for sharing!

Module troubleshooting?
Is more like user troubleshooting!

3
ghia
Re: Find relationship IP - user on NewBB/CBB
  • 2008/12/6 1:52

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Quote:
Module troubleshooting?
Is more like user troubleshooting!
It is!
- it is for troubleshooting ...
- it is for module NewBB/CBB ...
So, it is for this forum ... or not?

Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Sep 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!