|
|
| Author |
Message |
jimbean223
New User
Joined: 10 Sep 2009
Posts: 7
|
Posted: February 12th 2010, 1:53 pm Post subject: IP search in phpmyadmin |
|
|
Hi,
Could someone please kindly advise me how I can do searches using SQL queries for specific ips?
I've tried this...
SELECT * FROM phpbb_banlist WHERE ban_ip LIKE '%82.23.11.44%'
And it did not really help. even searching less numbers also did not help.
I think I might have an error in the line.
Thank you in advance |
|
| Back to top |
|
 |
Wicher
Experienced User

Joined: 23 Apr 2003
Posts: 443
Location: Netherlands or Holland, your choice..
|
Posted: February 12th 2010, 4:28 pm Post subject: |
|
|
ip's are not saved in the database like 82.23.11.44
They are saved with md5 and are saved like 537cd5fd
You should use the phpbb function decode_ip to get the real ip back from the database. _________________ My little mods | Statistics Mod 4.x.x (revision of 2.1.5) | My hacks at phpbbhacks |
|
| Back to top |
|
 |
jimbean223
New User
Joined: 10 Sep 2009
Posts: 7
|
Posted: February 12th 2010, 6:20 pm Post subject: |
|
|
| Wicher wrote:
|
ip's are not saved in the database like 82.23.11.44
They are saved with md5 and are saved like 537cd5fd
You should use the phpbb function decode_ip to get the real ip back from the database.
|
How do I do that?
(sorry not really good with this) |
|
| Back to top |
|
 |
Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 17279
Location: Harbinger, NC, U.S.A.
|
|
| Back to top |
|
 |
jimbean223
New User
Joined: 10 Sep 2009
Posts: 7
|
Posted: February 13th 2010, 8:44 am Post subject: |
|
|
| Patrick wrote:
|
Hey jimbean223,
Thanks for posting. I'm not sure what you are wanting to do exactly, but if you are trying to find if users (and what users) are using a given IP address, you might want to take a look at IP Search: http://www.phpbbhacks.com/download/1812
Thanks,
Patrick
|
Hiya,
Well, I have a member saying he is banned.
I've looked everywhere his IP seems to be banned despite it not being in the IP ban list (i've checked email and username also)
I wanted to be able to go into the SQL data base and run an IP search.
Can this not be done like searching of email addresses can? |
|
| Back to top |
|
 |
Wicher
Experienced User

Joined: 23 Apr 2003
Posts: 443
Location: Netherlands or Holland, your choice..
|
Posted: February 13th 2010, 3:00 pm Post subject: |
|
|
Select and copy below code and save it as admin_searching_ip.php in your phpbb admin folder.
Then go to the Users section in your admin panel and click on Search banlist.
You will be able to view all content in the banlist table, including a decoded ip plus the coded one.
You will also be able to remove the ban from the banlist table from the new page.
| Code:
|
<?php
/***************************************************************************
* admin_searching_ip.php
* -------------------
* begin : Tuesday, Feb 13, 2010
* copyright : Wicher
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['Users']['Search banlist'] = $filename;
return;
}
// Include required files, get $phpEx and check permissions
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
if ( !$userdata['session_logged_in'] )
{
redirect(append_sid("login.$phpEx?redirect=searching_ip.$phpEx", true));
}
if ( !$userdata['user_level'] == ADMIN)
{
redirect(append_sid("index.$phpEx", true));
}
if (isset($HTTP_GET_VARS['mode']) && htmlspecialchars($HTTP_GET_VARS['mode']) == 'delete')
{
$sql = "DELETE FROM " . BANLIST_TABLE . " WHERE ban_id = " . intval($HTTP_GET_VARS['id']);
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete ban', '', __LINE__, __FILE__, $sql);
}
}
echo '<h3>You are looking at the content of the banlist table</h3><br /><br />';
echo '<table border="2" bgcolor="#ffffff"><tr><td>ban_id</td><td>ban_userid</td><td>ban_ip</td><td>ban_email</td><td> </td></tr>';
// start
$sql = "SELECT * FROM " . BANLIST_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not ips', '', __LINE__, __FILE__, $sql);
}
do
{
if (!empty($ips_row['ban_ip']))
{
$decoded_ip = decode_ip($ips_row['ban_ip']);
}
else {$decoded_ip = '';}
echo '<tr><td>'.$ips_row['ban_id'].' </td><td>'.$ips_row['ban_userid'].' </td><td>MD5: '.$ips_row['ban_ip'].'<br />Decoded: '.$decoded_ip.' </td><td>'.$ips_row['ban_email'].' </td><td><a href="admin_searching_ip.php?mode=delete&id='.$ips_row['ban_id'].'">Remove</a></td></tr>';
}
while ($ips_row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
echo '</table>';
include('./page_footer_admin.'.$phpEx);
?>
|
_________________ My little mods | Statistics Mod 4.x.x (revision of 2.1.5) | My hacks at phpbbhacks |
|
| Back to top |
|
 |
Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 17279
Location: Harbinger, NC, U.S.A.
|
|
| Back to top |
|
 |
Wicher
Experienced User

Joined: 23 Apr 2003
Posts: 443
Location: Netherlands or Holland, your choice..
|
|
| Back to top |
|
 |
Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 17279
Location: Harbinger, NC, U.S.A.
|
|
| Back to top |
|
 |
|