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.');
}
?>