function ExcelOutput($query = "") { //connect mysql database mysql_select_db($this->db_name, $this->db_link); //get result $result = mysql_query($query); $numoffields = mysql_num_fields($result); // now we could construct Excel output $fieldstype = array(); for ($i = 0; $i < $numoffields; $i++) { $fieldstype[] = mysql_field_type($result, $i); } // for($i=0;...) END //create new instance of ExcelGen() class $excel = new ExcelGen("Sql2Excel"); //initiate a counter for excel "ROW" counter $rowscounter = 0; //write fields to excel for ($i = 0; $i < $numoffields; $i++) { $fld = mysql_fetch_field($result, $i); $fldname = $fld->name; $excel->WriteText($rowscounter, $i, $fldname); } // for($i=0;...) END $rowscounter++; while ($row = mysql_fetch_array($result)) { //fetch each Cell($rowscounter,$colscounter) into Excel output stream for ($colscounter = 0; $colscounter < $numoffields; $colscounter++) { //identify field type to descide how to write excel cell if (eregi("(int)", $fieldstype[$colscounter])) { $excel->WriteNumber($rowscounter, $colscounter, $row[$colscounter]); } else { $excel->WriteText($rowscounter, $colscounter, $row[$colscounter]); } } //for($colscounter..) END $rowscounter++; } // while($row=mysql..) END $excel->SendFile(); return; }
} if ($_SESSION['users']['list']['col'][11]) { $excel->WriteText($row, $col, $language['Expire']); } while ($tab = $rs->FetchRow()) { $last_login = $tab['last_login'] ? sumo_get_human_date($tab['last_login']) : ''; $created = $tab['created'] ? sumo_get_human_date($tab['created']) : ''; $expire = $tab['day_limit'] != NULL ? sumo_get_human_date($tab['day_limit'] * 86400 + $SUMO['server']['time'], FALSE) : ''; $username = sumo_get_formatted_username($tab['firstname'], $tab['lastname']); $col = 0; $row++; if ($username == ' ') { $username = ''; } if ($_SESSION['users']['list']['col'][6]) { $excel->WriteNumber($row, $col, $tab['id']); $col++; } if ($_SESSION['users']['list']['col'][2]) { $excel->WriteText($row, $col, $tab['username']); $col++; } if ($_SESSION['users']['list']['col'][4]) { $excel->WriteText($row, $col, $username); $col++; } if ($_SESSION['users']['list']['col'][8]) { $excel->WriteText($row, $col, $tab['usergroup']); $col++; } if ($_SESSION['users']['list']['col'][9]) {
$excel->WriteText($row, $col, $language['Country']); $col++; } if ($_SESSION['security'][$submodule]['col'][7]) { $excel->WriteText($row, $col, $language['LogMessage']); $col++; } if ($_SESSION['security'][$submodule]['col'][8]) { $excel->WriteText($row, $col, $language['Date']); } while ($tab = $rs->FetchRow()) { $col = 0; $row++; $node = sumo_get_node_info($tab['node'], 'ip'); if ($_SESSION['security'][$submodule]['col'][3]) { $excel->WriteNumber($row, $col, $tab['id']); $col++; } if ($_SESSION['security'][$submodule]['col'][3]) { $excel->WriteNumber($row, $col, $tab['priority']); $col++; } if ($_SESSION['security'][$submodule]['col'][3]) { $excel->WriteText($row, $col, $tab['code']); $col++; } if ($_SESSION['security'][$submodule]['col'][4]) { $excel->WriteText($row, $col, $node['name']); $col++; } if ($_SESSION['security'][$submodule]['col'][5]) {