Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > BT.Manager (phpMyBitTorrent) > Mods & Themes
Reply
  #1  
Old 3rd May 2009, 14:30
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default [PMBT 2.x]automated User purging
This is a update to the release By Revan for PMBT 1.X
This well delete inactive users from your site in 2 stages

First stage it well check users to see who has not been in for a set
period of time it well mark there account warned for inactivity and send them a E-mail notice telling them that they have not been active and that they have a set amount of time in which to return to the site in order not to be removed.

Second it well check to see who has been set inactive read the date set as inactive if the user has not returned in such time it well remove the account from both forum and tracker.

I had to do a lot of clean up on this as when I first tested Revans
release it would always send out a notice to new user on sign up confirmation which was not very good.
then I noticed that the notices where empty of the e-mail body so I had to fix this to
I also noted that the query's used to mark accounts as active and inactive would be ran for every user wich would cause a very high load on the data base so I had to move them in the code so
that it would only run one time for every page load.

I am going to make a admin page to allow you to set your warning dates and delete dates and so that you can turn it on and off with out
going threw data base.

so here it is let me know what you think

first is the sql you well need
this one is the configs of your prune system set it to what you want
Code:
CREATE TABLE IF NOT EXISTS `torrent_userautodel` (
  `inactwarning_time` int(10) NOT NULL default '0',
  `autodel_users_time` int(10) NOT NULL default '0',
  `autodel_users` enum('true','false') NOT NULL default 'true'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `torrent_userautodel` (`inactwarning_time`, `autodel_users_time`, `autodel_users`) VALUES
(30, 10, 'false');
ALTER TABLE `torrent_users` ADD `inactwarning` TINYINT( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `torrent_users` ADD `inactive_warn_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
Now open include/config.php
then below this

Code:
if (!$row = $db->sql_fetchrow($configquery)) die("phpMyBitTorrent not correctly installed! Ensure you have run setup.php or config_default.sql!!");
add:

Code:
$sql = "SELECT * FROM ".$db_prefix."_userautodel LIMIT 1;";

$userautodel = $db->sql_query($sql,BEGIN_TRANSACTION);

if (!$userautodel) die("Configuration not found! Make sure you have installed phpMyBitTorrent correctly.");
if (!$row3 = $db->sql_fetchrow($userautodel)) die("phpMyBitTorrent not correctly installed! Ensure you have run setup.php or config_default.sql!!");
and below

Code:
$version = $row["version"];
add

Code:
$inactwarning_time = $row3["inactwarning_time"]*86400;
$autodel_users_time = $row3["autodel_users_time"]*86400;
$autodel_users = ($row3["autodel_users"] == "true") ? true : false;
Now here is the Cleanup.php parts you need
first find
Code:
        $db->sql_query("UPDATE ".$db_prefix."_torrents SET visible = 'no' WHERE type != 'link' AND tot_peer <= '".$down_limit."' AND UNIX_TIMESTAMP(last_action) < UNIX_TIMESTAMP(NOW()) - ".intval($dead_torrent_interval)." AND evidence != 1 AND (TRACKER IS NULL OR ".intval($autoscrape).");");
        $db->sql_query("UPDATE ".$db_prefix."_torrents SET visible = 'yes' WHERE tot_peer > '".$down_limit."';");
And add after
[code]#prune users
if ($autodel_users)
{
$userwarninactivesub = Array();
$userwarninactivesub[english] = "".$sitename." Warning";
$userwarninactivesub[german] = "".$sitename." Achtung";
$userwarninactivesub[spanish] = "Advertencia ".$sitename."";
$userwarninactivesub[brazilian] = "".$sitename." adverte";
$userwarninactivesub[portuguese] = "".$sitename." adverte";

$userwarninactivetext = Array();

$warntexten1 = "Hi,
we would like to warn you that you have not been active on **siteurl** for more than **inactwarning_time** days,
if you do not want to have your account deleted please login to it.
";
if ($autodel_users_time != 0)
{
$warntexten2 = "You have **autodel_users_time** days to log in from now.
Otherwise we will delete your account permanently.";
}
else $warntexten2 = "";
$warntexten3 = "
Thanks **sitename** Admin
**siteurl**";
$userwarninactivetext[english] = "".$warntexten1.$warntexten2.$warntexten3."";


$warntextger1 = "Wir m
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
Reply

Tags
2xautomated , pmbt , purging , user

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DATABASE: mysql_connect: Access denied for user 'user'@'localhost' ciolpalas Torrent Trader 2 30th June 2010 08:31
[PMBT] Ratio Maker & Ratio Master Ban User Mod? Giorgatzelos BT.Manager (phpMyBitTorrent) 4 13th December 2009 22:32
Bug in promoting user to power user in TS 5.6 crztz Template Shares 5 7th December 2009 03:58
[PMBT 2.0]Add user for tracker! LoaT BT.Manager (phpMyBitTorrent) 1 2nd February 2009 03:12
how change the normal user to power or admin user in ts TS Special Edition v.5.1 theway Template Shares 2 27th September 2008 14:44



All times are GMT +2. The time now is 16:32. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.