english 
Thread Options  Search this Thread  
Post: #1
04-12-2006 20:19 PM (This post was last modified: 09-12-2006 22:16 PM by xam)
KvickaN
Ex Verified Customer


Joined: 12-11-2006
Posts: 34
Country: Sweden
Male KvickaN is Offline now
Better confirm all unconfirmed users at the same time
Better confirm all unconfirmed users at the same time

Make a file named pusers.php

Add this in it.
PHP:
<?php
require "include/bittorrent.php";

dbconn();
loggedinorreturn();
if (
get_user_class() < UC_ADMINISTRATOR)
die;

stdhead("Pending Users");
begin_main_frame();
$action=(int)$_GET['action'];
$action=($action<1?0:$action>2?0:$action);
$uid $_GET['uid'];
if(
$action && !empty($uid)) {
$uida=explode('o',$uid);
foreach(
$uida as $key => $value)
$uida[$key]='id='sqlesc((int)abs($value));
$uids=implode(" OR ",$uida);
if(
$action==1) {
$query="UPDATE users SET status='confirmed',editsecret='',enabled='yes',last_access=added WHERE status='pending' AND ("$uids")";
$type='confirmed';
} else {
$query="DELETE FROM users WHERE status='pending' AND ("$uids .")";
$type='deleted';
}
$num=count($uida);
mysql_query($query);
$arow=(int)mysql_affected_rows();
begin_frame('Status of operation ('. ($action==1?'CONFIRM':'DELETE') .')',true);
echo 
"<p>$arow of $num user accts $type</p>";
end_frame();
}

$page=(int)$_GET['page'];
$perpage=30;

$arr=mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM users WHERE status='pending'"));
$pages=($pp=floor($arr[0] / $perpage))+($pp*$perpage $arr[0]?1:0);
$page=($page<1?1:$page>$pages?$pages:$page);
for (
$i=1;$i<=$pages;++$i)
$pagemenu.=($i!=$page?"<a href=?page=$i>":'')."<b>$i</b>".($i!=$page?'</a>':'')."\n";
$browsemenu.=($page>1?'<a href=?page='.($page-1).'>':'').'<b><< Prev</b>'.($page>1?'</a>':'');
$browsemenu.= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
$browsemenu.=($page<$pages?'<a href=?page='.($page+1).'>':'').'<b>Next >></b>'.($page<$pages?'</a>':'');

$offset=($page*$perpage)-$perpage;
$res=mysql_query("SELECT * FROM users WHERE status='pending' LIMIT $offset,$perpage");
begin_frame("Pending Users",true);
?>
<script type="text/javascript">
<!-- Begin Un/CheckAll
function checkAll(ref)
{
var chkAll = document.getElementById('checkAll');
var checks = document.getElementsByName('cbox');
var uid = document.getElementById('uid');
var boxLength = checks.length;
var allChecked = true;
var uids = "";

if(ref==1) {
for(i=0;i<boxLength;i++) {
checks[i].checked=chkAll.checked;
if(chkAll.checked==true)
uids += checks[i].value+"o";
}
} else {
for(i=0;i<boxLength;i++) {
if(checks[i].checked==true)
uids += checks[i].value+"o";
else
allChecked=false;
}
chkAll.checked=allChecked;
}
uid.value=uids.substring(0,uids.length-1);
}
// End -->
</script>

<table border=1 cellspacing=0 cellpadding=5>
<tr align="center" valign="middle">
<td class=colhead><input id="checkAll" type="checkbox" o<strong></strong>nClick="checkAll(1)" value=""></td>
<td class=colhead>User ID</td>
<td class=colhead>Username</td>
<td class=colhead>E-mail</td>
<td class=colhead>Registered</td>
</tr>
<?
for ($i=0;$i<$num;++$i)
{
$arr=mysql_fetch_assoc($res);
if ($arr['added'] == '0000-00-00 00:00:00')
$arr['added'] = '-';
?>
<tr>
<td align="center" valign="middle" class="mainouter">
<input name="cbox" type="checkbox" o<strong></strong>nClick="checkAll(2)" value="<?=$arr[id]?>">
</td>
<td class="main">&nbsp;<?=$arr['id']?></td>
<td class="main">&nbsp;<?=$arr['username']?></td>
<td class="main">&nbsp;<?=$arr['email']?></td>
<td class="mainouter">&nbsp;<?=$arr['added']?></td>
</tr>
<?
}
if(!$num) {
?>
<tr class="mainouter"><td align="center" colspan="5">None</td></tr>
<?
}
?>
<tr>
<td colspan="3" align="center" valign="middle" class="bottom">
<form action="" method="get" name="pending">
<input name="uid" id="uid" type="hidden" value="">
&nbsp;Action&nbsp;
<select name="action" size="1">
<option value="1" selected>Confirm</option>
<option value="2">Delete</option>
</select>&nbsp;<input id="Submit" type="submit" <?=($num?'':'disabled')?>>
</form>
</td>
<td colspan="2" align="center" valign="middle" class="bottom">
<?=$browsemenu?><?=$pagemenu?>
</td>
</tr>
</table>
<?
end_frame();
end_main_frame();
stdfoot();
?>


Upload to root, go staff panel and add the option to Sysops (thats what i have)

Hope you like it

-KvickaN

Post: #2
09-12-2006 16:45 PM
lasha12345


Joined: 14-11-2006
Posts: 89
Country: Burkina Faso
Male lasha12345 is Offline now
Better confirm all unconfirmed users at the same time
i uploaded this and shows no oending users ((( and on main page it shows two unconfirmed users... i have ts 1.3.6 and 1.3.7 can you help me???

Post: #3
09-12-2006 22:01 PM
KvickaN
Ex Verified Customer


Joined: 12-11-2006
Posts: 34
Country: Sweden
Male KvickaN is Offline now
Better confirm all unconfirmed users at the same time
hmm i dont know why it does that to me to any one can help us?

Quick Reply
Decrease Size
Increase Size
Insert bold text Insert italic text Insert underlined text Align text to the left Align text to the centerr Align text to the right Justify text Insert quoted text Code Insert formatted PHP code Insert formatted SQL code
Colors
Insert hyperlink Insert image Insert email address
Smilies
Insert hidden text



Forum Jump: