Guest User

Untitled

a guest
Oct 25th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.40 KB | None | 0 0
  1. <?php
  2.  
  3. if (!defined('DATATABLES')) exit(); // Ensure being used in DataTables env.
  4. // Enable error reporting for debugging (remove for production)
  5. error_reporting(E_ALL);
  6. ini_set('display_errors', '1');
  7.  
  8. $table = 'critical_mount_point';
  9.  
  10. // Table's primary key
  11. $primaryKey = 'mp_sno';
  12.  
  13. // Array of database columns which should be read and sent back to DataTables.
  14. // The `db` parameter represents the column name in the database, while the `dt`
  15. // parameter represents the DataTables column identifier. In this case simple
  16. // indexes
  17. $columns = array(
  18.                     array( 'db' => 'system_name', 'dt' => 0 ),
  19.                     array( 'db' => 'mountpoint_name', 'dt' => 1 ),
  20.                     array( 'db' => 'total_size', 'dt' => 2),
  21.                     array( 'db' => 'used_size', 'dt' => 3),
  22.                     array( 'db' => 'remaining_size', 'dt' => 4),
  23.                     array( 'db' => 'percentage_filled', 'dt' => 5),
  24.                     array( 'db' => 'write_permission', 'dt' => 6),
  25.                     array(
  26.                         'db'        => 'date',
  27.                         'dt'        => 7,
  28.                         'formatter' => function( $d, $row ) {
  29.                             return date( 'Y-m-j h:i:s A T', strtotime($d));
  30.                         })
  31.                 );
  32. // SQL server connection information
  33. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  34.  * Database user / pass
  35.  */
  36. $sql_details = array(
  37.     "type" => "Postgres",     // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle"
  38.     "user" => "username",          // Database user name
  39.     "pass" => "password",          // Database password
  40.     "host" => "127.0.0.1", // Database host
  41.     "port" => "5432",          // Database connection port (can be left empty for default)
  42.     "db"   => "databasename",          // Database name
  43.     "dsn"  => "",          // PHP DSN extra information. Set as `charset=utf8mb4` if you are using MySQL
  44.     "pdoAttr" => array(),  // PHP PDO attributes array. See the PHP documentation for all options
  45. );
  46.  
  47. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  48.  * If you just want to use the basic configuration for DataTables with PHP
  49.  * server-side, there is no need to edit below this line.
  50.  */
  51.  
  52. require( 'ssp.class.php' );
  53.  
  54. echo json_encode(
  55.     SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
  56. );
Add Comment
Please, Sign In to add comment