09 Parked Accounts

Started by Mindless, July 21, 2012, 09:25:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rushed

this is so staff can set a users account to parked or unparked

@userdetails.php

add this

if ($user["parked"] == 'yes')
          $HTMLOUT .= "<p><b>{$lang['userdetails_parked']}</b></p>\n";


above

if (!$enabled)
      $HTMLOUT .= "<p><b>{$lang['userdetails_disabled']}</b></p>\n";


Then in your admin tools section add this

$HTMLOUT .= "<tr><td class='rowhead'>{$lang['userdetails_park']}</td><td colspan='2' align='left'><input name='parked' value='yes' type='radio'" .
           ($user["parked"] == "yes" ? " checked='checked'" : "") . " />{$lang['userdetails_yes']} <input name='parked' value='no' type='radio'" .
           ($user["parked"] == "no" ? " checked='checked'" : "") . " />{$lang['userdetails_no']}</td></tr>\n";


Next edit lang/en/lang_userdetails.php

add

'userdetails_park' => "Park Account",
'userdetails_parked' => "This Account is Currently Parked!",


Next we need to edit modtask.php

add



//== Parked accounts
              if ((isset($_POST['parked'])) && (($parked = $_POST['parked']) != $user['parked']))
              {
              if ($parked == 'yes')
              {
              $modcomment = get_date( time(), 'DATE', 1 ) . " - Account Parked by " . $CURUSER['username'] . ".\n" . $modcomment;
              }
              elseif ($parked == 'no')
              {
              $modcomment = get_date( time(), 'DATE', 1 ) . " - Account UnParked by " . $CURUSER['username'] . ".\n" . $modcomment;
              }
              else
              stderr("{$lang['modtask_user_error']}", "{$lang['modtask_try_again']}");
              $updateset[] = "parked = " . sqlesc($parked);
         $useredit['update'][] = 'Account parked = '.$parked.'';
        }
              //== end parked


Then your done staff can now set user accounts to parked or unparked

Mindless

#1
Credits to psor
Updated for 09

// sql :

Code (sql) Select
ALTER TABLE users ADD(parked enum ('yes','no') NOT NULL default 'no');


// Open announce.php and find:

Code (sql) Select
$user_query = mysql_query("SELECT id, uploaded, downloaded, class, enabled FROM users WHERE passkey=".sqlesc($passkey)) or err("Tracker error 2");

// and change the query to:

Code (sql) Select
$user_query = mysql_query("SELECT id, uploaded, downloaded, class, parked, enabled FROM users WHERE passkey=".sqlesc($passkey)) or err("Tracker error 2");


// Then find this if you run 09 new and improved snatchlist - note if you have defaultr announce no snatchlist add the parked check above wait block :

Code (php) Select
//if ($user["parked"] == "yes")
//err("Your account is parked! (Read the FAQ)");
//if ($user["downloadpos"] == 0 OR $user["downloadpos"] > 1 )
//err("Your downloading priviledges have been disabled! (Read the rules)");



// And change it like so :

Code (php) Select
if ($user["parked"] == "yes")
err("Your account is parked! (Read the FAQ)");


Or :

Code (php) Select
if ($user["parked"] == "yes")
err("Your account is parked! (Read the FAQ)");
elseif ($user["downloadpos"] == 0 OR $user["downloadpos"] > 1 )
err("Your downloading priviledges have been disabled! (Read the rules)");


// Open include/userfunctions.php or bittorrent.php and add this :

Code (php) Select
function parked()
{
global $CURUSER;
if ($CURUSER["parked"] == "yes")
stderr("Error", "Your account is currently parked.");
}


// Open browse.php, forums.php, comment.php and find the lang defines :

Code (php) Select
$lang = array_merge( load_language('global'), load_language('browse'), load_language('torrenttable_functions') );

Add :

Code (php) Select
parked();

After the lang define so you menu wont disapear on stderr :)

Then add it the same way to any other files if the parked(); is above the lang define your menu will disapear. Sendmessage.php, messages.php takemessage.php basically any file you'll restrict access while parked.

// Open my.php and add this where you want :

Code (php) Select
$HTMLOUT .= tr($lang['my_acc_parked'],"<input type='radio' name='parked'" . ($CURUSER["parked"] == "yes" ? " checked='checked'" : "") . " value='yes' />yes
    <input type='radio' name='parked'" .  ($CURUSER["parked"] == "no" ? " checked='checked'" : "") . " value='no' />no
    <br /><font class='small' size='1'>{$lang['my_acc_parked_message']}<br />{$lang['my_acc_parked_message1']}</font>",1);


// Open lang/en/lang_my.php and add :

Code (php) Select
'my_acc_parked' => 'Account parked',
'my_acc_parked_message' => 'You can park your account to prevent it from being deleted because of inactivity if you go away on for example a vacation.',
'my_acc_parked_message1' => 'When the account has been parked limits are put on the account, for example you cannot use the tracker and browse some of the pages.',


// Open takeprofedit and find:

Code (php) Select
$acceptpms = $_POST["acceptpms"];

// Above this line add:

Code (php) Select
$parked = $_POST["parked"];

// Then find:

Code (php) Select
$updateset[] = "acceptpms = " . sqlesc($acceptpms);

// Above it insert:

Code (php) Select
$updateset[] = "parked = " . sqlesc($parked);

// Open takemessage.php and find:

Code (sql) Select
$res = mysql_query("SELECT acceptpms, email, notifs, last_access as la FROM users WHERE id=$receiver") or sqlerr(__FILE__, __LINE__);

// And change it to:

Code (sql) Select
$res = mysql_query("SELECT acceptpms, email, notifs, parked, last_access as la FROM users WHERE id=$receiver") or sqlerr(__FILE__, __LINE__);

// Then find:

    
Code (php) Select
//Make sure recipient wants this message
if ($CURUSER['class'] < UC_MODERATOR)
    {


// After these lines add:

Code (php) Select
if ($user["parked"] == "yes")
stderr("Refused", "This account is parked.");


// Open cleanup.php and find:

   
Code (php) Select
//delete inactive user accounts
$secs = 42*86400;
$dt = (time() - $secs);
$maxclass = UC_POWER_USER;
@mysql_query("DELETE FROM users WHERE status='confirmed' AND class <= $maxclass AND last_access < $dt");


// and change the query to:

Code (php) Select
mysql_query("DELETE FROM users WHERE parked='no' AND status='confirmed' AND class <= $maxclass AND last_access < $dt");


// after the whole codeblock add:

      
Code (php) Select
//delete parked user accounts
   $secs = 175*86400; // change the time to fit your needs
   $dt = (time() - $secs);
   $maxclass = UC_POWER_USER;
   mysql_query("DELETE FROM users WHERE parked='yes' AND status='confirmed' AND class <= $maxclass AND last_access < $dt");