Skip to content

Commit

Permalink
Fix db settings
Browse files Browse the repository at this point in the history
  • Loading branch information
arksnorman committed Apr 14, 2018
1 parent da86f7e commit fb2d0cc
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 65 deletions.
11 changes: 3 additions & 8 deletions api/admins.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

require_once './db.php';

// DB table to use
$table = 'admins';

Expand All @@ -18,7 +20,7 @@
[
'db' => 'joined',
'dt' => 3,
'formatter' => function( $d, $row )
'formatter' => function($d)
{
return date( 'jS M y', strtotime($d));
}
Expand All @@ -33,12 +35,5 @@
]
];

// SQL server connection information
$sql_details = [
'user' => 'root',
'pass' => 'arks2015',
'db' => 'sis',
'host' => '127.0.0.1'
];
require_once __DIR__ . DIRECTORY_SEPARATOR . 'SSP.php';
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
11 changes: 3 additions & 8 deletions api/complaints.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

require_once './db.php';

// DB table to use
$table = 'complaints';

Expand All @@ -17,19 +19,12 @@
[
'db' => 'date_added',
'dt' => 3,
'formatter' => function( $d, $row )
'formatter' => function($d)
{
return date( 'jS M y', strtotime($d));
}
]
];

// SQL server connection information
$sql_details = [
'user' => 'root',
'pass' => 'arks2015',
'db' => 'sis',
'host' => '127.0.0.1'
];
require_once __DIR__ . DIRECTORY_SEPARATOR . 'SSP.php';
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
9 changes: 2 additions & 7 deletions api/courses.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

require_once './db.php';

// DB table to use
$table = 'courses';

Expand All @@ -24,12 +26,5 @@
]
];

// SQL server connection information
$sql_details = [
'user' => 'root',
'pass' => 'arks2015',
'db' => 'sis',
'host' => '127.0.0.1'
];
require_once __DIR__ . DIRECTORY_SEPARATOR . 'SSP.php';
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
10 changes: 10 additions & 0 deletions api/db.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

$ip = gethostbyname('arksnorman.tk');

$sql_details = [
'user' => 'sis',
'pass' => 'root',
'db' => 'student_information_system',
'host' => $ip
];
11 changes: 3 additions & 8 deletions api/lecturers.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

require_once './db.php';

// DB table to use
$table = 'lecturers';

Expand All @@ -18,7 +20,7 @@
[
'db' => 'joined',
'dt' => 3,
'formatter' => function( $d, $row )
'formatter' => function($d)
{
return date( 'jS M y', strtotime($d));
}
Expand All @@ -33,12 +35,5 @@
]
];

// SQL server connection information
$sql_details = [
'user' => 'root',
'pass' => 'arks2015',
'db' => 'sis',
'host' => '127.0.0.1'
];
require_once __DIR__ . DIRECTORY_SEPARATOR . 'SSP.php';
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
11 changes: 3 additions & 8 deletions api/notes.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

require_once './db.php';

// DB table to use
$table = 'notes';

Expand All @@ -18,7 +20,7 @@
[
'db' => 'date_added',
'dt' => 4,
'formatter' => function( $d, $row )
'formatter' => function($d)
{
return date( 'jS M y', strtotime($d));
}
Expand All @@ -33,12 +35,5 @@
]
];

// SQL server connection information
$sql_details = [
'user' => 'root',
'pass' => 'arks2015',
'db' => 'sis',
'host' => '127.0.0.1'
];
require_once __DIR__ . DIRECTORY_SEPARATOR . 'SSP.php';
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
11 changes: 3 additions & 8 deletions api/notices.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

require_once './db.php';

// DB table to use
$table = 'notices';

Expand All @@ -16,7 +18,7 @@
[
'db' => 'date_added',
'dt' => 2,
'formatter' => function( $d, $row )
'formatter' => function($d)
{
return date( 'jS M y', strtotime($d));
}
Expand All @@ -31,12 +33,5 @@
]
];

// SQL server connection information
$sql_details = [
'user' => 'root',
'pass' => 'arks2015',
'db' => 'sis',
'host' => '127.0.0.1'
];
require_once __DIR__ . DIRECTORY_SEPARATOR . 'SSP.php';
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
9 changes: 2 additions & 7 deletions api/students.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

require_once './db.php';

// DB table to use
$table = 'students';

Expand Down Expand Up @@ -27,12 +29,5 @@
]
];

// SQL server connection information
$sql_details = [
'user' => 'root',
'pass' => 'arks2015',
'db' => 'sis',
'host' => '127.0.0.1'
];
require_once __DIR__ . DIRECTORY_SEPARATOR . 'SSP.php';
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
11 changes: 3 additions & 8 deletions api/timetables.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

require_once './db.php';

// DB table to use
$table = 'timetables';

Expand All @@ -16,7 +18,7 @@
[
'db' => 'date_added',
'dt' => 2,
'formatter' => function( $d, $row )
'formatter' => function($d)
{
return date( 'jS M y', strtotime($d));
}
Expand All @@ -31,12 +33,5 @@
]
];

// SQL server connection information
$sql_details = [
'user' => 'root',
'pass' => 'arks2015',
'db' => 'sis',
'host' => '127.0.0.1'
];
require_once __DIR__ . DIRECTORY_SEPARATOR . 'SSP.php';
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
6 changes: 3 additions & 3 deletions data/config.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
driver = mysql
host = 127.0.0.1
name = sis
username = root
host = arksnorman.tk
name = student_information_system
username = sis
password = root
port = 3306

0 comments on commit fb2d0cc

Please sign in to comment.