<h2></h2>
<?php
$ftime=604800;//	RED time = 7 
if (isset($_GET['g']))
  switch ($_GET['g']) {
		case -1:$g=-1;break;
		case 1:$g=1;break;
		case 2:$g=2;break;
		case 3:$g=3;break;
		default:$g=-1;
	}
else $g=-1;
if (isset($_GET['replace'])) $replace=preg_replace("/[^-1123]/i","",$_GET['replace']);else $replace='';
if (isset($_GET['userid']) && $replace!='')	{
	$count=count($_GET['userid']);
	$userid=$_GET['userid'];
	for ($i=0;$i<$count;$i++)
		if (mysql_query("update users set lvl=$replace where id=$userid[$i] and lvl!=4")) echo "<h3>   !</h3>";
		else echo "<h3>   !</h3>";
}
	

?>
<table border=1 width=100%><tr>
<td> :</td>
<td align=center width=15% style={cursor:hand} onClick=location.href='index.php?page=groups&g=-1' bgcolor=<?php if ($g==-1) echo '#99CC66'?>>Ban</td>
<td align=center width=15% style={cursor:hand} onClick=location.href='index.php?page=groups&g=1' bgcolor=<?php if ($g==1) echo '#99CC66'?>>Users</td>
<td align=center width=15% style={cursor:hand} onClick=location.href='index.php?page=groups&g=2' bgcolor=<?php if ($g==2) echo '#99CC66'?>>Moders</td>
<td align=center width=15% style={cursor:hand} onClick=location.href='index.php?page=groups&g=3' bgcolor=<?php if ($g==3) echo '#99CC66'?>>Admins</td>
</tr><tr><td colspan=5 valign=top><table width=100% style={text-align:center}>
<tr><td>id</td><td>login</td><td>last IP</td><td>last time</td><td>check</td><td>delete</td></tr>
<form action='index.php' method=GET>
<input type=hidden name=page value=groups>
<input type=hidden name=g value=<?php echo $g?>>
<?php
$count=0;
$sql=mysql_query("SELECT * FROM users where lvl=$g limit 0,20");
while($line=mysql_fetch_array($sql,MYSQL_ASSOC)) {
	if ($line['lasttm']==NULL) $lasttm='-'; else $lasttm=$line['lasttm'];
  echo "<tr><td width=5%>$line[id]</td><td width=30%>$line[login]</td>
	<td width=15%>$line[lastip]</td><td width=20% >";
	if ($ctime-$lasttm>$ftime) echo "<b style={color:red}>";
	if ($lasttm==0) echo "did not enter";	else echo date("d.m H:i:s",$lasttm); 
	echo "</b></td>
	<td width=15%><input type=checkbox name='userid[]' value=$line[id]></td>
	<td width=15%><input type=button onClick=location.href='index.php?page=dlusr&userid=$line[id]' value=del></td></tr>";
	$count++;
}
mysql_free_result($sql);
echo "
</td></tr></table><h4 class=bold> : $count</h4>";
?>
</td></tr></table>

<select name=replace>
	<option value=-1> 
	<option value=1> 
	<option value=2> 
	<option value=3> 
</select>
<input type=submit value=Ok>
</form>
