Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/tabs/e.php
<?php
if  (isset($_GET['lsid'])) 
{
	$loc=getLocationID($_GET['lsid']);
	$LocName=$_GET['lsid'];
}
else {
	$LocName = $_SESSION['LocName'];
    $loc=$_SESSION['LocID'];
}
$LocName = $_SESSION['LocName'];

if (isset($_GET['lsid']) AND ($_GET['lsid']=="All"))
		$locstr="";
	 else
	 {
		$locstr=" AND userinfo.LocationID='$loc'";
		$locstrwa=" WHERE LocationID='$loc'";
	}


if(!isset($buttonID)) {
	$msg= "$msg <p class=\"error\">No button ID was sent</p>"; // this shouldn't happen
}

if(!isset($msg)){  // no errors? ...  hit it.  Need to reset button id
	
$y=date('Y');
$m=date('m');
if (isset($_POST['start'])) $start=$_POST['start'];
if (isset($_POST['stop'])) $stop=$_POST['stop'];
if (isset($_POST['order'])) $order=$_POST['order'];
if (isset($_POST['sortby'])) $sortby=$_POST['sortby'];
if (isset($_POST['server'])) $server=$_POST['server'];
if (isset($_POST['pagesize'])) $pagesize=$_POST['pagesize'];
if (isset($_POST['do_delete'])) $dodelete=$_POST['do_delete'];
if (isset($_POST['row_id'])) $row_id=$_POST['row_id'];
$login=$pullUser;
if ($start=='')  {
      $start=$y."-".$m."-01 00:00:00";
      $startf=date($dateFormat,strtotime($start));
      }
      else
      {
      $startf=$start;
      $start=date_to_attribute($fromdate,"mysql");
      }

if ($stop=='')
       {
        $stop=date("Y-m-d")." 23:59:59";
        $stopf=date($dateFormat,strtotime($stop));
       }
else
      {
        $stopf=$stop;
        $stop=date_to_attribute($stopf,"mysql");
      }

$num = 0;
$pagesize = ($pagesize) ? $pagesize : 10;
if (!is_numeric($pagesize) && $pagesize != 'all')
	                $pagesize = 10;
$limit = ($pagesize == 'all') ? '' : "LIMIT $pagesize";
$selected[$pagesize] = 'selected';


$usercheck = ($login == 'anyone') ? "LIKE '%'" : "= '$login'";
$order = ($order != '') ? $order : 'desc';
if ($order != 'desc' && $order != 'asc')
	$order = 'desc';
$selected[$order] = 'selected';

?>
<center>
<table border=0 width=550 cellpadding=0 cellspacing=0>
<tr valign=top>
<td align=center><img src="images/title2.gif"></td>
</tr>
</table>
<table border=0 width=400 cellpadding=0 cellspacing=2>
</table>
<br>
<table border=0 width=800 cellpadding=1 cellspacing=1>
<tr valign=top>
<td width=65%></td>
<td bgcolor="888888" width=35%>
<table border=0 width=100% cellpadding=2 cellspacing=0>
<tr bgcolor="#aaaaaa" align=right valign=top>
<th><font size="2" face="Verdana">Unauthorized Service Usage History for <? print $pullUser; ?></font>&nbsp;&nbsp;&nbsp;&nbsp; </th>
</tr>
<tr bgcolor="#aaaaaa" align=right valign=top>
<th><font color="white">Bad users </font>&nbsp;
</th></tr>
</table>
</td></tr>
<tr bgcolor="black" valign=top><td colspan=2>
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
<tr><td>

<?

if ($do_delete == 1 && ($row_id != 0 && is_numeric($row_id))){
	$search = $oreon->database->database->query("SELECT id,admin FROM badusers WHERE id = '$row_id';");
	if ($search){
		$row = $oreon->database->database->fetch_array($search);
		if ($row[id] == $row_id){
			$admin = "$row[admin]";
			if ($oreon->user->get_status()=="3" or $oreon->user->get_status()=="2"){
				$sql_servers = array();
				$sql_servers[] = $conf_pra['host'];
				foreach ($sql_servers as $server){
				  $r = $oreon->database->database->query("DELETE FROM badusers WHERE id = '$row_id';");
				}
			}
		}
	}
}
print '
<table border=0 width=740 cellpadding=1 cellspacing=1>
<tr bgcolor="black" valign=top><td colspan=2>
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
	<tr><td>
<b>'.$startf.'</b> up to <b>'.$stopf.'</b>
<form action="sexyTabs.php" method="POST" name="master">
<input type=hidden name=do_delete value=0>
<input type=hidden name=row_id value=0>
<input type=hidden name=ID value='.$pullUser.'>

<p>
<table border=0 bordercolordark=#e6e6e6 bordercolorlight=#000000 width=600px cellpadding=2 cellspacing=0 bgcolor="#e6e6e6" valign=top>
        <tr bgcolor="#e6e6e6">

	<th>#</th><th>user</th><th>date</th><th>admin</th><th>reason</th><th>administrator action</th>
	</tr>';

$search =  $oreon->database->database->query(
	"SELECT * FROM badusers,userinfo
	WHERE badusers.username=userinfo.UserName AND badusers.username $usercheck $extra_query AND incidentdate <= '$start'
	AND incidentdate >= '$stop' $locstr
	ORDER BY incidentdate $order $limit  ;");
	if ($search){
		while( $row =$oreon->database->database->fetch_array($search) ){
			$num++;
			$id = $row['id'];
			$user = $row['username'];
			$User = urlencode($user);
			$date = $row['incidentdate'];
			$reason = $row['reason'];
			$admin = $row['admin'];
		        $action = "<td><input type=submit class=button value=\"Delete\" OnClick=\"this.form.do_delete.value=1;this.form.row_id.value=$id\"></td>";
			if ($admin == '')
				$admin = '-';
			if ($reason == '')
				$reason = '-';
			echo "
			<tr align=center>
				<td>$num</td>
				<td>";
			echo '<input type="button" class="smallButton" name="UserSelected" value="'.$user.'" onClick="window.open(\'include/divers/sexyTabs.php?phpmyprepaid='.session_id.'&usr='.$user.'\',\'User informations\',\'width=800,height=600,status=yes,resizable=yes,menubar=yes,scrollbars=yes\');" ></td>';
			echo "	<td>$date</td>
				<td>$admin</td>
				<td>$reason</td>
				  $action";

		print '	</tr>';
		}
	}

print '</table>
<tr><td>
<hr>';

echo '<tr><td >
	<form action="phpmyprepaid" method="post" name="master">
	<table  border=0 cellspacing=0 cellpadding=2>
	<tr valign=bottom>
		<td><small><b>start date</td>
		<td><small><b>stop date</td>
		<td>&nbsp;</td>
		</tr>
	<tr valign=middle>
	<td valign=middle>';

	echo '
		<input type="text"  width="13" name="start" id="start" size="15" value="'.$startf.'"/><button type="reset" id="f_trigger_b1">...</button>
		</span></td>';
	echo '<script type="text/javascript">
		Calendar.setup({
			inputField     :    "start",      // id of the input field
				ifFormat       :    "'.cdateformat_calendar($dateFormat).'",       // format of the input field
				showsTime      :    true,            // will display a time selector
				button         :    "f_trigger_b1",   // trigger for the calendar (button ID)
				singleClick    :    true,           // double-click mode
				step           :    1                // show all years in drop-down boxes (instead of every other year as default)
});
</script>';
	echo "<td valign=middle>";
	echo '
		<input type="text"  width="13" name="stop" id="stop" size="15" value="'.$stopf.'"/><button type="reset" id="f_trigger_b2">...</button>
		</span></td>';
	echo '<script type="text/javascript">
		Calendar.setup({
			inputField     :    "stop",      // id of the input field
				ifFormat       :    "'.cdateformat_calendar($dateFormat).'",       // format of the input field
				showsTime      :    true,            // will display a time selector
				button         :    "f_trigger_b2",   // trigger for the calendar (button ID)
				singleClick    :    true,           // double-click mode
				step           :    1                // show all years in drop-down boxes (instead of every other year as default)
});
</script>';
echo "</td>";
	
echo "
	 </tr></table><br><table width=100%>";
echo '<tr><td> Page size :</td>';
echo "<td><select name=\"pagesize\">
<option $selected[5] value=\"5\" >05
<option $selected[10] value=\"10\">10
<option $selected[15] value=\"15\">15
<option $selected[20] value=\"20\">20
<option $selected[40] value=\"40\">40
<option $selected[80] value=\"80\">80
<option $selected[all] value=\"all\">all
</select>
</td>";
 echo "<input type=hidden name=tab value='e'>";

echo '<td> Order :</td>';
echo "
<td><select name=\"order\">
<option $selected[asc] value=\"asc\">older first
<option $selected[desc] value=\"desc\">recent first
</select>
</td>";


echo "<td><input type=\"submit\" class=smallButton value=\"show\"></td></tr>
</table></td></tr></form>
</table>
</tr>
</table>";
}
?>
Return current item: phpMyPrepaid