PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

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

Telli from
Only registered users can see links on this board!
Get registered or login to the forums!
writes
I switched over to Sentinel(tm) - 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(tm)."
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 Visit poster's website AIM Address Yahoo Messenger
sharlein
Member Emeritus


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

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

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
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 Back to top

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!
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 Back to top

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
New Member
New Member


Joined: Oct 25, 2003
Posts: 19

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

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
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum