Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Mods & Themes (http://www.bvlist.com/forumdisplay.php?f=109)
-   -   Reset Invites (http://www.bvlist.com/showthread.php?t=3698)

elvira 30th October 2009 14:35

Reset Invites
 
PHP Code:

<?php

/*******************************************\
|* Reset Invites by Alex2005 for TBDEV.NET *|
\*******************************************/

include('include/bittorrent.php');
dbconn();
loggedinorreturn();

if (
get_user_class() != UC_SYSOP)
    
stderr('Error''Access Denied!');

if (
$_GET['confirm'] != 1)
    
stderr('Sanity check!''Click <a href='.$_SERVER['PHP_SELF'].'?confirm=1>here</a> if you are sure you want to reset all users invites to 0.');
else
{
    
$res mysql_query('SELECT id FROM users WHERE invites > 0 AND enabled = \'yes\' AND status = \'confirmed\'') or sqlerr(__FILE____LINE__);
    
    if (
mysql_num_rows($res) > 0)
    {
        
$ids = array();
        
        while (
$arr mysql_fetch_assoc($res))
            
$ids[] = $arr['id'];
        
        
mysql_query('UPDATE users SET invites = 0 WHERE id IN ('.implode(' ,'$ids).')') or sqlerr(__FILE____LINE__);
        
        
stderr('Success'mysql_affected_rows().' user\'s invites reseted.');
    }
    else
        
stderr('Sorry''Nothing to reset.');
}
?>



All times are GMT +2. The time now is 22:34.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.