News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

delete ip-addresses / cronjob

Started by meischta, August 17, 2010, 12:35:50 PM

Previous topic - Next topic

meischta

hey guys!

i want to delete the ip-addresses which are stored in the mysql-database from smf2, with the exception of register-new-users-ip-logging.

I've found the following:
nopaste.info/293d401a69_nl.html

But I guess this one is only working for smf1, right?
Hope anybody can help me :)

I do not want to edit the php-stuff in smf2, so I choose this way!

Greetz and keep up the good work!


Quote<?php
/*
##########################################################################
                            HIER DIE DATEN EINTRAGEN
##########################################################################
*/
$dbserver="";      //standart "localhost"
$dbuser="";        //der Benutzername für die Datenbank
$dbpw="";          //das Passwort für den Benutzer
$dbname="";        //der name der Datenbank (entspricht manchmal dem Benutzernamen)
$prefix="";        //der Tabellenpräfix den das installierte SMF benutzt (Standart "smf")
$meintext="";      //der Text der eingefügt werden soll (am besten "127.0.0.1", da einige Tables eine bestimmte Formatierung haben)
/*
##########################################################################
##########################################################################
##########################################################################
                            AB HIER NICHTS ÄNDERN!
##########################################################################
##########################################################################
##########################################################################
*/
$con = mysql_connect("$dbserver","$dbuser","$dbpw");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("$dbname");
mysql_query("UPDATE ".$prefix."_members SET memberIP = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_members SET memberIP2 = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_log_actions SET ip = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_log_banned SET ip = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_log_floodcontrol SET ip = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_log_online SET ip = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_log_errors SET ip = '".$meintext."';");
mysql_close($con);
//echo "Conjob executed!";

/*
Please don`t modify the copyright - it`s just a comment - no output!
##########################################################################
                            SMF IP Delete Cronjob made by Sph1nX
##########################################################################
*/
?>

Kays

Hi, sorry for the slow response.

I don't know why you'd want to do this but...

Changing the following lines:


mysql_query("UPDATE ".$prefix."_members SET memberIP = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_members SET memberIP2 = '".$meintext."';");


to:


mysql_query("UPDATE ".$prefix."_members SET member_ip = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_members SET member_ip2 = '".$meintext."';");


Should get it to work for 2.0. Provided you fill in the database info at the top first.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

meischta

So, my solution for the complete deletion of all ip-addresses in simple machines forum 2 is:

<?php
/*
##########################################################################
                            HIER DIE DATEN EINTRAGEN
##########################################################################
*/
$dbserver="localhost";      //standart "localhost"
$dbuser="";        //der Benutzername für die Datenbank
$dbpw="";          //das Passwort für den Benutzer
$dbname="";        //der name der Datenbank (entspricht manchmal dem Benutzernamen)
$prefix="";        //der Tabellenpräfix den das installierte SMF benutzt (Standart "smf")
$meintext="127.0.0.1";      //der Text der eingefügt werden soll (am besten "127.0.0.1", da einige Tables eine bestimmte Formatierung haben)
/*
##########################################################################
##########################################################################
##########################################################################
                            AB HIER NICHTS ÄNDERN!
##########################################################################
##########################################################################
##########################################################################
*/
$con mysql_connect("$dbserver","$dbuser","$dbpw");
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }
mysql_select_db("$dbname");
mysql_query("UPDATE ".$prefix."_members SET member_ip = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_members SET member_ip2 = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_log_actions SET ip = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_log_banned SET ip = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_log_floodcontrol SET ip = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_log_online SET ip = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_log_errors SET ip = '".$meintext."';");
mysql_query("UPDATE ".$prefix."_messages SET poster_ip = '".$meintext."';");
mysql_close($con);
//echo "Conjob executed!";

/*
Please don`t modify the copyright - it`s just a comment - no output!
##########################################################################
                            SMF IP Delete Cronjob made by Sph1nX
##########################################################################
*/


Works great as simple cronjob!

Oya

why make it a cronjob, why not do it once then just override all ip addresses in querystring.php with the new ip address so it only ever records 127.0.0.1 thereafter?

(also note this limits your ability to ban, too)

Aleksi "Lex" Kilpinen

Quote from: meischta on October 29, 2010, 07:04:21 AM
Works great as simple cronjob!
I take it this is solved then ;)

If I'm wrong, feel free to mark the topic not solved and let us know :)
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Advertisement: