Welcome Guest, Not a member yet? Register   Sign In
Saving session on database get session id
#9

You could create a logged_in database table and store the users_id in it, then with each log in check it
for the user_id to see if thery are already logged_in.

Something like this.

Code:
-- --------------------------------------------------------

--
-- Table structure for table `logged_in`
--

DROP TABLE IF EXISTS `logged_in`;
CREATE TABLE IF NOT EXISTS `logged_in` (
  `id`        INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id`    INT(11) UNSIGNED NOT NULL,
  `created_at` DATETIME            NULL DEFAULT NULL,
  `updated_at` DATETIME            NULL DEFAULT NULL,
  `deleted_at` DATETIME            NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = `utf8mb4` COLLATE = `utf8mb4_unicode_ci`;

--
-- Dumping data for table `logged_in`
--

You would need to check this table each time when a user logs into the system before logging them in.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: Saving session on database get session id - by InsiteFX - 07-28-2023, 10:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB