Forum Moderators: coopster & phranque

Message Too Old, No Replies

mod_rewrite and perl

         

cyberok

5:15 am on Sep 10, 2002 (gmt 0)

10+ Year Member



I need to know if anyone has figured out how to do the fallowing.
I run a freehoster (at home as a personal hobby) and I need to be able to loop access to the user pages through a perl script to monitor where the visitor is comming from and/or relay server msgs if I have to through a popup system.
This would also allow me to have the server actively monitor for people abusing the service etc.
I am not really interested in looping users through this perl script if they have came from within the site (user list page) but directly from some other site.
I do not want to add anything to the users html code to do this. So I was thinking it might be possible with mod_rewrite.
example urls
[domain.com...] no loop needed

[domain.com...] -> userslist.html -> [domain.com...] no loop needed

[domain.com...] or *.htm or / loop it.

I hope this makes sense.

jatar_k

7:37 am on Sep 13, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com] cyberok

I am a little surprised no one has jumped on this, I know there are mod_rewrite gurus floating around.

anyone?

<added>if you are looking for how, there are a bunch of threads about mod_rewrite around just try the site search [searchengineworld.com] as to "is this the best way", I am not totally sure exactly what you mean so I might need some clarification for that.

cyberok

8:34 am on Sep 13, 2002 (gmt 0)

10+ Year Member



Ok this is how the "method" should work.
I have the main site and within it a perl engine that allows users
to sign up for free webspace and the like. These users show up under
the /freeusers/ directory of the website.
Now the only way the users can upload files is via the web and so they have a login and password, but not a true unix account.
Also I have no real way of tracking abuse or even statistical information other then from the general log files apache provides.
Now I was thinking that not only statistics but abuse detection could be done on the fly by creating some kind of loop.
What this would do is when someone requests a html file from a freeuser directory it would manipulate the string to be something like:
[domain.com...]
or if the requested a specific file:
[domain.com...]

Using the above method I could grab referer headers and track per user usage, where thier visitors are comming from, rough transfer amounts, etc.

I hope this clears things up.

andreasfriedrich

11:53 am on Sep 13, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Options +FollowSymlinks 
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.domain.com [NC]
RewriteCond %{REQUEST_URI} (/¦\.html¦\.htm)$ [NC]
RewriteRule freeusers/(.*) cgi-bin/loop.cgi?$1 [L]

would rewrite any URL that starts with freeusers and where the referer is not your domain to cgi-bin/loop.cgi and pass anything after the freeusers as a query string to your cgi script.

Additionally to logging any infos that you want to collect the script would have to serve the actual html document that was requested.

BTW I did not test this and hope it helps

jatar_k

6:11 pm on Sep 13, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



thanks andreas

cyberok, that give you an answer or did we miss the mark?