Need help with a project - user database and stuff like that

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
JKM
Forum Contributor
Posts: 221
Joined: Tue Jun 17, 2008 8:12 pm

Need help with a project - user database and stuff like that

Post by JKM »

Hi there,

I've been doing some basic PHP for a while and I was thinking about trying something new. So I want to try to make a basic login system that remembers IP's (auto-login) and maybe access levels (that limits what the users can see and not).

So does anyone got some tips for me? Maybe some guides good documentation for projects like this? :)

Thanks for any help.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Need help with a project - user database and stuff like that

Post by requinix »

Remembering users by IP address is a bad design - many people can have the same IP.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Need help with a project - user database and stuff like that

Post by califdon »

tasairis wrote:Remembering users by IP address is a bad design - many people can have the same IP.
And likewise, the same person can have different IPs, like when they're at work or on vacation.
JKM
Forum Contributor
Posts: 221
Joined: Tue Jun 17, 2008 8:12 pm

Re: Need help with a project - user database and stuff like that

Post by JKM »

How should the page remember them, then?
user___
Forum Contributor
Posts: 297
Joined: Tue Dec 05, 2006 3:05 pm

Re: Need help with a project - user database and stuff like that

Post by user___ »

One common approach is just like it is done here, in that forum. By using a cookie, but I do no recommend it, because it is insecure.
JKM
Forum Contributor
Posts: 221
Joined: Tue Jun 17, 2008 8:12 pm

Re: Need help with a project - user database and stuff like that

Post by JKM »

It doesn't have to be 100% secure, because I could always add htaccess protection. It's more the access level and stuff like that I want to get out from this site.

I was looking at this guide. It doesn't have the "remember me"-thingy, and I could fix the access level thing with adding classes in the database. Any other guides etc. I should read?

Thanks for the help! :)
user___
Forum Contributor
Posts: 297
Joined: Tue Dec 05, 2006 3:05 pm

Re: Need help with a project - user database and stuff like that

Post by user___ »

Look, the common way is to set a cookie that will remember the user for a period of time, but it can be easily hijacked. You should read that: http://php-mag.net/itr/online_artikel/p ... d,114.html This is about how you can secure your sessions better.
JKM
Forum Contributor
Posts: 221
Joined: Tue Jun 17, 2008 8:12 pm

Re: Need help with a project - user database and stuff like that

Post by JKM »

Does anyone have an example of a login page, restrict pages to logged in users and how to return the logged in user's username?
Post Reply