For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > July 2006 > Capture the requesting URL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Capture the requesting URL
Stephen Preston

2006-07-27, 6:56 pm

Is it possible to capture a visitors URL?

I have a Form button on a page which when clicked opens a demo page. Within
the form is a hidden field which adds the date/time of the button click into
a table in a MySQL database. Is it possible to capture the URL of the human
who clicks the Form button and if so what are the mechanics.

Will a robot be able to activate the form and thus give a non 'human' entry
in to the table?


Thanks
Stephen


ZeldorBlat

2006-07-27, 6:56 pm


Stephen Preston wrote:
> Is it possible to capture a visitors URL?
>
> I have a Form button on a page which when clicked opens a demo page. Within
> the form is a hidden field which adds the date/time of the button click into
> a table in a MySQL database. Is it possible to capture the URL of the human
> who clicks the Form button and if so what are the mechanics.
>
> Will a robot be able to activate the form and thus give a non 'human' entry
> in to the table?
>
>
> Thanks
> Stephen


What do you mean by "the URL of the human who clicks the form button?"
The URL of the page that contains the form?

Rik

2006-07-27, 6:56 pm

Stephen Preston wrote:
> Is it possible to capture a visitors URL?
>
> I have a Form button on a page which when clicked opens a demo page.
> Within the form is a hidden field which adds the date/time of the
> button click into a table in a MySQL database. Is it possible to
> capture the URL of the human who clicks the Form button and if so
> what are the mechanics.
>
> Will a robot be able to activate the form and thus give a non 'human'
> entry in to the table?


You could check for $_SERVER['HTTP_REFERER'], but that's not very
trustworthy. Another method is to temporarily store a visitors IP in a table
when loading the form, and checking wether your own form was loaded on a
submit. That could still be faked though. Captcha methods are a drag in this
sort of thing, but the only way you can be reasonably sure.

What are your exact reasons for wanting this? Maybe there is another way.

Grtz,
--
Rik Wasmus


Stephen Preston

2006-07-28, 6:57 pm

Sorry I did mean IP and not URL

The reason was just to see if the requests were coming from the same ip or
if it was different.


"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:ceac$44c94a48$8259c69c$8108@news1.tudelft.nl...
> Stephen Preston wrote:
>
> You could check for $_SERVER['HTTP_REFERER'], but that's not very
> trustworthy. Another method is to temporarily store a visitors IP in a
> table
> when loading the form, and checking wether your own form was loaded on a
> submit. That could still be faked though. Captcha methods are a drag in
> this
> sort of thing, but the only way you can be reasonably sure.
>
> What are your exact reasons for wanting this? Maybe there is another way.
>
> Grtz,
> --
> Rik Wasmus
>
>



Rik

2006-07-28, 9:56 pm

Stephen Preston wrote:
> Sorry I did mean IP and not URL
>
> The reason was just to see if the requests were coming from the same
> ip or if it was different.


Well that's $_SERVER['REMOTE_ADDR']. Store in a DB or session et voila.

Grtz,
--
Rik Wasmus


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com