|There's more than one way to do things|
Sessions, Perl and MySQLby powerhouse (Friar)
|on Mar 30, 2003 at 06:54 UTC||Need Help??|
powerhouse has asked for the
wisdom of the Perl Monks concerning the following question:
Ok, I have a Module I wrote with the help of Paul DuBois' "Perl and MySQL for the web". Which has taught me a lot.
I have modified a few parts of it to fit what I'm doing.
I've created an "admin" interface, whereby, the individual I've created it for, and myself can manage this site, including Registered users.
In the Admin interface there is a link that is for "managing users", if you click that, it will show their status, if they are verified(email), if they are admin(yes or no). If they are NOT an administrator, their is an option to add them, if they are, their is an option to remove them.
In both, I want it to Open EVERY session_id, Check the "session's username" as in the session, if exists.
For Adding "admin" powers, I want it to check if it is their session, and they are logged in, then if both of those are true, then it ADDS the variable the system checks to see if they are an admin user.
If it's to remove them, then it checks to find All THEIR sessions that are not deleted, and if they contain the variable that says they are admin users, then it deletes those variables. This way, if they are currently logged in, and I remove them, it's real time, not only after they log out and back in. and the other way around too. Where it will add them, real time, not only after they logout and back in.
So to do this, I added this to the code, in the appropriate place. Do you see a problem with this?
I did it this way in the Remove them code:
It seems like that would work. I use $sess_ref for the regular sessions, so I added 1 behind it to open each session.
This is not working. When I load the page, either adding or removing the admin "powers", it times out, then the dang site won't load for me for at least an hour. If I don't do that, then it just adds them or removes them depending on the action, but it don't work until they Next login.
Do you see a reason why this would not work?
Do you need to see more? If so, what part, module or the actual code surrounding the above extracts?