diff --git a/.gitignore b/.gitignore
old mode 100644
new mode 100755
index b24d71e2..d2d320a4
--- a/.gitignore
+++ b/.gitignore
@@ -23,17 +23,24 @@ dist/
target/
dist/
-# JetBrains IDE
+# IDE and editor files
.idea/
+*.sublime-*
+*.swp
+.vscode/
# Unit test reports
TEST*.xml
-# Generated by MacOS
+# OS X
.DS_Store
+.AppleDouble
+.LSOverride
-# Generated by Windows
+# Windows image file caches
Thumbs.db
+ehthumbs.db
+Desktop.ini
# Applications
*.app
@@ -48,3 +55,47 @@ Thumbs.db
*.mov
*.wmv
+#-------------------------
+# Environment Files
+#-------------------------
+# These should never be under version control,
+# as it poses a security risk.
+.env
+.vagrant
+
+#-------------------------
+# Temporary Files
+#-------------------------
+writable/cache/*
+!writable/cache/index.html
+
+writable/logs/*
+!writable/logs/index.html
+
+writable/session/*
+!writable/session/index.html
+
+writable/uploads/*
+!writable/uploads/index.html
+
+writable/debugbar/*
+!writable/debugbar/.gitkeep
+
+writable/**/*.db
+writable/**/*.sqlite
+
+php_errors.log
+
+
+#-------------------------
+# Composer
+#-------------------------
+vendor/
+composer.lock
+
+tests
+
+# Don't save phpunit under version control.
+phpunit
+phpunit*.xml
+/.phpunit.*.cache
\ No newline at end of file
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/Config/App.php b/app/Config/App.php
index c8a7859a..3e5bac58 100644
--- a/app/Config/App.php
+++ b/app/Config/App.php
@@ -17,7 +17,13 @@ class App extends BaseConfig
*
* http://example.com/
*/
+<<<<<<< HEAD
public string $baseURL = 'http://localhost/vb_book/public/';
+=======
+ // public string $baseURL = 'http://localhost:8080/';
+ public string $baseURL = 'http://localhost/vb_book/';
+ // public string $baseURL = 'http://localhost/vb_book/public/';
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
/**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.
@@ -42,7 +48,12 @@ class App extends BaseConfig
* something else. If you are using mod_rewrite to remove the page set this
* variable so that it is blank.
*/
+<<<<<<< HEAD
public string $indexPage = 'index.php';
+=======
+ // public string $indexPage = 'index.php';
+ public string $indexPage = '';
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
/**
* --------------------------------------------------------------------------
@@ -59,7 +70,13 @@ class App extends BaseConfig
*
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
+<<<<<<< HEAD
public string $uriProtocol = 'REQUEST_URI';
+=======
+ // public string $uriProtocol = 'REQUEST_URI';
+ public $uriProtocol = 'PATH_INFO';
+
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
/**
* --------------------------------------------------------------------------
diff --git a/app/Config/Database.php b/app/Config/Database.php
index ad54d774..968503fb 100644
--- a/app/Config/Database.php
+++ b/app/Config/Database.php
@@ -26,7 +26,11 @@ class Database extends Config
*/
public array $default = [
'DSN' => '',
+<<<<<<< HEAD
'hostname' => '',
+=======
+ 'hostname' => 'localhost',
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
'username' => '',
'password' => '',
'database' => '',
diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index e61be23c..7addeb19 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -11,7 +11,11 @@ $routes = Services::routes();
* --------------------------------------------------------------------
*/
$routes->setDefaultNamespace('App\Controllers');
+<<<<<<< HEAD
$routes->setDefaultController('Home');
+=======
+$routes->setDefaultController('Authentication');
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
@@ -29,6 +33,7 @@ $routes->set404Override();
// We get a performance increase by specifying the default
// route since we don't have to scan directories.
+<<<<<<< HEAD
$routes->get('/', 'Home::index');
$routes->get('dashboard/', 'Home::index');
$routes->get("user_list/", "Home::user_list");
@@ -37,12 +42,37 @@ $routes->get("edit_user/", "Home::edit_user");
$routes->get("book_list/", "Home::book_list");
$routes->get("add_book/", "Home::add_book");
$routes->get("edit_book/", "Home::edit_book");
+=======
+
+# Authentication Routes
+$routes->get('/', 'Authentication::index');
+$routes->get('login/', 'Authentication::index');
+$routes->post('authenticate/', 'Authentication::authenticate');
+$routes->get('logout/', 'Authentication::logout');
+
+# Dashboard Routes
+$routes->get('dashboard/', 'Home::index');
+
+# Users Routes
+$routes->get("user_list/", "Users::index");
+$routes->get("user_page/(:any)", "Users::user_page/$1");
+$routes->post("user_synchronization", "Users::user_synchronization");
+
+# Books Routes
+$routes->get("book_list/", "Books::index");
+$routes->get("add_book/", "Books::add_book");
+$routes->get("edit_book/", "Books::edit_book");
+
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
$routes->get("subscribers_list/", "Home::subscribers_list");
$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");
+<<<<<<< HEAD
$routes->post("insert_business/", "Business::insert_business");
+=======
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
diff --git a/app/Controllers/Authentication.php b/app/Controllers/Authentication.php
new file mode 100755
index 00000000..74833057
--- /dev/null
+++ b/app/Controllers/Authentication.php
@@ -0,0 +1,142 @@
+ 'required',
+ 'password' => 'required',
+ ];
+ if ($this->validate($rules)) {
+
+ $username = $this->request->getPost('username');
+ $password = $this->request->getPost('password');
+
+ $user = $auth_model->where('email', $username)->first();
+
+ if(is_null($user)) {
+ return redirect()->back()->with('error', 'Invalid username or password.');
+ }
+
+ $pwd_verify = password_verify((string)$password, $user['password']);
+
+ if(!$pwd_verify) {
+ return redirect()->back()->with('error', 'Invalid username or password.');
+ }
+
+ // You can implement your authentication logic here
+ // For example, check against a database, validate credentials, etc.
+ if ($username === $user['email'] && $pwd_verify) {
+
+ // Redirect to a dashboard or other protected area
+ $session = \Config\Services::session();
+ $session->set('user_id', $user['user_id']);
+ $session->set('user_name', $user['first_name']." ".$user['last_name']);
+ $session->set('user_role', $user['role']);
+ $session->set('business_id', $user['business_id']);
+
+ // $cookie = \Config\Services::cookie();
+ // $cookie->setCookie('remember_username', 'Sri Harsha', 3600); // Cookie expires in 1 hour
+
+ 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);
+ }
+ }
+
+
+ public function logout()
+ {
+
+ // Clear session and cookies
+ $session = \Config\Services::session();
+ $session->remove('user_id');
+ $session->destroy();
+
+ // $cookie = \Config\Services::cookie();
+ // $remembered_username = $cookie->getCookie('remember_username');
+ // $cookie->delete('remember_username');
+
+ // Redirect to a logout confirmation page or login page
+ return redirect()->to('/login'); // Replace with your login route
+ }
+
+ public function lockscreen()
+ {
+ // Load the session library
+ $session = \Config\Services::session();
+
+ // Check if the session is locked
+ if ($session->get('session_locked')) {
+ // Load the lock screen view
+ return view('lock_screen');
+ } else {
+ // Redirect the user to their previous page or dashboard
+ return redirect()->to('dashboard'); // Replace with appropriate URL
+ }
+ }
+
+ public function lock()
+ {
+ // Load the session library
+ $session = \Config\Services::session();
+
+ // Set the session_locked flag
+ $session->set('session_locked', true);
+
+ // Redirect the user to the lock screen
+ return redirect()->to('lockscreen'); // Replace with your lock screen URL
+ }
+
+ public function unlock()
+ {
+ // Load the session library
+ $session = \Config\Services::session();
+
+ // Check password logic
+ $password = $this->request->getPost('password');
+
+ if ($this->checkPassword($password)) {
+ // Unlock the session
+ $session->remove('session_locked');
+ return redirect()->to('dashboard'); // Redirect to dashboard
+ } else {
+ // Incorrect password, show error
+ return redirect()->back()->with('error', 'Incorrect password.');
+ }
+ }
+
+ // Replace with your password checking logic
+ private function checkPassword($password)
+ {
+ // Implement your password validation logic here
+ // For example, compare against a stored hash
+ return $password === 'correct_password';
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php
index e31ad974..0fd149d8 100644
--- a/app/Controllers/BaseController.php
+++ b/app/Controllers/BaseController.php
@@ -8,6 +8,10 @@ use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
+<<<<<<< HEAD
+=======
+use App\Models\AuthenticationModel;
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
/**
* Class BaseController
@@ -58,6 +62,7 @@ abstract class BaseController extends Controller
public function render_page($viewpage, $data)
{
+<<<<<<< HEAD
$data['company_name'] = 'publishing';
$data['company_short_name'] = 'VBP';
@@ -65,9 +70,40 @@ abstract class BaseController extends Controller
$data['loggedin_person_role'] = 'VBP CEO';
$data['browser_title'] = $data['company_name'].' | '.$data['company_short_name'] .' '. $data['page_name'];
$data['heading'] = $data['page_name'] == "Dashboard" ? 'Welcome to VijayabharathamPublishing.com' : "";
+=======
+ $session = \Config\Services::session();
+ $session_uid = $session->get('user_id');
+ $session_uname = $session->get('user_name');
+ $session_role = $session->get('user_role');
+
+ $auth_model = new AuthenticationModel();
+ $details = $auth_model->getheringDetailsForHeader($session_uid);
+ $data['company_name'] = $details[0]['site_name'];
+ $data['company_short_name'] = $details[0]['site_title'];
+ $data['loggedin_person'] = $session_uname;
+ $data['loggedin_person_role'] = $details[0]['role'];
+ $data['favicon'] = $details[0]['favicon'];
+ $data['profile_picture'] = $details[0]['profile_picture'];
+ $data['browser_title'] = $data['company_name'].' | '.$data['company_short_name'] .' '. $data['page_name'];
+ $data['heading'] = $data['page_name'] == "Dashboard" ? 'Welcome to '.$data['company_name'] : "";
+
+
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
echo view('template/header.php', $data);
echo view('template/topbar.php', $data);
echo view($viewpage, $data);
echo view('template/footer.php', $data);
+<<<<<<< HEAD
+=======
+
+ // $header = view('template/header.php', $data);
+ // $topbar = view('template/topbar.php', $data);
+ // $content = view($viewpage, $data);
+ // $footer = view('template/footer.php', $data);
+
+ // return $header . $topbar. $content . $footer;
+
+
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
}
}
diff --git a/app/Controllers/Books.php b/app/Controllers/Books.php
new file mode 100755
index 00000000..ae3648c0
--- /dev/null
+++ b/app/Controllers/Books.php
@@ -0,0 +1,25 @@
+get('user_role');
+ $session_bid = $session->get('business_id');
+ $where = ['books.isactive' => 1];
+ if (!empty($session_role) && $session_role !== "sadmin" ) {
+ $where = ['books.business_id' => $session_bid,'books.isactive' => 1];
+ }
+
+ $model = new BooksModel();
+ $model->setTable('books');
+ $book_details = $model->where($where)->orderBy('book_id', 'DESC')->findAll();
+ $data['page_name'] = 'Book Details';
+ $data['details'] = $book_details;
+ $this->render_page('book_list', $data);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Controllers/Business.php b/app/Controllers/Business.php
index dfaba9e1..062f390a 100644
--- a/app/Controllers/Business.php
+++ b/app/Controllers/Business.php
@@ -2,21 +2,29 @@
namespace App\Controllers;
+<<<<<<< HEAD
use App\Models\BusinessModel;
+=======
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
class Business extends BaseController
{
public function add_bussiness()
{
+<<<<<<< HEAD
$BusinessModel = new BusinessModel();
$data['page_name']='SAME ';
$data['businesses'] = $BusinessModel->findAll();
+=======
+ $data['page_name']='Bussiness Details';
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
$this->render_page('business_list',$data);
}
public function new_bussiness()
{
$data['page_name']= 'Add Business';
+<<<<<<< HEAD
$data['busi_name']= 'sample';
$this->render_page('business', $data);
}
@@ -82,4 +90,9 @@ class Business extends BaseController
-
\ No newline at end of file
+
+=======
+ $this->render_page('business', $data);
+ }
+}
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php
index 7042ee4f..f4cdaba4 100644
--- a/app/Controllers/Home.php
+++ b/app/Controllers/Home.php
@@ -1,7 +1,11 @@
>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
class Home extends BaseController
{
public function index()
@@ -15,6 +19,7 @@ class Home extends BaseController
// return view('template');
// }
+<<<<<<< HEAD
public function render_page($viewpage, $data)
{
@@ -66,6 +71,8 @@ class Home extends BaseController
$this->render_page('book', $data);
}
+=======
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
public function subscribers_list()
{
$data['page_name'] = 'Subscribers Details';
diff --git a/app/Controllers/Users.php b/app/Controllers/Users.php
new file mode 100755
index 00000000..02aae4d0
--- /dev/null
+++ b/app/Controllers/Users.php
@@ -0,0 +1,74 @@
+get('user_role');
+ $session_bid = $session->get('business_id');
+
+ $where = ['users.isactive' => 1];
+ if (!empty($session_role) && $session_role !== "sadmin" ) {
+ $where = ['users.business_id' => (int)$session_bid,'users.isactive' => 1];
+ }
+ $model = new UsersModel();
+ $model->setTable('users');
+ $user_details = $model->where($where)->orderBy('user_id', 'DESC')->findAll();
+ $data['page_name'] = 'User Details';
+ $data['details'] = $user_details;
+ $this->render_page('user_list', $data);
+ }
+
+ ## To Load User Add/Update page
+ public function user_page($id)
+ {
+ if($id === '0') {
+ $data['page_name'] = 'Add User';
+ $data['details'] = [];
+ }
+ else if($id !== '0') {
+ $data['page_name'] = 'Edit User';
+ $model = new UsersModel();
+ $model->setTable('users');
+ $edit_user_details = $model->where(['user_id'=>$id,'isactive' => 1])->first();
+ $data['details'] = $edit_user_details;
+ }
+ $this->render_page('user', $data);
+ }
+
+
+ ## To Save/Update User Data on DB.
+ public function user_synchronization()
+ {
+ $session = \Config\Services::session();
+ $model = new UsersModel();
+ $model->setTable('users');
+ if($this->request->is('post')){
+ $requestData = $this->request->getVar();
+ }
+ $requestData['business_id'] = $session->get('business_id');
+ if($requestData['user_id']){
+ #edit
+ $requestData['updated_by'] = $session->get('user_id');
+ $requestData['isactive'] = isset($requestData['isactive']) && $requestData['isactive'] == 'on' ? 1 : 0;
+ unset($requestData['password']);
+ $model->saveData($requestData, $requestData['user_id']);
+
+ }else{
+ #add
+ $hash_password = password_hash($requestData['password'], PASSWORD_DEFAULT);
+ $requestData['password'] = $hash_password;
+ $requestData['created_by'] = $session->get('user_id');
+ $requestData['isactive'] = 1 ;
+ $model->saveData($requestData, null);
+
+ }
+ return redirect()->route('user_list');
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/AuthenticationModel.php b/app/Models/AuthenticationModel.php
new file mode 100644
index 00000000..a810e91f
--- /dev/null
+++ b/app/Models/AuthenticationModel.php
@@ -0,0 +1,22 @@
+db->table('users');
+ $builder->select('user_id,user_name,email,first_name,last_name,password,mobile_no,date_of_birth,address,gender,profile_picture,city,state,postal_code,users.country,role,setting_id,site_name,site_title,favicon,logo,terms_service,footer_about,admin_email,mobile,copyright,pagination_limit,site_info,about_info,mail_protocol,mail_title,mail_host,mail_port,mail_encryption,mail_username,mail_password,currency,settings.country');
+ $builder->join('settings', 'settings.admin_email = users.email', 'left');
+ $builder->where('user_id', $user_id);
+ //$template_mapping_details['fk_entity_id'];
+ $query = $builder->get();
+
+ return $query->getResultArray();
+ }
+}
+
diff --git a/app/Models/BooksModel.php b/app/Models/BooksModel.php
new file mode 100644
index 00000000..4f35b116
--- /dev/null
+++ b/app/Models/BooksModel.php
@@ -0,0 +1,10 @@
+insert($data);
+ } else {
+ // Update existing record
+ return $this->update($id, $data);
+ }
+ }
+
+}
+
diff --git a/app/Views/auth_login.php b/app/Views/auth_login.php
new file mode 100755
index 00000000..db97aa92
--- /dev/null
+++ b/app/Views/auth_login.php
@@ -0,0 +1,118 @@
+
+
+
+
+ BigBambooBookPublish | BBBP
+
+
+
+
+
+ ">
+
+
+ " 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" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
BigBambooBookPublishEnter your email address and password to access admin panel.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/book_list.php b/app/Views/book_list.php
index 63367fa9..02233f52 100644
--- a/app/Views/book_list.php
+++ b/app/Views/book_list.php
@@ -17,15 +17,24 @@
| Name |
Author |
+<<<<<<< HEAD
Edition/Language |
Year Of Release |
State/Country |
Price of the Book |
Book Avaialble Count |
+=======
+ Category |
+ Language |
+ Year Of Release |
+ Price of the Book |
+ Description |
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
Status |
+<<<<<<< HEAD
| Cyber Crime |
Tiger Nixon |
@@ -56,6 +65,31 @@
150 Copies |
Active |
+=======
+
+
+ |
+ |
+ |
+ |
+ |
+ ₹ |
+ |
+
+
+ |
+
+
+
+>>>>>>> 4ea78124915fbe2bb19a0c3355584ce7f2dfc815
diff --git a/app/Views/business.php b/app/Views/business.php
index ca1fa9c4..6e535de5 100644
--- a/app/Views/business.php
+++ b/app/Views/business.php
@@ -4,6 +4,7 @@