Recent Posts
None | 14 sec ago
None | 19 sec ago
None | 1 min ago
PHP | 1 min ago
PHP | 1 min ago
None | 1 min ago
None | 2 min ago
PHP | 2 min ago
C++ | 2 min ago
None | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Anonymous on the 9th of Feb 2010 11:08:01 PM Download | Raw | Embed | Report
  1. function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL)
  2. {
  3.         global $config, $db, $user, $auth;
  4.  
  5.         $deactivated = $activated = 0;
  6.         $sql_statements = array();
  7.  
  8.         if (!is_array($user_id_ary))
  9.         {
  10.                 $user_id_ary = array($user_id_ary);
  11.         }
  12.  
  13.         if (!sizeof($user_id_ary))
  14.         {
  15.                 return;
  16.         }
  17.  
  18.         $sql = 'SELECT user_id, group_id, user_type, user_inactive_reason
  19.                 FROM ' . USERS_TABLE . '
  20.                 WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
  21.         $result = $db->sql_query($sql);
  22.  
  23.         while ($row = $db->sql_fetchrow($result))
  24.         {
  25.                 $sql_ary = array();
  26.  
  27.                 if ($row['user_type'] == USER_IGNORE || $row['user_type'] == USER_FOUNDER ||
  28.                         ($mode == 'activate' && $row['user_type'] != USER_INACTIVE) ||
  29.                         ($mode == 'deactivate' && $row['user_type'] == USER_INACTIVE))
  30.                 {
  31.                         continue;
  32.                 }
  33.  
  34.                 if ($row['user_type'] == USER_INACTIVE)
  35.                 {
  36.                         $activated++;
  37.  
  38.                         if (!is_dir('/home/joeshow1/public_html/bettingwars/profile/users/'.$user_row[username])) {
  39.                                 $src='/home/joeshow1/public_html/bettingwars/profile/default';
  40.                                 $dst='/home/joeshow1/public_html/bettingwars/profile/users/'.$user_row[username];
  41.                                 function recurse_copy($src,$dst) {
  42.                                         $dir = opendir($src);
  43.                                         @mkdir($dst);
  44.                                         while (false !== ( $file = readdir($dir)) ) {
  45.                                                 if (( $file != '.' ) && ( $file != '..' )) {
  46.                                                         if ( is_dir($src . '/' . $file) ) {
  47.                                                                 recurse_copy($src . '/' . $file,$dst . '/' . $file);
  48.                                                         } else {
  49.                                                                 copy($src . '/' . $file,$dst . '/' . $file);
  50.                                                         }
  51.                                                 }
  52.                                         }
  53.                                         closedir($dir);
  54.                                 }
  55.                                 recurse_copy($src,$dst);
  56.  
  57.                                 //BCB   BETTING WARS
  58.                                 @ $bet_db = new mysqli('localhost', 'xxxx', 'xxxx', 'joeshow1_betting');
  59.                                 $query = "insert into total_db values ('".$user_row['username']."','100','100','0','0')";
  60.                                 $bet_db->query($query);
  61.  
  62.                         }
  63.  
  64.                 }
  65.                 else
  66.                 {
  67.                         $deactivated++;
  68.  
  69.                         // Remove the users session key...
  70.                         $user->reset_login_keys($row['user_id']);
  71.                 }
  72.  
  73.                 $sql_ary += array(
  74.                         'user_type'                             => ($row['user_type'] == USER_NORMAL) ? USER_INACTIVE : USER_NORMAL,
  75.                         'user_inactive_time'    => ($row['user_type'] == USER_NORMAL) ? time() : 0,
  76.                         'user_inactive_reason'  => ($row['user_type'] == USER_NORMAL) ? $reason : 0,
  77.                 );
  78.  
  79.                 $sql_statements[$row['user_id']] = $sql_ary;
  80.         }
  81.         $db->sql_freeresult($result);
  82.  
  83.         if (sizeof($sql_statements))
  84.         {
  85.                 foreach ($sql_statements as $user_id => $sql_ary)
  86.                 {
  87.                         $sql = 'UPDATE ' . USERS_TABLE . '
  88.                                 SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
  89.                                 WHERE user_id = ' . $user_id;
  90.                         $db->sql_query($sql);
  91.                 }
  92.  
  93.                 $auth->acl_clear_prefetch(array_keys($sql_statements));
  94.         }
  95.  
  96.         if ($deactivated)
  97.         {
  98.                 set_config_count('num_users', $deactivated * (-1), true);
  99.         }
  100.  
  101.         if ($activated)
  102.         {
  103.                 set_config_count('num_users', $activated, true);
  104.         }
  105.  
  106.         // Update latest username
  107.         update_last_username();
  108. }
Submit a correction or amendment below. [ previous version ] | [ difference ] | Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: