示例#1
0
 ini_set('display_startup_errors', TRUE);
 date_default_timezone_set('Europe/London');
 if (PHP_SAPI == 'cli') {
     die('This example should only be run from a Web Browser');
 }
 /** Include PHPExcel */
 // Create new PHPExcel object
 $objPHPExcel = new PHPExcel();
 // Set document properties
 $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")->setLastModifiedBy("Maarten Balliauw")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file");
 $i = 2;
 $col_index = array('E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
 $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', 'BDM NAME')->setCellValue('B1', 'ZONE')->setCellValue('C1', 'ASM NAME')->setCellValue('D1', 'ZSM NAME');
 if (!empty($bdm)) {
     foreach ($bdm as $bdms) {
         $total = ho::list_rx($date, $date1, $bdms->bdm_id);
         $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $i, $bdms->bdm_name)->setCellValue('B' . $i, $bdms->zone)->setCellValue('C' . $i, $bdms->asm_name)->setCellValue('D' . $i, $bdms->zsm_name);
         $j = 0;
         foreach ($total as $value) {
             $objPHPExcel->setActiveSheetIndex(0)->setCellValue($col_index[$j] . '1', $value->mydate)->setCellValue($col_index[$j] . $i, $value->rx_count);
             $j++;
         }
         $i++;
     }
 }
 // Rename worksheet
 $objPHPExcel->getActiveSheet()->setTitle('Simple');
 // Set active sheet index to the first sheet, so Excel opens this as the first sheet
 $objPHPExcel->setActiveSheetIndex(0);
 // Redirect output to a client’s web browser (Excel2007)
 header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
示例#2
0
<?php

require_once "./includes/initialize.php";
$errors = array();
session_start();
if (isset($_POST['submit'])) {
    // Form has been submitted.
    $username = trim($_POST['username']);
    $password = trim($_POST['password']);
    // Check database to see if username/password exist.
    $found_bdm = bdm::authenticate($username, $password);
    $found_ho = ho::authenticate($username, $password);
    $found_task = task::auth($username, $password);
    if ($found_bdm) {
        $_SESSION['bdm'] = $found_bdm->bdm_id;
        $_SESSION['bdmname'] = $found_bdm->bdm_name;
        $_SESSION['bdmzone'] = $found_bdm->zone;
        redirect_to("dashboard.php");
    } elseif ($found_ho) {
        //        session_start();
        $_SESSION['ho'] = $found_ho->id;
        redirect_to("dashboard.php");
    } elseif ($found_task) {
        //       session_start();
        $_SESSION['taskforce'] = $found_task->tfid;
        $_SESSION['tfname'] = $found_task->name;
        $_SESSION['tfzone'] = $found_task->zone;
        redirect_to("dashboard.php");
    } else {
        $message = "Incorrect Username/Password.";
        flashMessage($message, 'error');