I use mod httpbl by snoopy virtual
He is not supporting this mod and has moved on, so I need to convert a bit of code he gave me for SMF 1 into SMF 2 code
Snoopy gave me a bit of custom code he wrote that deletes guest only from the http bl log file - log_httpBL
That will leave forum members only in the log file and delete all guest
This worked great in SMF 1 , but I have since upgraded to SMF 2 and want this feature back
The button code he gave me works fine. It adds a button when you are viewing the http bl log
The code that runs when the button is pressed would be different for SMF 2 but I am not familiar with how to alter that
I know where to insert the code in the httpbl_config.php file
I just need some PHP translation help
Here's is the code he gave me for SMF 1
// 'Remove Guests' (EL34) button was pressed.
else if (!empty($_POST['removeGuests']))
db_query("
DELETE FROM {$db_prefix}log_httpBL
WHERE username = 'Guest'", __FILE__, __LINE__);
SMF 2 delete code looks a bit different to me
Here's a SMF 2 code sample that deletes everything in the httpbl log
// 'Clear this log' button was pressed.
else if (!empty($_POST['clearThisLog']))
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}log_httpBL
WHERE ' . $query_where,
array(
)
);
How would the SMF 1 code shown above be written for SMF2?
All it has to do is delete all username of guest
thanks
// 'Remove Guests' (EL34) button was pressed.
else if (!empty($_POST['removeGuests']))
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}log_httpBL
WHERE username = {string:guest}',
array(
'guest' => 'Guest',
)
);
should do the trick for the first block.
Thank you for the code and the super fast reply
I'll go insert it and report back
Thank you, the code worked but I had to change something to get it to work
Apparently the username was set to guest in the log-httpbl table in SMF 1
In SMF 2 the username is just blank if they are guest
So I changed the guest string comparison to blank and now it works
Thanks for your help
else if (!empty($_POST['removeGuests']))
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}log_httpBL
WHERE username = {string:guest}',
array(
'guest' => '',
)
);
Looks good :)