$id&&$CURUSER['class'] 5) $level=5; //max level else $level = ($_GET['level']>0)?(int)$_GET['level']:2; //make sure its not negative // Add some form of interface to control level.... ill just use a link for now cause i m lazy echo '

More Depth ~ Less Depth
'; for ($i=1; $i<=$level ;$i++){ $fields[]= ' t'.$i.'.username as lev'.$i.', IF (t'.$i.'.downloaded >0,ROUND(t'.$i.'.uploaded / t'.$i.'.downloaded, 3),\'---\') as rlev'.$i.' , t'.$i.'.id as ilev'.$i.' , t'.$i.'.enabled as elev'.$i.' '; $where[]= ' left join users as t'.$i.' on t'.$i.'.invited_by=t'.($i-1).'.id '; $order[] = ' lev'.$i.' asc '; } $sql = 'select '.implode(', ',$fields).' from users as t0 '.implode(' ',$where).' where t0.id='.$id.' and t1.status=\'confirmed\' order by '.implode(', ',$order); echo('
'); $ret2 = mysql_query($sql); $fixt= ''; while ($arr2 = mysql_fetch_assoc($ret2)){ if ($prev['lev1'] != $arr2['lev1']){ $color = get_ratio_color($arr2['rlev1']); if ($color) $ratio = " ($arr2[rlev1])"; else $ratio = ' ('.$arr2['rlev1'].')'; if ($arr2['elev1']=='no') $enabled= ' '; else $enabled= ''; echo $fixt.''; } echo '
Invite Tree
♦'.$arr2['lev1'].''.$ratio.$enabled; } for ($i=2;$i<=$level;$i++){ $levstr = 'lev'.$i; $prevlevstr = 'lev'.($i-1); for ($a=2;$a<=$i;$a++) $spacer.= '     '; $color = get_ratio_color($arr2['r'.$levstr]); if ($color) $ratio = ' ('.$arr2['r'.$levstr].')'; else $ratio = ' ('.$arr2['r'.$levstr].')'; if ($arr2['e'.$levstr]=='no') $enabled= ' '; else $enabled= ''; if (($arr2[$levstr]!=null)&&($prev[$prevlevstr]!= $arr2[$prevlevstr])) echo '
'.$spacer.''.$arr2[$levstr].''.$ratio.$enabled; else if (($arr2[$levstr]!=null)&&($arr2[$levstr]!=$prev[$levstr])) echo '
'.$spacer.''.$arr2[$levstr].''. $ratio.$enabled; $spacer=''; $prev[$levstr] = $arr2[$levstr]; } $prev['lev1'] = $arr2['lev1']; $fixt='
'; stdfoot(); ?>