Forum Moderators: open

Message Too Old, No Replies

Can you wild card a http referer request

Want wild card in Select Case

         

Marshall

9:19 pm on Mar 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have a click-through tracking script. Lately, it seems it has been hijacked but an unknown site to link to pages which I suspect are forbidden in some countries by disguising them as links form my site. So, my though is to put am http_referer request at the beginning of the script where, if the referrer is not from my site, it redirects the page. Problem, I have 100 pages under com, org and net. So, I though you could wild card the results, Yes? No?

Here's what I got (real basic example):

<%
Select Case Request.ServerVariables("http_referer")
Case "http://www.mydomain.com", "http://www.mydomain.net", "http://www.mydomain.org",
Response.end
Case else
Response.Redirect "whatever.htm"
End Select
%>

under "Case", how can I get around entering 100+ pages x 3 TLD's? I thought there might be a wild card symbol or string I can put after the mydomain.com, but I cannot locate one. Does such an animal exist for this purpose?

Any help will be greatly appreciated.

Marshall

Receptional Andy

9:23 pm on Mar 3, 2008 (gmt 0)



ASP I haven't used for years, but maybe


Case Request.ServerVariables("http_referer") Like "*mydomain*"

Otherwise I would use if/else which might make things simpler.

Marshall

12:18 am on Mar 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks Andy,

After thinking about it, and reading your reply, I opted to go with

<%
if Request.ServerVariables("http_referer") = "" Then
response.redirect "some page"
else response.end
end if
%>

since these click-throughs never have a referrer URL in my logs. It is really strange. My logs show date,time,ip,target URL, referrer, and should ONLY show links that are on my site. Instead, they show links that are not on my site which makes me suspect they are being typed in manually and, as I said, using my tracking query to hide the true destination of the link.

Again, thanks,

Marshall

Marshall

1:38 am on Mar 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just a followup.

The final product works great. Anyone who uses the tracking link directly will get redirected. The code (short version) goes like this:

<%
if Request.ServerVariables("http_referer") = "" Then
response.redirect "some page"
else

The tracking log script....

end if
%>

Marshall