Page 1 of 1

Members in an online community

Posted: Wed Feb 04, 2004 10:32 am
by hurrajag
I am making an online-community and I'd like to make the members capable of logging in. The only problem is that I don't have a clue about how to make the MySQL-database able to know if the person is still browsing my site when he is logged in, and also, if you are logged in, who is logged in to that user (IP, so that you only show the functions this person can make to the person that is logged in to that account, so that not all people get access to the functions only the admin is supposed to be able to use)?

I was thinking of using a variable for each members that is "online" 1 or 0 (true or false) then if the person is logged in, you store the IP of the person... then I, again, don't know how to see if the person is still browsing my site...

// HurraJag

Posted: Wed Feb 04, 2004 11:16 am
by Illusionist
I don't think that'd be somethign to do with the database. you should look into sessions

Posted: Wed Feb 04, 2004 12:23 pm
by m3rajk
you're talking about things that cross db (keeping track of last access which lets the other users know if they are recently active.) and php (keeping track of the user)

you could either use cookies and create your own sessions, or use sessions, which is probably easier. however, witht he built in one you cannot manipulate login time, and you have another issue: there are three ways for session to keep track: post/get/cookies
unless you always use post to move around your site, you'll have to use the cookies if you wanna keep it out of your get string

Posted: Wed Feb 04, 2004 12:44 pm
by Infinity
If you really want to write your own script ignore this reply.

download phpbb2 plus V1.3 its fully customizable and includes everything you will ever need and is very easy to set up

but you probably wont get the satisfaction that you would get from coding your own :wink:

Well...

Posted: Wed Feb 04, 2004 1:20 pm
by hurrajag
Thanks, that is a good idea... I feel that post would be the easiest to use, though is there any way to post variables through a normal <a></a>-link? Or do I have to use the <input type="hidden">-function?

Anyway, this post has helped me a lot already. Thanks again.

// HurraJag

Posted: Wed Feb 04, 2004 2:23 pm
by Michael 01
I personally use the hidden function rather than links, and than let the PHP script do the heavy work. Allowing for sessions to be transposed in links can leave for some issues security wise (session swaping) but with it hidden at least, and allowing the php script to handle the brunt of the work, one can assume that unless the person is using the ol source code lookup, the session variables will remain out of sight and most of all, uneditable. (if the script is properly processing the session)

Thanks again

Posted: Wed Feb 04, 2004 3:05 pm
by hurrajag
Thank you all, this has helped me a lot and for now I think I will go with the cookie-thingy becuase it feels the most like my level of knowledge, I've only been dealing with PHP for some days and the experience I have is from several other languages like C++ and such, so I can figure out a few ways to make it easier for myself, but this has really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really (I'd like to go on, but you'd get too bored and stop reading) helped me a lot and the cookie-thing works, that is tested and scientifically prooved.