Welcome Guest, Not a member yet? Register   Sign In
Connect to the DB second time with different rights
#1

[eluser]Volder[/eluser]
I have a site where I have the following logic:

if the user is authorized - I connect to DB with 'logged_user' profile, otherwise I connect as 'guest'.
Of course, the difference is in rights, e.g. 'guest' can not delete records from tables etc.

I was using Native session library and I was deciding which user to connect depending on session variable 'logged_in'.

Then I have updated to using codeigniters session library with database usage.

So now I have the problem that before I could understand with which role to connect to database - I need to know whether user is logged in or on. And this could be understood from session variables. But for retrieving them I need to establish a connection first.

So it looks like a circle.

Is it possible to connect to DB with simple role which may only erase records from ci_sessions table. And then reconnect with another user role?

In the docs there is a reconnect() method - but it is not used with a parameter.

What would you suggest in my case?

thanks.


Messages In This Thread
Connect to the DB second time with different rights - by El Forum - 10-15-2009, 01:23 PM
Connect to the DB second time with different rights - by El Forum - 10-15-2009, 02:17 PM
Connect to the DB second time with different rights - by El Forum - 10-15-2009, 09:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB