<?
include "./auth.inc.php";
if (!$n)
$n=20;
if ($security<90){
$user = $PHP_AUTH_USER;
}else{
if (!$user)
$user=$PHP_AUTH_USER;
}
$sql = "SELECT FirstName, LastName, Suburb, CustomerID, VISP,
LastAccessDate, PhoneWork, PhoneHome
FROM MasterAccounts WHERE LastAccessUser='$user' ORDER BY LastAccessDate
DESC
LIMIT $n";
#echo $sql;
include "mysql.inc.php";
$result=mysql_query($sql);
if (!mysql_num_rows($result)){
print "No records found!<BR>";
print $sql;
while (list($key,$val) = each($GLOBALS))
print "$key = $val<BR>\n";
exit;
}
if (mysql_num_rows($result) == 1 && !$access){
$row = mysql_fetch_array($result);
#1 result, go directly to user
header("Location: user.php?ID=$row[CustomerID]");
exit;
}
?><HTML>
<HEAD>
</HEAD>
<body background="bg.jpg" bgcolor="#CCCC99" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" leftmargin="20"
topmargin="10">
<script language="JavaScript">
function changetop(ID)
{
top.rtop.location = 'top.php?'+ID;
}
</script>
<FONT SIZE=+1 FACE="arial">
<BR>
<? if ($security >90){
$osql = "SELECT username FROM ops ORDER BY username";
$ores = mysql_query($osql);
print "<form>\n";
print "<input size=4 type=text name=n value=\"$n\">";
print "<select name=user>";
while ($orow = mysql_fetch_row($ores)){
print "<option value=\"$orow[0]\"";
if ($orow[0] == $user)
print " selected";
print ">$orow[0]</option>";
}
print "</select>";
print "<input type=submit value=show>";
print "</form>";
}
?>
<BR>
<?
while ($row=mysql_fetch_array($result)){
$vsql="SELECT VISPName FROM VISP WHERE VISPID=$row[VISP]";
$vres=mysql_result(mysql_query($vsql),0);
?>
<P><?
#uncomment to show VISP's
#if ($vres) echo "$vres";
?> <A HREF="user.php?ID=<? echo $row[CustomerID] ?>" onclick=changetop(<? echo $row[CustomerID]?>)>
<? echo
"$row[FirstName]
$row[LastName]"; ?></A>
<? if ($typeq=='P')
echo "H: $row[PhoneHome] W: $row[PhoneWork]";
if ($C)
echo " <B>$row[Company]</B> ";
#if ($lastmodified)
echo " $row[LastAccessDate]";
?>
</P>
<?
}
print "<!-- ";
while (list($key,$val) = each($GLOBALS)){
print "$key = $val\n";
}
print " -->";
?>
</font>
</BODY>
</HTML>