On Fri, Jan 23, 2009 at 4:54 PM, haskellian <[email protected]> wrote:
>
> I'm new to webapps and I don't quite understand how to use Session.
> Should I have one Session-object for each user or one to track all
> users?

webpy will create a session for each user. They'll get a cookie that
contains a unique
identifier, and when they come back, the session tied to that
identifier will be restored.
It's basically a way to retain some information about the interactions
between some
client and the server.

> How do I keep track of all users that are logged in the best way? Is
> there some global state of the application that I should push users
> to?

If you're using the DBStore for sessions, there's a 'touched' field
that gets updated. A query
to the sessions table will get you the sessions ids of the recent
requests, but not the users.
Maybe, upon login, you could timestamp in the database when it was
that they logged in and
check against that. Then, you would know the user.

> And how do you handle user-specific page-rendering? How do you see if
> it is the same user? Meaning do I check with each request for a new
> page the ip-number of the user and then have that connected to a
> certain user-profile?

Store information about the user in the session. For instance, you can
store their profile_id
number, or their user_id.

> Also:
> * How can I check which browser the user has?
> * How can I check his IP-number?

Normally, these show up in environment variables. I'm unsure where you
get them from webpy.

> * How do I block an IP if it is trying to login more than say 10 times
> or trying to attack the site?

Some sort of middleware wrapped around your webpy application, or at
the webserver level
using something like mod_evasive? There's multiple answers to the question.


-- 
http://www.apgwoz.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to