From 45430cb23ed70ebde41955b92afab92c5c67d539 Mon Sep 17 00:00:00 2001 From: Varun Sankar <37424416+sivav1@users.noreply.github.com> Date: Sat, 7 Jul 2018 17:11:44 +1200 Subject: [PATCH 01/10] primary installation configuration --- config.json | 1 + install/config.php | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 config.json create mode 100644 install/config.php diff --git a/config.json b/config.json new file mode 100644 index 0000000..5233996 --- /dev/null +++ b/config.json @@ -0,0 +1 @@ +{"isInstalled":false,"db_host":"localhost","db_username":"root","db_password":"password","db_name":"mytable"} \ No newline at end of file diff --git a/install/config.php b/install/config.php new file mode 100644 index 0000000..e0a6534 --- /dev/null +++ b/install/config.php @@ -0,0 +1,41 @@ +loadConfig(); + } + + public function loadConfig() { + $string = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/catchnz-test/config.json'); + $json_a = json_decode($string, true); + + $this->isInstalled = $json_a['isInstalled']; + $this->db_host = $json_a['db_host']; + $this->db_username = $json_a['db_username']; + $this->db_password = $json_a['db_password']; + $this->db_name = $json_a['db_name']; + } + + public function toJson(){ + return json_encode( + array( + 'isInstalled'=> $this->isInstalled, + 'db_host'=> $this->db_host, + 'db_username'=> $this->db_username, + 'db_password'=> $this->db_password, + 'db_name'=> $this->db_name + )); + } + + public function saveConfig(){ + $fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/catchnz-test/config.json', 'w'); + fwrite($fp, $this->toJson()); + fclose($fp); + } +} +?> \ No newline at end of file From 5a3f188e9098630414b4242c45a138b28fa02db2 Mon Sep 17 00:00:00 2001 From: Varun Sankar <37424416+sivav1@users.noreply.github.com> Date: Sat, 7 Jul 2018 17:12:06 +1200 Subject: [PATCH 02/10] db installation forms and process --- install/form_submit.js | 18 +++++++++++++++++ install/form_submit.php | 24 ++++++++++++++++++++++ install/index.html | 44 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 install/form_submit.js create mode 100644 install/form_submit.php create mode 100644 install/index.html diff --git a/install/form_submit.js b/install/form_submit.js new file mode 100644 index 0000000..4125941 --- /dev/null +++ b/install/form_submit.js @@ -0,0 +1,18 @@ +$(document).ready(function(){ + $('#submit').click(function(){ + var json = { + 'isInstalled': false, + 'db_host': $('#inputHost').val(), + 'db_username': $('#inputUsername').val(), + 'db_password': $('#inputPassword').val(), + 'db_name': $('#inputDBname').val() + } + $.post('form_submit.php',json) + .done(function(data) { + console.log(data); + window.location = '../index.php' + }).fail(function(jqxhr, settings, ex) { + console.log('failed, ' , jqxhr); + }); + }) +}) \ No newline at end of file diff --git a/install/form_submit.php b/install/form_submit.php new file mode 100644 index 0000000..10ad631 --- /dev/null +++ b/install/form_submit.php @@ -0,0 +1,24 @@ +isInstalled = false;//$_POST['isInstalled']; +$config->db_host = $_POST['db_host']; +$config->db_username = $_POST['db_username']; +$config->db_password = $_POST['db_password']; +$config->db_name = $_POST['db_name']; + +$config->saveConfig(); + +if(!$config->isInstalled){ + $conn = mysqli_connect($config->db_host, $config->db_username, $config->db_password); + if (!$conn) { + die("Connection failed: " . mysqli_connect_error()); + } + $sql = "CREATE DATABASE " . $config->db_name; + if (mysqli_query($conn, $sql)) { + mysqli_close($conn); + echo 'success'; + } else { + die "Error creating database: " . mysqli_error($conn); + } + } \ No newline at end of file diff --git a/install/index.html b/install/index.html new file mode 100644 index 0000000..a0f4f51 --- /dev/null +++ b/install/index.html @@ -0,0 +1,44 @@ + + + + + + + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+ + + + + + \ No newline at end of file From 7345132189e67d1ced16210b9e9cc4d7c53ed7cd Mon Sep 17 00:00:00 2001 From: Varun Sankar <37424416+sivav1@users.noreply.github.com> Date: Sat, 7 Jul 2018 17:12:29 +1200 Subject: [PATCH 03/10] database connection class --- db.php | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 db.php diff --git a/db.php b/db.php new file mode 100644 index 0000000..378a9c9 --- /dev/null +++ b/db.php @@ -0,0 +1,63 @@ +connect(); + } + + public function connect(){ + if(!$this->isConnected) + { + $this->conn = @mysql_connect($this->db_host,$this->db_username,$this->db_password); + if($this->conn) + { + $selectdb = @mysql_select_db($this->db_name,$this->conn); + if($selectdb) + { + $this->isConnected = true; + return true; + } else + { + return false; + } + } else + { + return false; + } + } else + { + return true; + } + } + + public function isTableExists($tableName){ + $tablesInDb = @mysql_query('SHOW TABLES FROM '.$this->db_name.' LIKE "'.$tableName.'"'); + if($tablesInDb) + { + if(mysql_num_rows($tablesInDb) == 1) + { + return true; + } + else + { + return false; + } + } + } + + public function create($tablename, $columns){ + $query = "create table if not exists $table ($columns);"; + $res = @mysql_query($query, $this->conn) or die(mysql_error()); + if($this->isTableExists($tableName)){ + return true; + } else { + return false; + } + } + +} +?> \ No newline at end of file From 01ef7ad65202c1bd52c832484c6584a6557ade9c Mon Sep 17 00:00:00 2001 From: Varun Sankar <37424416+sivav1@users.noreply.github.com> Date: Sat, 7 Jul 2018 17:14:52 +1200 Subject: [PATCH 04/10] Model Class --- db.php | 2 +- install/config.php | 4 ++-- install/form_submit.php | 2 +- model/Model.php | 51 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 model/Model.php diff --git a/db.php b/db.php index 378a9c9..ea3b868 100644 --- a/db.php +++ b/db.php @@ -1,5 +1,5 @@ isInstalled = $json_a['isInstalled']; @@ -33,7 +33,7 @@ public function toJson(){ } public function saveConfig(){ - $fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/catchnz-test/config.json', 'w'); + $fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/catchnz_test/config.json', 'w'); fwrite($fp, $this->toJson()); fclose($fp); } diff --git a/install/form_submit.php b/install/form_submit.php index 10ad631..79ba464 100644 --- a/install/form_submit.php +++ b/install/form_submit.php @@ -1,5 +1,5 @@ isInstalled = false;//$_POST['isInstalled']; $config->db_host = $_POST['db_host']; diff --git a/model/Model.php b/model/Model.php new file mode 100644 index 0000000..a112717 --- /dev/null +++ b/model/Model.php @@ -0,0 +1,51 @@ +result = null; + $q = 'SELECT '.$rows.' FROM '.$table; + if($where != null) + $q .= ' WHERE '.$where; + if($order != null) + $q .= ' ORDER BY '.$order; + if($this->isTableExists($table)) + { + $query = @mysql_query($q); + if($query) + { + $this->numResults = mysql_num_rows($query); + for($i = 0; $i < $this->numResults; $i++) + { + $r = mysql_fetch_array($query); + $key = array_keys($r); + for($x = 0; $x < count($key); $x++) + { + if(!is_int($key[$x])) + { + if(mysql_num_rows($query) > 1) + $this->result[$i][$key[$x]] = $r[$key[$x]]; + else if(mysql_num_rows($query) < 1) + $this->result = null; + else + $this->result[$key[$x]] = $r[$key[$x]]; + } + } + } + return true; + } + else + { + return false; + } + } + else + return false; + } +} +?> \ No newline at end of file From 64c253c6c22c1408b33d8e3645afb9cec85ad9f5 Mon Sep 17 00:00:00 2001 From: Varun Sankar <37424416+sivav1@users.noreply.github.com> Date: Sat, 7 Jul 2018 17:24:00 +1200 Subject: [PATCH 05/10] CustomerModel class --- model/CustomerModel.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 model/CustomerModel.php diff --git a/model/CustomerModel.php b/model/CustomerModel.php new file mode 100644 index 0000000..4e7f9d1 --- /dev/null +++ b/model/CustomerModel.php @@ -0,0 +1,36 @@ +db = $db; + } + + public function createTable(){ + $query = "CREATE TABLE IF NOT EXISTS `" . $this->table . "` (\n" + . " `id` int(11) NOT NULL,\n" + . " `first_name` varchar(20) NOT NULL,\n" + . " `last_name` varchar(20) NOT NULL,\n" + . " `email` varchar(100) NOT NULL,\n" + . " `gender` varchar(7) NOT NULL,\n" + . " `ip_address` varchar(23) NOT NULL,\n" + . " `company` varchar(100) NOT NULL,\n" + . " `city` varchar(50) NOT NULL,\n" + . " `title` varchar(100) NOT NULL,\n" + . " `website` text NOT NULL\n" + . ")"; + + $res = @mysql_query($query, $this->conn) or die(mysql_error()); + if($this->isTableExists($this->table)){ + return true; + } else { + return false; + } +} +} +?> \ No newline at end of file From 1dd497e38fc0ecf6123b19a7082c3053b9d6364b Mon Sep 17 00:00:00 2001 From: Varun Sankar <37424416+sivav1@users.noreply.github.com> Date: Sat, 7 Jul 2018 19:53:16 +1200 Subject: [PATCH 06/10] app install directory --- config.json | 2 +- db.php | 25 +++++++++------- install/config.php | 13 +++++++++ install/form_submit.js | 25 ++++++++++------ install/form_submit.php | 4 ++- install/index.html | 44 ---------------------------- install/index.php | 64 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 112 insertions(+), 65 deletions(-) delete mode 100644 install/index.html create mode 100644 install/index.php diff --git a/config.json b/config.json index 5233996..9008ca2 100644 --- a/config.json +++ b/config.json @@ -1 +1 @@ -{"isInstalled":false,"db_host":"localhost","db_username":"root","db_password":"password","db_name":"mytable"} \ No newline at end of file +{"isInstalled":false,"db_host":"","db_username":"","db_password":"","db_name":""} \ No newline at end of file diff --git a/db.php b/db.php index ea3b868..062728b 100644 --- a/db.php +++ b/db.php @@ -1,5 +1,10 @@ connect(); } + // mysql connecting method + /** + * connect to mysql db with the given parameters + */ public function connect(){ if(!$this->isConnected) { @@ -34,6 +43,11 @@ public function connect(){ } } + // table existance checking ... + /** + * Lchecks if table exists in database + * @param {?string} tableName - name of table to check + */ public function isTableExists($tableName){ $tablesInDb = @mysql_query('SHOW TABLES FROM '.$this->db_name.' LIKE "'.$tableName.'"'); if($tablesInDb) @@ -48,16 +62,5 @@ public function isTableExists($tableName){ } } } - - public function create($tablename, $columns){ - $query = "create table if not exists $table ($columns);"; - $res = @mysql_query($query, $this->conn) or die(mysql_error()); - if($this->isTableExists($tableName)){ - return true; - } else { - return false; - } - } - } ?> \ No newline at end of file diff --git a/install/config.php b/install/config.php index 25de27e..b985a8e 100644 --- a/install/config.php +++ b/install/config.php @@ -1,4 +1,9 @@ loadConfig(); } + // loads config from file ... + /** + * loads config from file + */ public function loadConfig() { $string = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/catchnz_test/config.json'); $json_a = json_decode($string, true); @@ -32,6 +41,10 @@ public function toJson(){ )); } + // saves cofig into file ... + /** + * saves config into file + */ public function saveConfig(){ $fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/catchnz_test/config.json', 'w'); fwrite($fp, $this->toJson()); diff --git a/install/form_submit.js b/install/form_submit.js index 4125941..6353711 100644 --- a/install/form_submit.js +++ b/install/form_submit.js @@ -1,5 +1,14 @@ -$(document).ready(function(){ - $('#submit').click(function(){ + // ... + /** + * calls on submit button click + */ +$(document).ready(function () { + $('#btnSubmit').click(function () { + if($('#inputHost').val().lenght <= 0 || $('#inputUsername').val().length <= 0 || + $('#inputPassword').val().length <= 0 || $('#inputDBname').val().length <= 0) { + alert("Please fill all fields..!!"); + return; + } var json = { 'isInstalled': false, 'db_host': $('#inputHost').val(), @@ -7,12 +16,12 @@ $(document).ready(function(){ 'db_password': $('#inputPassword').val(), 'db_name': $('#inputDBname').val() } - $.post('form_submit.php',json) - .done(function(data) { + $.post('form_submit.php', json) + .done(function (data) { console.log(data); window.location = '../index.php' - }).fail(function(jqxhr, settings, ex) { - console.log('failed, ' , jqxhr); + }).fail(function (jqxhr, settings, ex) { + console.log('failed, ', jqxhr); }); - }) -}) \ No newline at end of file + }); +}); \ No newline at end of file diff --git a/install/form_submit.php b/install/form_submit.php index 79ba464..31cd623 100644 --- a/install/form_submit.php +++ b/install/form_submit.php @@ -17,8 +17,10 @@ $sql = "CREATE DATABASE " . $config->db_name; if (mysqli_query($conn, $sql)) { mysqli_close($conn); + $config->isInstalled = true; + $config->saveConfig(); echo 'success'; } else { - die "Error creating database: " . mysqli_error($conn); + echo "Error creating database: " . mysqli_error($conn); } } \ No newline at end of file diff --git a/install/index.html b/install/index.html deleted file mode 100644 index a0f4f51..0000000 --- a/install/index.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
- -
-
-
- - - - - - \ No newline at end of file diff --git a/install/index.php b/install/index.php new file mode 100644 index 0000000..2ebd1fc --- /dev/null +++ b/install/index.php @@ -0,0 +1,64 @@ +isInstalled){ + header('Location: ../index.php'); +} +?> + + + + + + + + + +
+
+

Enter Database Details

+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+ + + + + + + + \ No newline at end of file From c74ef9677ce94577e03c3722786c37bf46624884 Mon Sep 17 00:00:00 2001 From: Varun Sankar <37424416+sivav1@users.noreply.github.com> Date: Sat, 7 Jul 2018 19:55:17 +1200 Subject: [PATCH 07/10] Csutomer service and model class --- CustomerService/CustomerService.php | 5 +++ CustomerService/CustomerServiceHandler.php | 30 +++++++++++++++ CustomerService/RESTService.php | 27 +++++++++++++ model/CustomerModel.php | 44 +++++++++++++--------- model/Model.php | 13 +++++++ 5 files changed, 101 insertions(+), 18 deletions(-) create mode 100644 CustomerService/CustomerService.php create mode 100644 CustomerService/CustomerServiceHandler.php create mode 100644 CustomerService/RESTService.php diff --git a/CustomerService/CustomerService.php b/CustomerService/CustomerService.php new file mode 100644 index 0000000..4bba8e6 --- /dev/null +++ b/CustomerService/CustomerService.php @@ -0,0 +1,5 @@ +getCustomers(); +?> \ No newline at end of file diff --git a/CustomerService/CustomerServiceHandler.php b/CustomerService/CustomerServiceHandler.php new file mode 100644 index 0000000..152bafe --- /dev/null +++ b/CustomerService/CustomerServiceHandler.php @@ -0,0 +1,30 @@ +model = new CustomerModel(); + $this->model->select('customer'); + $rawData = $this->model->result; + + if(empty($rawData)) { + $statusCode = 404; + $rawData = array('error' => 'No results found!'); + } else { + $statusCode = 200; + } + + $requestContentType = $_SERVER['HTTP_ACCEPT']; + $this ->setHttpHeaders($requestContentType, $statusCode); + + $response = json_encode($rawData); + echo $response; + } +} +?> \ No newline at end of file diff --git a/CustomerService/RESTService.php b/CustomerService/RESTService.php new file mode 100644 index 0000000..8ea005e --- /dev/null +++ b/CustomerService/RESTService.php @@ -0,0 +1,27 @@ + getHttpStatusMessage($statusCode); + + header($this->httpVersion. " ". $statusCode ." ". $statusMessage); + header("Content-Type:". $contentType); + } + + public function getHttpStatusMessage($statusCode){ + $httpStatus = array( + 200 => 'OK', + 204 => 'No Content', + 404 => 'Not Found', + 500 => 'Internal Server Error'); + return ($httpStatus[$statusCode]) ? $httpStatus[$statusCode] : $status[500]; + } +} +?> \ No newline at end of file diff --git a/model/CustomerModel.php b/model/CustomerModel.php index 4e7f9d1..033535b 100644 --- a/model/CustomerModel.php +++ b/model/CustomerModel.php @@ -1,6 +1,10 @@ db = $db; } + // creates table for CustomerModel + /** + * creates table for customer model + */ public function createTable(){ - $query = "CREATE TABLE IF NOT EXISTS `" . $this->table . "` (\n" - . " `id` int(11) NOT NULL,\n" - . " `first_name` varchar(20) NOT NULL,\n" - . " `last_name` varchar(20) NOT NULL,\n" - . " `email` varchar(100) NOT NULL,\n" - . " `gender` varchar(7) NOT NULL,\n" - . " `ip_address` varchar(23) NOT NULL,\n" - . " `company` varchar(100) NOT NULL,\n" - . " `city` varchar(50) NOT NULL,\n" - . " `title` varchar(100) NOT NULL,\n" - . " `website` text NOT NULL\n" - . ")"; + $query = "CREATE TABLE IF NOT EXISTS `" . $this->table . "` (\n" + . " `id` int(11) NOT NULL,\n" + . " `first_name` varchar(20) NOT NULL,\n" + . " `last_name` varchar(20) NOT NULL,\n" + . " `email` varchar(100) NOT NULL,\n" + . " `gender` varchar(7) NOT NULL,\n" + . " `ip_address` varchar(23) NOT NULL,\n" + . " `company` varchar(100) NOT NULL,\n" + . " `city` varchar(50) NOT NULL,\n" + . " `title` varchar(100) NOT NULL,\n" + . " `website` text NOT NULL\n" + . ")"; - $res = @mysql_query($query, $this->conn) or die(mysql_error()); - if($this->isTableExists($this->table)){ - return true; - } else { - return false; + $res = @mysql_query($query, $this->conn) or die(mysql_error()); + if($this->isTableExists($this->table)){ + return true; + } else { + return false; + } } } -} ?> \ No newline at end of file diff --git a/model/Model.php b/model/Model.php index a112717..832e27e 100644 --- a/model/Model.php +++ b/model/Model.php @@ -1,11 +1,24 @@ result = null; From 571e632775a059b3de1f066b3c9c01805b7c074d Mon Sep 17 00:00:00 2001 From: Varun Sankar <37424416+sivav1@users.noreply.github.com> Date: Sat, 7 Jul 2018 19:56:31 +1200 Subject: [PATCH 08/10] CSV Importer class, CustomerList view and controller --- CSVImporter.php | 33 ++++++++++++++++++ CustomerService/CustomerImportService.php | 6 ++++ controller/CustomerController.php | 33 ++++++++++++++++++ controller/CustomerListController.js | 23 +++++++++++++ view/CustomerListView.js | 25 ++++++++++++++ view/CustomerView.php | 41 +++++++++++++++++++++++ 6 files changed, 161 insertions(+) create mode 100644 CSVImporter.php create mode 100644 CustomerService/CustomerImportService.php create mode 100644 controller/CustomerController.php create mode 100644 controller/CustomerListController.js create mode 100644 view/CustomerListView.js create mode 100644 view/CustomerView.php diff --git a/CSVImporter.php b/CSVImporter.php new file mode 100644 index 0000000..18ef17f --- /dev/null +++ b/CSVImporter.php @@ -0,0 +1,33 @@ +isTableExists($tableName)) { + mysql_query( ' + LOAD DATA LOCAL INFILE "'.$file.'" + INTO TABLE `' . $tableName . '` + FIELDS TERMINATED by \',\' + LINES TERMINATED BY \'\n\' + IGNORE 1 LINES + ', $this->conn)or die(mysql_error()); + } else { + die("Internal Error in imporing CSV...!!"); + } + } +} +?> \ No newline at end of file diff --git a/CustomerService/CustomerImportService.php b/CustomerService/CustomerImportService.php new file mode 100644 index 0000000..ffd9159 --- /dev/null +++ b/CustomerService/CustomerImportService.php @@ -0,0 +1,6 @@ +importCSV(); +echo 'success'; diff --git a/controller/CustomerController.php b/controller/CustomerController.php new file mode 100644 index 0000000..8526474 --- /dev/null +++ b/controller/CustomerController.php @@ -0,0 +1,33 @@ +cModel = new CustomerModel(); + $this->file = $_SERVER['DOCUMENT_ROOT'] . '/catchnz_test/data/customers.csv'; + } + + public function render(){ + include ($_SERVER['DOCUMENT_ROOT'] . '/catchnz_test/view/CustomerView.php'); + } + + public function getCustomers() { + $cList = $this->cModel->getAllCustomers(); + return cList; + } + + public function importCSV(){ + $this->cModel->createTable(); + $csv = new CSVImporter(); + $csv->importCSV($this->file, 'customer'); + } +} +?> \ No newline at end of file diff --git a/controller/CustomerListController.js b/controller/CustomerListController.js new file mode 100644 index 0000000..b948b2f --- /dev/null +++ b/controller/CustomerListController.js @@ -0,0 +1,23 @@ +import {renderCustomerList} from '../view/CustomerListView.js'; +$(document).ready(function(){ + $('#btnLoad').click(function(){ + $(this).val('Loading...'); + $.post(window.location.href.match(/^.*\//) + '/CustomerService/CustomerService.php',) + .done(function(data) { + var jsonObj = JSON.parse(data); + renderCustomerList(jsonObj, '#table'); + }).fail(function(jqxhr, settings, ex) { + console.log('failed, ' , jqxhr); + $('#table').html("No data found..!!"); + }); + }); + $('#buttonImport').click(function(){ + $(this).val('Loading...'); + $.post(window.location.href.match(/^.*\//) + '/CustomerService/CustomerImportService.php',) + .done(function(data) { + alert("Successfully Imported data..!!"); + }).fail(function(jqxhr, settings, ex) { + alert(failed, + jqxhr); + }); + }); +}); \ No newline at end of file diff --git a/view/CustomerListView.js b/view/CustomerListView.js new file mode 100644 index 0000000..5d5a8f0 --- /dev/null +++ b/view/CustomerListView.js @@ -0,0 +1,25 @@ + // customer list rendering method ... + /** + * renders the customer list into given html table container + * @param {?json object} c_json_list - the customer list json object array + * @param {?string} render_container - the container id or class + */ + export function renderCustomerList (c_json_list, render_container) { + var customer = c_json_list[0]; + var columns = []; + for(var property in customer){ + columns.push({ + data: property + }) + } + if ($.fn.dataTable.isDataTable(render_container)) { + table = $(render_container).DataTable(); + } + else { + $(render_container).DataTable({ + data: c_json_list, + "processing": true, + columns: columns, + }); + } + } \ No newline at end of file diff --git a/view/CustomerView.php b/view/CustomerView.php new file mode 100644 index 0000000..ee28bf3 --- /dev/null +++ b/view/CustomerView.php @@ -0,0 +1,41 @@ + + + + + + + +
+
+
+ + +
+
+ + + + + + + + + + + + + + + +
IDFirst NameLast NameEmailGenderIP AddressCompanyCityTitleWebsite
+
+ + + + + + + + + + \ No newline at end of file From 46ac51f3b09a594b9ade1da45d0b9996238dfc05 Mon Sep 17 00:00:00 2001 From: Varun Sankar <37424416+sivav1@users.noreply.github.com> Date: Sat, 7 Jul 2018 19:56:42 +1200 Subject: [PATCH 09/10] index file --- index.php | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 index.php diff --git a/index.php b/index.php new file mode 100644 index 0000000..c1107d7 --- /dev/null +++ b/index.php @@ -0,0 +1,11 @@ +isInstalled){ + header('Location: ./install/index.php'); +} + +$controller = new CustomerController(); +$controller->render(); From 829cf8d9af098154a25751df180ba23c2da8eb5b Mon Sep 17 00:00:00 2001 From: Varun Sankar <37424416+sivav1@users.noreply.github.com> Date: Sat, 7 Jul 2018 20:06:44 +1200 Subject: [PATCH 10/10] updated readme with instructions --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 9b8767a..9dfb366 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,15 @@ A simple test for PHP / JavaScript Developers +## Instruction +1. The project files should be inside catchnz-test directory +2. Navigate to http://domain-name/catchnz_test/index.php after uploading to server +3. Enter database host, username, password and database name in the form when asked +4. Once the installation is finished, it will be redirected to the home page +5. click on "Import CSV Data" button to import data from CSV file to database +6. Click on "Show Customers" button to load imported data from database +7. I used MySQL DB + ## Instructions 1. Fork or clone this repo