Hello Joe,

You can extract URL like this if you know where the use is coming from, I
use the below code in "<a href=...></a>" link to pass the URL in _next
variable so the view on which the user is redirected which content a form
will redirect the user on the _next var content...

URL(r=request, c="controller_name", f="function_name",
         vars=dict(_next=URL(


*request.controller,
request.function,
args=request.args,
vars=request.get_vars*)))

# Once the form pass, the user is redirected where he come from...
redirect(request.vars._next)

Though it may present some security issues as someone can tamper with the
url for instance and redirect the user over somewhere else (another site
for instance). If this is a concern you can have a look at web2py code to
learn how avoid that... Signing URL may be sufficient, but then it may
still have other security concern about doing that...

But I think that if you only want to track where the use is coming from in
your app these concern shouldn't stop using this...

So you can do :

session.http_referer_url = dict(controller=request.controller,
function=request.function, args=request.args, vars= request.get_vars)

You can also have a look here :

http://www.web2pyslices.com/slice/show/1618/basic-usage-statistics-log-what-your-users-do

For the data persistence side of your question...

Good luck

Richard

On Fri, Apr 8, 2016 at 6:19 AM, Joe <[email protected]> wrote:

> What is the best way to track HTTP_REFERER URL and store them in a
> session?
> Then, if the users submits the form I would like to save the HTTP_REFERER
> URL in the db.
>
> I would appreciate some guidance with this.
>
> Thanks very much.
>
> Cheers,
>
> Joe
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to