diff --git a/.htaccess b/.htaccess new file mode 100755 index 00000000..dbed322f --- /dev/null +++ b/.htaccess @@ -0,0 +1,49 @@ +# Disable directory browsing +Options -Indexes + +# ---------------------------------------------------------------------- +# Rewrite engine +# ---------------------------------------------------------------------- + +# Turning on the rewrite engine is necessary for the following rules and features. +# FollowSymLinks must be enabled for this to work. + + Options +FollowSymlinks + RewriteEngine On + + # If you installed CodeIgniter in a subfolder, you will need to + # change the following line to match the subfolder you need. + # http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase + # RewriteBase / + + # Redirect Trailing Slashes... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_URI} (.+)/$ + RewriteRule ^ %1 [L,R=301] + + # Rewrite "www.example.com -> example.com" + RewriteCond %{HTTPS} !=on + RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] + RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] + + # Checks to see if the user is attempting to access a valid file, + # such as an image or css document, if this isn't true it sends the + # request to the front controller, index.php + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA] + + # Ensure Authorization header is passed along + RewriteCond %{HTTP:Authorization} . + RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + + + + # If we don't have mod_rewrite installed, all 404's + # can be sent to index.php, and everything works as normal. + ErrorDocument 404 index.php + + +# Disable server signature start + ServerSignature Off +# Disable server signature end diff --git a/app/.htaccess b/app/.htaccess deleted file mode 100755 index f24db0ac..00000000 --- a/app/.htaccess +++ /dev/null @@ -1,6 +0,0 @@ - - Require all denied - - - Deny from all - diff --git a/app/Config/App.php b/app/Config/App.php index f04703ba..52b2a310 100755 --- a/app/Config/App.php +++ b/app/Config/App.php @@ -17,7 +17,9 @@ class App extends BaseConfig * * http://example.com/ */ - public string $baseURL = 'http://localhost:8080/'; + // public string $baseURL = 'http://localhost:8080/'; + public string $baseURL = 'http://localhost/vb_book/'; + // public string $baseURL = 'http://localhost/vb_book/public/'; /** * Allowed Hostnames in the Site URL other than the hostname in the baseURL. @@ -42,7 +44,8 @@ class App extends BaseConfig * something else. If you are using mod_rewrite to remove the page set this * variable so that it is blank. */ - public string $indexPage = 'index.php'; + // public string $indexPage = 'index.php'; + public string $indexPage = ''; /** * -------------------------------------------------------------------------- @@ -59,7 +62,9 @@ class App extends BaseConfig * * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! */ - public string $uriProtocol = 'REQUEST_URI'; + // public string $uriProtocol = 'REQUEST_URI'; + public $uriProtocol = 'PATH_INFO'; + /** * -------------------------------------------------------------------------- diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 8108d28f..245b5619 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -11,7 +11,7 @@ $routes = Services::routes(); * -------------------------------------------------------------------- */ $routes->setDefaultNamespace('App\Controllers'); -$routes->setDefaultController('Home'); +$routes->setDefaultController('Authentication'); $routes->setDefaultMethod('index'); $routes->setTranslateURIDashes(false); $routes->set404Override(); @@ -29,7 +29,9 @@ $routes->set404Override(); // We get a performance increase by specifying the default // route since we don't have to scan directories. -$routes->get('/', 'Home::index'); +$routes->get('/', 'Authentication::index'); +$routes->post('login/', 'Authentication::login'); + $routes->get('dashboard/', 'Home::index'); $routes->get("user_list/", "Home::user_list"); $routes->get("add_user/", "Home::add_user"); @@ -42,6 +44,7 @@ $routes->get("add_subscribers/", "Home::add_subscribers"); $routes->get("edit_subscribers/", "Home::edit_subscribers"); $routes->get("business_list/", "Business::add_bussiness"); $routes->get("new_bussiness/", "Business::new_bussiness"); +$routes->get('dashboard/', 'Home::auth_user'); diff --git a/app/Controllers/Authentication.php b/app/Controllers/Authentication.php new file mode 100755 index 00000000..211ac50d --- /dev/null +++ b/app/Controllers/Authentication.php @@ -0,0 +1,54 @@ + 'required', + 'password' => 'required', + ]; + if ($this->validate($rules)) { + // Process login logic + $username = $this->request->getPost('username'); + $password = $this->request->getPost('password'); + + // You can implement your authentication logic here + // For example, check against a database, validate credentials, etc. + if ($this->authenticate($username, $password)) { + // Redirect to a dashboard or other protected area + return redirect()->to('dashboard'); + } else { + // Invalid credentials, display error message + return redirect()->back()->with('error', 'Invalid username or password.'); + } + }else { + // Validation failed, display errors + return redirect()->back()->withInput()->with('validation', $validation); + } + } + + // Example authentication method, replace with your own logic + private function authenticate($username, $password) + { + // Implement your authentication logic here + // Return true if authentication is successful, false otherwise + // For example, you can compare against a database record + return ($username === 'admin@vbbook.com' && $password === 'test1234'); + } +} \ No newline at end of file diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 7042ee4f..53f2264f 100755 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -1,7 +1,7 @@ + + + + <?= $browser_title; ?> + + + + + + "> + + + " rel="stylesheet" type="text/css" id="bs-default-stylesheet" /> + " rel="stylesheet" type="text/css" id="app-default-stylesheet" /> + + " rel="stylesheet" type="text/css" id="bs-dark-stylesheet" /> + " rel="stylesheet" type="text/css" id="app-dark-stylesheet" /> + + + " rel="stylesheet" type="text/css" /> + + + + + +
+
+
+
+
+ +
+ +
+ +

Enter your email address and password to access admin panel.

+
+ + +
" method="post"> + + + + +
+ + +
+ +
+ +
+ +
+
+ +
+
+
+
+ +
+
+ + +
+
+ +
+ +
+ +
+
+
+ + +
+
+

Forgot your password?

+

Don't have an account? Sign Up

+
+
+ + +
+
+ +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/app/Views/template/footer.php b/app/Views/template/footer.php index 591d4303..5dd554c2 100755 --- a/app/Views/template/footer.php +++ b/app/Views/template/footer.php @@ -100,7 +100,7 @@
- user-pic + " class="rounded-circle avatar-sm" alt="user-pic">
Andrew Mackie
@@ -115,7 +115,7 @@
- user-pic + " class="rounded-circle avatar-sm" alt="user-pic">
Rory Dalyell
@@ -130,7 +130,7 @@
- user-pic + " class="rounded-circle avatar-sm" alt="user-pic">
Jaxon Dunhill
@@ -149,7 +149,7 @@
- user-pic + " class="rounded-circle avatar-sm" alt="user-pic">
Jackson Therry
@@ -164,7 +164,7 @@
- user-pic + " class="rounded-circle avatar-sm" alt="user-pic">
Charles Deakin
@@ -179,7 +179,7 @@
- user-pic + " class="rounded-circle avatar-sm" alt="user-pic">
Ryan Salting
@@ -194,7 +194,7 @@
- user-pic + " class="rounded-circle avatar-sm" alt="user-pic">
Sean Howse
@@ -209,7 +209,7 @@
- user-pic + " class="rounded-circle avatar-sm" alt="user-pic">
Dean Coward
@@ -224,7 +224,7 @@
- user-pic + " class="rounded-circle avatar-sm" alt="user-pic">
Hayley East
@@ -431,41 +431,41 @@
- + - + - + - - + + - + - - - - - - - - - - - - - + + + + + + + + + + + + + - + - + diff --git a/app/Views/template/header.php b/app/Views/template/header.php index 2b4c23ca..a2b9aa5d 100755 --- a/app/Views/template/header.php +++ b/app/Views/template/header.php @@ -8,27 +8,27 @@ - - + " > + - + " rel="stylesheet" type="text/css" /> - - - - + " rel="stylesheet" type="text/css" /> + " rel="stylesheet" type="text/css" /> + " rel="stylesheet" type="text/css" /> + " rel="stylesheet" type="text/css" /> - - + " rel="stylesheet" type="text/css" id="bs-default-stylesheet" /> + " rel="stylesheet" type="text/css" id="app-default-stylesheet" /> - - + " rel="stylesheet" type="text/css" id="bs-dark-stylesheet" /> + " rel="stylesheet" type="text/css" id="app-dark-stylesheet" /> - + " rel="stylesheet" type="text/css" /> @@ -71,7 +71,7 @@
- user-img" alt="user-img" title="Mat Helme" class="rounded-circle avatar-md">