• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database and session library ?

#1
Question 
Hello all !

I'm trying to make an authorization system and I would like to combine in my database the table that the session library uses and the one that I created for the rest of the user information.

The fact is that my table also uses "time() functions that generate exactly the same timestamp as when creating sessions, but the documentation says that I should use such fields as "ip_address", "id" and so on...


Q: Where can I change these field names to avoid future errors ?
I would change this world, but God doesn't give me the source.
Reply

#2
(07-24-2019, 11:00 AM)Digital_Wolf Wrote: Hello all !

I'm trying to make an authorization system and I would like to combine in my database the table that the session library uses and the one that I created for the rest of the user information.

The fact is that my table also uses "time() functions that generate exactly the same timestamp as when creating sessions, but the documentation says that I should use such fields as "ip_address", "id" and so on...


Q: Where can I change these field names to avoid future errors ?

I found all this data in the file "System\Session\DatabaseHandler.php"
and I want to be sure that these are exactly all the values that the session library uses,
also I want to make sure that it gets into every field of the database:

1)
Code:
`id` varchar(128)
- this session id is exactly the same if it was recorded in the file name, using $sessionDriver = ***FileHandler.

2)
Code:
`ip_address` varchar(45)
- Well, it is clear that the user's ip.

3)
Code:
`timestamp` int(10)
- I assume this is the timestamp when was the session created.

4)
Code:
`data` blob
- ??? when was the last time there was a "regeneration" session ???

P.S.: Correct me if I'm wrong about something !
I would change this world, but God doesn't give me the source.
Reply

#3
It's all right there in the CodeIgniter 4 User's Guide.

Database Sessions
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#4
(07-25-2019, 05:25 AM)InsiteFX Wrote: It's all right there in the CodeIgniter 4 User's Guide.

Database Sessions

Yes, I know that everything is in order,
but I would like to know how(or where) I can change the names of the fields that used in this library ?


CREATE TABLE IF NOT EXISTS `ci_sessions` (
       `id` varchar(128) NOT NULL,
       `ip_address` varchar(45) NOT NULL,
       `timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
       `data` blob NOT NULL,
       KEY `ci_sessions_timestamp` (`timestamp`)
);


For example, I want to have the name "users_ip" instead of "ip_address", and the place "id" I want to be "users_id"...
I would change this world, but God doesn't give me the source.
Reply

#5
Those changes are not possible without overriding the library and making your own modifications to it.

Can I ask why you want to make those changes? Changing 'id' to 'users_id' doesn't make sense. It's not saving a user ID there, it's the session ID defined by PHP.
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply

#6
(07-25-2019, 03:00 PM)kilishan Wrote: Those changes are not possible without overriding the library and making your own modifications to it.

Can I ask why you want to make those changes? Changing 'id' to 'users_id' doesn't make sense. It's not saving a user ID there, it's the session ID defined by PHP.

I realized that I can't just change it  Sad 
But I would like to have such fields in just one table:
1) Users_id - The serial number of the user.
2) Sessions_id - Individual session number of the users, but you have this field is referred to as "id"
3) Signup_ip - To track the ip of the user under which he sent the registration form.
4) Signin_ip - To track the ip of the user under which he sent the authentication form.
and a few more fields for login, password, 2FA secret code and so on.

P.S. I would be very grateful if you could help me change the names of the fields, I just love when clean and order.  Angel
I would change this world, but God doesn't give me the source.
Reply

#7
Don't change the sessions table for that. Make a new table for users where you can store anything you want.
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply

#8
(07-26-2019, 07:22 AM)kilishan Wrote: Don't change the sessions table for that. Make a new table for users where you can store anything you want.

Oh well, then I will not have any optimization with this table, I will have to use the same functions twice and enter their data in the table.

Well I'll put up with it, thank you very much for the answers !
I would change this world, but God doesn't give me the source.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.