Page 1 of 1
Concept : WebServer and sessions
Posted: Tue Feb 28, 2006 10:27 am
by Progi1984
Hi,
for a new project, i begin the reflexion. I need a webserver which need sessions.
I have some ideas :
when a user connects to the server, that creates an input in a base ( why not a linked list ?), with its IP and name and access level and state. If its password is correct, then its state is "accepeted".
But i want to do admin and moderator which have access at differents pages, how can i do in purebasic ?
PS : my users and password will be stored in a pb database !
Posted: Tue Feb 28, 2006 3:24 pm
by Trond
The standard way would be store the password client-side in a cookie. Then have all users in a database. Filtering by IP is not good since many computers on a LAN can have the same public IP.
Posted: Tue Feb 28, 2006 7:03 pm
by Progi1984
How do Apache manage sessions ?
is there a way of managing sessions on the server side ?
Posted: Tue Feb 28, 2006 7:52 pm
by Trond
Apache does not manage sessions, so I cannot answer that question.
You need to use cookies to manage sessions unless you keep the connection open (which you do not want to do on a webserver).
Posted: Wed Mar 01, 2006 3:40 am
by ShotGun Jack
Trond wrote:You need to use cookies to manage sessions unless you keep the connection open (which you do not want to do on a webserver).
Could u elaborate on this. What do you mean by an open connection. Juz wandering if I need to force a CloseNetworkConnection. If u have a page with say 10 images. You will probably get 11 client requests from a page load. Unused connections time out after while (I'm talking PB code)
Posted: Wed Mar 01, 2006 8:40 am
by Trond
The client closes the connection when it has received all the data it requested, I think.
You cannot use a constantly open connection in a web/http environment, you would have to write your own client and server.
Posted: Wed Mar 01, 2006 9:02 am
by Progi1984
But the problem of cookies is that the client must accept them !
Posted: Wed Mar 01, 2006 9:15 am
by Trond
Progi1984 wrote:But the problem of cookies is that the client must accept them !
Yes. But the problem with not using cookies it that the use must enter the username and password on every page.
You can carry the username and password (hashed/encrypted?) in the url if you do not want to use cookies.
Posted: Wed Mar 01, 2006 10:54 am
by Progi1984
After searching, you have all right
The two ways of managing sessions are with cookies and via URL (putting an ID for a user in all URLs).
But a question is always here : How do Apache and PHP manage sessions ?
Posted: Wed Mar 01, 2006 11:12 am
by Trond
Apache does not manage sessions. PHP uses cookies.
Posted: Wed Mar 01, 2006 11:54 am
by Progi1984
Excuse me (for Apache) : when i have an idea in the head ... :roll:
OK ! So the problem is none now !
Thank you very much