Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> NukeSentinel(tm)
Author Message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sat Jun 26, 2004 8:33 am Reply with quote

Telli from http://codezwiz.com writes
I switched over to Sentinel™ - Protector was starting to bog me down. I made a script to transfer the db if anyone wants it to switch from Protector to Sentinel™."
Code:
<?php

include("mainfile.php");
global $db, $prefix;

//Change to your name
$yourname = "Your_Name";

$sql = "SELECT * FROM $prefix"._blocked." ORDER BY id ASC limit 0,10000";
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
    $ip = $row['ip_from'];
    $date = $row['date'];
    $info = $row['info'];
    $banned = $row['banned'];
    if ($banned =="") { $banned = "Anonymous"; } 
    $ip_add = long2ip(-(4294967296-$ip));
 
$db->sql_query("INSERT INTO ".$prefix."_nsnst_ips VALUES ('$ip_add', '1', '$banned', 'Added by $yourname', '$date', '$info', '0', '', 'none', 'none', '$ip_add', 'unknown', 'none')");
}
?>


Last edited by Raven on Wed Dec 29, 2004 11:10 am; edited 1 time in total 
View user's profile Send private message
sharlein
Member Emeritus



Joined: Nov 19, 2002
Posts: 322
Location: On the Road

PostPosted: Sat Jun 26, 2004 11:06 am Reply with quote

Thank you very much, Raven and telli. The script works great. One thought though, could you include something to drop those _blocked tables? Very Happy

_________________
Give Me Ambiguity Or Give Me Something Else! 
View user's profile Send private message
telli
New Member
New Member



Joined: Sep 24, 2003
Posts: 21

PostPosted: Sat Jun 26, 2004 2:45 pm Reply with quote

I couldnt test it but it should work fine.

Code:
<?php

require_once("mainfile.php");
$index = 1;
//Change to your name
$yourname = "Your_Name";
 
switch($op) {

    default:
    include ("header.php");
    Opentable();
    echo "<table align='center' border='0' cellpadding='5' cellspacing='0'>\n";
    echo "<form action='".$_SERVER['PHP_SELF']."' method='post'>\n";
    echo "<tr><td>This script will not install the Sentinel&trade;. You must install that prior to running this script.</td></tr>\n";
    echo "<tr><td>This script will move your Banned IP's from the Protector to the Sentinel&trade;. There is also an option to move the IP's and remove the Protector tables.</td></tr>\n";
    echo "<tr><td><b>Please make a backup of your database before using this script. When your done DELETE it off of your server.</b></td></tr>\n";
    echo "<tr><td><select name='op'>\n";
    echo "<option value=''>Transfer Options</option>\n";
    echo "<option value='transfer'>Transfer IP's</option>\n";
    echo "<option value='transferdelete'>Transfer IP's and REMOVE Protector tables.</option>\n";
    echo "</select><input type='submit' value='Transfer'></td></tr>\n";
    echo "</form>";
    echo "</table>\n";
    CloseTable();
    include("footer.php");
    break;

case "transfer":
    include("header.php");
    global $db, $prefix, $user_prefix, $yourname;
    OpenTable();
$sql = "SELECT * FROM $prefix"._blocked." ORDER BY id ASC limit 0,10000";
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
    $ip = $row['ip_from'];
    $date = $row['date'];
    $info = $row['info'];
    $banned = $row['banned'];
    if ($banned =="") { $banned = "Anonymous"; } 
    $ip_add = long2ip(-(4294967296-$ip));
 
$db->sql_query("INSERT INTO ".$prefix."_nsnst_ips VALUES ('$ip_add', '1', '$banned', 'Added by $yourname', '$date', '$info', '0', '', 'none', 'none', '$ip_add', 'unknown', 'none')");
     echo "<br />Done!<br />";
}
    CloseTable();
    include("footer.php");
    break;


case "transferdelete":
    include("header.php");
    global $db, $prefix, $user_prefix, $yourname;
    OpenTable();
    $sql = "SELECT * FROM $prefix"._blocked." ORDER BY id ASC limit 0,10000";
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
    $ip = $row['ip_from'];
    $date = $row['date'];
    $info = $row['info'];
    $banned = $row['banned'];
    if ($banned =="") { $banned = "Anonymous"; } 
    $ip_add = long2ip(-(4294967296-$ip));
 
    $db->sql_query("INSERT INTO ".$prefix."_nsnst_ips VALUES ('$ip_add', '1', '$banned', 'Added by $yourname', '$date', '$info', '0', '', 'none', 'none', '$ip_add', 'unknown', 'none')");

    //Taken From Protector
    $db->sql_query("ALTER TABLE ".$prefix."_authors DROP radminblocker");
    $db->sql_query("ALTER TABLE ".$user_prefix."_users DROP last_seen_blocker");
    $db->sql_query("DROP TABLE ".$prefix."_blocked, ".$prefix."_blocked_hammer, ".$prefix."_blocked_iplist, ".$prefix."_blocked_notes, ".$prefix."_blocked_protected, ".$prefix."_blocked_settings, ".$prefix."_blocked_pagetracker, ".$prefix."_blocked_config, ".$prefix."_blocked_robot, ".$prefix."_blocked_promod, ".$prefix."_blocked_promodip, ".$prefix."_blocked_agent, ".$prefix."_blocked_iptoc, ".$prefix."_blocked_ref, ".$prefix."_blocked_denymod");
     echo "<br />Done!<br />";
}
    CloseTable();
    include("footer.php");
    break;
}
?>


Enjoy!

_________________
http://codezwiz.com/ 
View user's profile Send private message Visit poster's website
johnnycard
New Member
New Member



Joined: Oct 25, 2003
Posts: 19

PostPosted: Sun Jun 27, 2004 6:44 am Reply with quote

Just a quick question, sorry for sounding like Mr Thicky - what is the "Your_Name" supposed to be changed to for the variable "$yourname"?

Is this the database name, the site name, the domain name, my name, something else?

Confused Confused
 
View user's profile Send private message
johnnycard







PostPosted: Sun Jun 27, 2004 8:45 am Reply with quote

Ok, I worked it out - It should have been my name (it was pretty obvious really!)

It adds the "Added by Mr Thicky" to the db transfer when I added $yourname = "MrThicky"

Very Happy
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> NukeSentinel(tm)

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©