. */ include("./include/include.php"); admin_header(); if( !in_array($_SESSION['sess_access'], array("localorg", "chair", "admin")) ) { echoln("You are not authorized to see this page."); }else { echoln("

Activity log

"); // Load the different sections $sections = array(); $sections[] = "all"; $query = "SELECT `section` FROM `log` GROUP BY `section`"; if( @mysql_num_rows( $res=doquery($query) )>0 ) { while( $row=mysql_fetch_array($res) ) { $sections[] = $row['section']; } } // Set the active section if( isset($_POST['section']) ) { if( in_array($_POST['section'], $sections) ) { $_SESSION['log_section'] = $_POST['section']; }else { echoln("Invalid section, please select from the list.

"); } } if( !in_array($_SESSION['log_section'], $sections) ) $_SESSION['log_section']="all"; $query = "SELECT COUNT(`id`) AS `tot_rows` FROM `log`"; if( $_SESSION['log_section']!="all" ) $query .= " WHERE `section`='".addslashes($_SESSION['log_section'])."'"; if( @mysql_num_rows( $res=doquery($query) )!=1 ) { echoln("Failed selecting row count."); }else { $row = mysql_fetch_array($res); $tot_rows=$row["tot_rows"]; if( $tot_rows>MAXLIST ) { // There are more entries to show than fit on one page, split in pages $page_text = "Page"; for($i=0; $i<($tot_rows/MAXLIST); $i++) { if( $_REQUEST['start']==($i*MAXLIST) ) $page_text .= "  ".($i+1).""; else $page_text .= "  ".($i+1).""; } if( $_REQUEST['start']==-1 ) $page_text .= "   all rows"; else $page_text.="   all rows"; echoln($page_text); echoln("

"); } if( $_REQUEST['start']==-1 ) { $sqllimit = ""; if( $tot_rows>0 ) echoln("Showing rows 1 - $tot_rows ($tot_rows total).

"); }else { $start = get_int('start'); if( $start<0 ) $start = 0; if( $start>$tot_rows ) $start = $tot_rows-MAXLIST; $sqllimit = "LIMIT $start, ".MAXLIST; if( $tot_rows>0 ) echoln("Showing rows ".($start+1)." - ".min( ($start+MAXLIST), $tot_rows )." ($tot_rows total).

"); } $query = "SELECT `id`, `date`, `section`, `message`, `type`, `sess_name` FROM `log`"; if( $_SESSION['log_section']!="all" ) $query .= " WHERE `section`='".addslashes($_SESSION['log_section'])."'"; $query .= " ORDER BY `date` DESC $sqllimit"; if( @mysql_num_rows( $res=doquery($query) )<1 ) { echoln("Empty selection."); }else { echoln(""); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln(" "); $i=0; while( $row=mysql_fetch_array($res) ) { $i++; if( ($i%2)==1 ) echoln(" "); else echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln(" "); echoln(" "); } echoln("
DateSectionMessageTypeUser
".get_date($row['date'])."".$row['section']."".$row['message']."".$row['type']."".$row['sess_name']."
"); echoln("

Total: ".$tot_rows." log entries in current selection"); if( isset($page_text) ) echoln("

".$page_text); } } } admin_footer(); ?>