CodeIgniter Forums

Full Version: Working with cookies (Yum!)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]TheFuzzy0ne[/eluser]
Hi everyone.

I'm trying to achieve two things, and I'd appreciate some advice.



Checking if a user was logged in
When a users session expires, I would like for CodeIgniter to be able to tell this, and redirect the user to the login page. I know that sounds straight forward, so please hear me out. The admin control panel on the Web site I am designing is only available once someone has logged in, and the system has confirmed that they are an administrator. If a normal user browses to the admin control panel, they receive a 404 error. If I can ascertain that the user was logged in previously, and they they were an admin, I can have the system redirect them to the login page, otherwise, as far as anyone else is concerned, it doesn't exist.

Is there an easy way to achieve the results I am looking for, or have I just made my admin control panel more complicated than necessary? I'd like to think that I haven't.

Tracking read forums and posts
I'm not sure how to go about tracking which forums/posts a user has read. Does anyone know of anything that exists for CodeIgniter that can help, or anything that I can adapt to work with CodeIgniter. I've had a lot of ideas about how to do it, but seeing as it's already been done, there's no point in reinventing the wheel.

Another problem that comes to mind, is that when the cookie expires, the data for the users read forums and posts will also disappear; or will it?

Thanks in advance.

Daz.

El Forum

[eluser]TheFuzzy0ne[/eluser]
Bumping this post in the hope that someone out there can help.

El Forum

[eluser]xzela[/eluser]
Checking if a user was logged in seems way more complicated than necessary. If a normal user navigates to the admin page and is presented with a login screen there is no harm. The user will either attempt a login or leave. However, if a cracker (hacker) finds your login page they may attempt to crack it. This all depends on what kind of information the cracker is seeking of course. However, if you do enough preparation to prevent these types of attacks, you'll have nothing to worry about.

As for tracking read threads, I'm sure some plugin exists which could be ported over to CI. I'm surprised one isn't available in the wiki.

... looks like you have your first wiki assignment! Wink