Guest User

serverside part

a guest
Jun 7th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.51 KB | None | 0 0
  1. <?php
  2. // Datenbank-Tabelle, die verwendet wird
  3. $table = 'loginlogs';
  4.  
  5. // Der Primary key, der Tabelle
  6. $primaryKey = 'id';
  7.  
  8. // Array of database columns which should be read and sent back to DataTables.
  9. // The `db` parameter represents the column name in the database, while the `dt`
  10. // parameter represents the DataTables column identifier. In this case simple indexes.
  11. $columns = array(
  12.     array( 'db' => 'ip', 'dt' => 0 ),
  13.     array(
  14.         'db'        => 'status',
  15.         'dt'        => 1,
  16.         'formatter' => function( $d, $row ) {
  17.             if($d == 1){
  18.                 return "Erfolgreich";
  19.             }else{
  20.                 return "Fehlgeschlagen";
  21.             }
  22.         }
  23.     ),
  24.     array(
  25.         'db'        => 'stayloggedin',
  26.         'dt'        => 2,
  27.         'formatter' => function( $d, $row ) {
  28.             if($d == 1){
  29.                 return "Ja";
  30.             }else{
  31.                 return "Nein";
  32.             }
  33.         }
  34.     ),
  35.     array(
  36.         'db'        => 'date',
  37.         'dt'        => 3,
  38.         'formatter' => function( $d, $row ) {
  39.             return getonlydate($d);
  40.         }
  41.     ),
  42.     array(
  43.         'db'        => 'date',
  44.         'dt'        => 4,
  45.         'formatter' => function( $d, $row ) {
  46.             return getonlytime($d);
  47.         }
  48.     )
  49. );
  50.  
  51. // SQL server connection information
  52. require('../../phpfuncs/connection.php');
  53. $sql_details = array(
  54.     'user' => $user,
  55.     'pass' => $pw,
  56.     'db'   => $db,
  57.     'host' => $host
  58. );
  59.  
  60.  
  61. require('ssp.class.php');
  62.  
  63. echo json_encode(
  64.     SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
  65. );
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment