"); $name = translate_inline("Name"); $refs = translate_inline("Referrals"); rawoutput("$name$refs"); $sql = "SELECT count(*) AS c, acct.acctid,acct.name AS referer FROM " . db_prefix("accounts") . " INNER JOIN " . db_prefix("accounts") . " AS acct ON acct.acctid = " . db_prefix("accounts") . ".referer WHERE " . db_prefix("accounts") . ".referer>0 GROUP BY " . db_prefix("accounts") . ".referer DESC ORDER BY c DESC"; $result = db_query($sql); $number=db_num_rows($result); for ($i=0;$i<$number;$i++){ $row = db_fetch_assoc($result); rawoutput(""); output_notl("`@{$row['referer']}`0"); rawoutput(""); output_notl("`^{$row['c']}:`0 "); $sql = "SELECT name,refererawarded FROM " . db_prefix("accounts") . " WHERE referer = ${row['acctid']} ORDER BY acctid ASC"; $res2 = db_query($sql); $number2=db_num_rows($res2); for ($j = 0; $j < $number2; $j++) { $r = db_fetch_assoc($res2); output_notl(($r['refererawarded']?"`&":"`$") . $r['name'] . "`0"); if ($j != $number2-1) output_notl(","); } rawoutput(""); } rawoutput(""); }elseif($op=="graph"){ $sql = "SELECT count(acctid) AS c, substring(laston,1,10) AS d FROM " . db_prefix("accounts") . " GROUP BY d DESC ORDER BY d DESC"; $result = db_query($sql); output("`n`%`bDate accounts last logged on:`b"); rawoutput(""); $class="trlight"; $odate=date("Y-m-d"); $j=0; $cumul = 0; $number=db_num_rows($result); for ($i=0;$i<$number;$i++){ $row = db_fetch_assoc($result); $diff = (strtotime($odate)-strtotime($row['d']))/86400; for ($x=1;$x<$diff;$x++){ //if ($j%7==0) $class=($class=="trlight"?"trdark":"trlight"); //$j++; $class=(date("W",strtotime("$odate -$x days"))%2?"trlight":"trdark"); rawoutput(""); } // if ($j%7==0) $class=($class=="trlight"?"trdark":"trlight"); // $j++; $class=(date("W",strtotime($row['d']))%2?"trlight":"trdark"); $cumul+=$row['c']; rawoutput(""); $odate = $row['d']; } rawoutput("
".date("Y-m-d",strtotime("$odate -$x days"))."  0  $cumul
{$row['d']}  {$row['c']}  $cumul
"); } page_footer(); ?>