Script to know who clicked a link?

P

PGPS

Hi,
I want to know who all clicked a particular link (cgi-script) on any
website.

1. Link points to my own webserver
2. Link can be sent anyway. Either emailed or posted on a site which
needs login

If emailed, then the email page which shows the link also has the
users name. When clicked I want to obtain the name.

If posted on a forum which has a login, I want to get the name (which
is present in the page having the link).

HTTP-Referrer doesn't have the username, so it probably is going to be
a javascript based one.

The reason for doing this is,
a) to know who's using my link
b) to deny access to people who are using it excessively.

Any ideas?

Thanks.
 
U

usenet

If emailed, then the email page which shows the link also has the
users name. When clicked I want to obtain the name.

Lemme see if I can drag a bit of clarity out of this question.

So you send them a link like this:

http://www.example.com/cgi-bin/stuff.cgi?name=DavidFilmer

Is that right?

The name is simply a parameter. If you are using CGI.pm, you can
simply query it:

my $username = param('name');

You can dump it to a logfile or database or whatever (you didn't say
how you intend to actually keep track of this activity).
 
P

PGPS

Thanks, however, I don't want to send them individually.

Consider I have a profile in a forum, where I can put my own
javascript code.

Everyone needs a login.

So, when someone comes to my profile, the page which shows him my
profile also has his name on the page (his view)

Assume that I know how to extract this name from the page.

When he clicks on this link (javascript probably), it appends his name
to the link and sends a query like what you stated in your message
http://www.example.com/cgi-bin/stuff.cgi?name=DavidFilmer


Any ideas?

Thanks.
 
P

Peter J. Holzer

Yes: it depends on the actual forum. And yes: you probably want to do
this in JS if the site permits that

Which forum would allow that (I mean intentionally - of course lots of
forums don't sanitize their input properly)? I'd certainly give such a
site a wide berth.
- it's obvious that this must be done on the client of the person who
clicks the link!

Or on the server where the link resides. Doing something like

print a({-href => ("$url?name=" . remote_user)}, click here)

is easy. But of course you can do that only on your own server(s).

hp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top