[thelist] Can I capture part of a link?

Jason Lotito jason at devnetwork.net
Wed Feb 26 10:03:28 CST 2003


Hugh Blair wrote:
> I can't find the answer to this question.
>
> Scene:
> Person is sent an email with a link to click on that looks
> something like this: http://www.domain.com/AAA###### or
> http://www.domain.com?AAA###### where "A" is an alpha
> character and # is a number, length from 1 to 6. User
> clicks on that link which takes them to a web page that's
> a survey. They fill out the survey and an email is sent
> and/or their entries are added to a database.
>
> What I need is to track that AAA###### with their responses.
> The client doesn't want the user to be required to enter any
> identifying information. This code will just be used to track
> the distribution of responses.
>
> I can't figure out how to do that with just an HTML page.
> Just looking in the server log won't be acceptable, the
> code has to travel with the responses.
>
> Can that be done? How? Or will I need to use some Perl
> routine or a PHP page? The server is 'nix so Perl/PHP are
> available.
>
> I've just not run into this issue before so I'm lost.
>
> Thanks in advance,
>
> --
>    Hugh
>


Rather simple.  Just run a session as the user is on the site via PHP,
and you can track the individual.

domain.com?id=AAA######
<?php

start_session();
$_SESSION['id'] = $_GET['id']

db_query("INSERT INTO tracker ( id, page, datetime ) VALUES (
'{$_SESSION['id']}', '{$_SERVER['PHP_SELF']}', NOW())");

?>

That is rather basic code, needs error checking, hasn't been tested,
etc, but gives you a good idea of a simply way to do this.  Tracking the
users and storing the details in a database.

Jason




More information about the thelist mailing list