From 0afcce32f7d1112b953e0dcf6528c6be90092ed9 Mon Sep 17 00:00:00 2001 From: Hari Govind S Date: Sun, 3 Feb 2019 13:08:46 +0530 Subject: [PATCH 1/8] Use site_url() instead of base_url() in links --- application/views/includes/header.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/application/views/includes/header.php b/application/views/includes/header.php index 4aaf4f9..3c6093f 100644 --- a/application/views/includes/header.php +++ b/application/views/includes/header.php @@ -93,20 +93,20 @@ diff --git a/application/views/pages/home.php b/application/views/pages/home.php index 8998b48..0fde737 100644 --- a/application/views/pages/home.php +++ b/application/views/pages/home.php @@ -5,7 +5,7 @@

An exciting online treasure hunt

Start playing, and think harder!

-

Login with Facebook

+

Login with Facebook

@@ -13,12 +13,12 @@

Leaderboard

Keep track of your competitors.

-

View Leaderboard »

+

View Leaderboard »

Winners

The determined ones.

-

Winners »

+

Winners »

Tathva

diff --git a/application/views/pages/wait.php b/application/views/pages/wait.php index c653442..358dbc3 100644 --- a/application/views/pages/wait.php +++ b/application/views/pages/wait.php @@ -11,12 +11,12 @@

Leaderboard

Keep track of your competitors.

-

View Leaderboard »

+

View Leaderboard »

Winners

The determined ones.

-

Winners »

+

Winners »

Tathva

From 71decef94289b271bedc9b56c23115afdb540144 Mon Sep 17 00:00:00 2001 From: Hari Govind S Date: Sun, 3 Feb 2019 16:13:06 +0530 Subject: [PATCH 3/8] Capitalsed class names as required by CI3 --- application/controllers/{home.php => Home.php} | 0 application/controllers/{nimda.php => Nimda.php} | 2 +- application/models/{admin_model.php => Admin_model.php} | 2 +- application/models/{levels_model.php => Levels_model.php} | 2 +- application/models/{status_model.php => Status_model.php} | 2 +- application/models/{user_model.php => User_model.php} | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) rename application/controllers/{home.php => Home.php} (100%) rename application/controllers/{nimda.php => Nimda.php} (99%) rename application/models/{admin_model.php => Admin_model.php} (99%) rename application/models/{levels_model.php => Levels_model.php} (98%) rename application/models/{status_model.php => Status_model.php} (98%) rename application/models/{user_model.php => User_model.php} (99%) diff --git a/application/controllers/home.php b/application/controllers/Home.php similarity index 100% rename from application/controllers/home.php rename to application/controllers/Home.php diff --git a/application/controllers/nimda.php b/application/controllers/Nimda.php similarity index 99% rename from application/controllers/nimda.php rename to application/controllers/Nimda.php index 5502722..b24d995 100644 --- a/application/controllers/nimda.php +++ b/application/controllers/Nimda.php @@ -1,6 +1,6 @@ Date: Sun, 3 Feb 2019 16:36:14 +0530 Subject: [PATCH 4/8] Modified config.php to use new session options of CI3 --- application/config/config.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index 38c7091..3f9aea5 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -16,7 +16,7 @@ */ //Please change to your installation folder, with a trailing / (slash) -$config['base_url'] = 'http://localhost/'; +$config['base_url'] = 'http://localhost/hunt/Treasure-Hunt/'; /* |-------------------------------------------------------------------------- @@ -29,7 +29,7 @@ | */ // $config['index_page'] = 'index.php'; -$config['index_page'] = ''; +$config['index_page'] = 'index.php'; /* |-------------------------------------------------------------------------- @@ -252,11 +252,12 @@ | 'sess_time_to_update' = how many seconds between CI refreshing Session Information | */ + +$config['sess_driver'] = 'database'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_expire_on_close'] = FALSE; $config['sess_encrypt_cookie'] = TRUE; -$config['sess_use_database'] = TRUE; $config['sess_table_name'] = 'ci_sessions'; $config['sess_match_ip'] = TRUE; $config['sess_match_useragent'] = TRUE; From a202a5a0e1a4c53ea537f2762e24318c8f4bff62 Mon Sep 17 00:00:00 2001 From: Hari Govind S Date: Sun, 3 Feb 2019 16:38:57 +0530 Subject: [PATCH 5/8] Edited database.php to use query builder and mysqli --- application/config/database.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/config/database.php b/application/config/database.php index 7ad781a..e05bf9d 100644 --- a/application/config/database.php +++ b/application/config/database.php @@ -46,19 +46,19 @@ */ $active_group = 'default'; -$active_record = TRUE; +$query_builder = TRUE; //database details - change these to the correct values $db['default']['hostname'] = 'localhost'; -$db['default']['username'] = 'root'; -$db['default']['password'] = ''; +$db['default']['username'] = 'treasure_user'; +$db['default']['password'] = 'treasure_password'; $db['default']['database'] = 'treasurehunt'; //standard CI database details -$db['default']['dbdriver'] = 'mysql'; +$db['default']['dbdriver'] = 'mysqli'; $db['default']['dbprefix'] = ''; -$db['default']['pconnect'] = TRUE; +$db['default']['pconnect'] = FALSE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; From 0cffc4bc99e9f9529d392e0ad7f2883e49f83e44 Mon Sep 17 00:00:00 2001 From: Hari Govind S Date: Sun, 3 Feb 2019 17:00:50 +0530 Subject: [PATCH 6/8] Replaced base_url() with site_url() in relevant places --- application/controllers/Home.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/controllers/Home.php b/application/controllers/Home.php index 6bd3a2a..35fb514 100644 --- a/application/controllers/Home.php +++ b/application/controllers/Home.php @@ -101,7 +101,7 @@ public function login() { 'role' => $role )); - redirect(base_url(), 'location'); + redirect(site_url('login')); }else{ //0 was returned. could be some error with Facebook API //return to home page, and let the user try logging in again, after logging out @@ -110,7 +110,7 @@ public function login() { }else{ $facebook = $this->facebook->instance->getRedirectLoginHelper(); $permissions = ['email']; - $loginUrl = $facebook->getLoginUrl(base_url().'login', $permissions); + $loginUrl = $facebook->getLoginUrl(site_url('login'), $permissions); //redirect to Facebook to authenticate redirect($loginUrl); From f215e227967acc22eb5e88147bfef720ab929d94 Mon Sep 17 00:00:00 2001 From: Hari Govind S Date: Sun, 3 Feb 2019 17:08:52 +0530 Subject: [PATCH 7/8] Replaced old sql escape function with new one --- application/models/Levels_model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/models/Levels_model.php b/application/models/Levels_model.php index 546a7e1..035393f 100644 --- a/application/models/Levels_model.php +++ b/application/models/Levels_model.php @@ -76,8 +76,8 @@ function check_answer($answer){ 'fb_uid' => $fb_uid, 'fb_name' => $fb_name, 'level' => $current_level, - 'answer' => mysql_real_escape_string($answer), - 'ip' => mysql_real_escape_string($_SERVER['REMOTE_ADDR']) + 'answer' => $this->db->escape($answer), + 'ip' => $this->db->escape($_SERVER['REMOTE_ADDR']) ); $this->db->insert('log_answers',$log); From 6ea769b35ffe709c896abdfb3bcccea331193040 Mon Sep 17 00:00:00 2001 From: Hari Govind S Date: Sun, 3 Feb 2019 17:13:34 +0530 Subject: [PATCH 8/8] Updated SQL schema to match new Session Library of CI3 --- tables.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tables.sql b/tables.sql index 5376e2f..2b112ee 100644 --- a/tables.sql +++ b/tables.sql @@ -81,13 +81,13 @@ CREATE TABLE IF NOT EXISTS `users` ( CREATE TABLE IF NOT EXISTS `ci_sessions` ( - `session_id` varchar(40) NOT NULL DEFAULT '0', + `id` varchar(40) NOT NULL DEFAULT '0', `ip_address` varchar(45) NOT NULL DEFAULT '0', `user_agent` varchar(120) NOT NULL, - `last_activity` int(10) unsigned NOT NULL DEFAULT '0', - `user_data` text NOT NULL, - PRIMARY KEY (`session_id`), - KEY `last_activity_idx` (`last_activity`) + `timestamp` int(10) unsigned NOT NULL DEFAULT 0, + `data` blob NOT NULL, + PRIMARY KEY (`id`), + KEY `last_activity_idx` (`timestamp`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;