Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

total newbie referer problem

Status
Not open for further replies.

antyem

Technical User
Jun 7, 2002
3
CL
I'm trying to install a formmail asp. I need to define my site as the referer of the form information so that I can lock out any other sites that might try to use the formmail to send e-mails from my server.

The problem is that the script doesn't accept my site as valid, even though I have listed it as a referer. Could this be a server problem: is the search for the address being blocked somehow? Here is the line that initiates the search:
referer= GetHost(REquest.ServerVariables("HTTP_REFERER"))

I have a windows 2000 server
-at wits end,
antyem

 
I doubt the RE in Request causes anything but sometimes case does weird things.
Do you mind giving us the declaration of referer?
I think that would be the only place a error will come from sense formmail is so widely used and this is new to me.
The only things you change are reciepients and referer from my memory, correct?? I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
From memory HTTP_REFERER includes the full file path from the referring page - although also from memory it's bank if you manually type a URL into the browser.

So while I can't see your code i'd assume you're trying to compare the referer variable with values in the referers array, however referer will contain a full filepath, which referers does not appear to. codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
<insert witticism here>
 
Before I was getting the message that my referer was invalid, now I'm getting the message that there is no referer! I ran a script to check my server variables and SERVER_NAME =
Here is all of the coding that (I think) relates to the problem...

referers = Array(&quot; mailComp = &quot;CDONTS&quot;
smtpServer = &quot;wasamail.wasadata.com&quot;
fromAddr = &quot;info@parentnetsweden.com&quot;


Response.Buffer = true
errorMsgs = Array()

'Check for form data.

if Request.ServerVariables(&quot;Content_Length&quot;) = 0 then
call AddErrorMsg(&quot;No form data submitted.&quot;)
end if

'Check if referer is allowed.

validReferer = false
referer = GetHost(Request.ServerVariables(&quot;SERVER_NAME&quot;))
for each host in referers
if host = referer then
validReferer = true
end if
next
if not validReferer then
if referer = &quot;&quot; then
call AddErrorMsg(&quot;No referer.&quot;)
else
call AddErrorMsg(&quot;Invalid referer: '&quot; & referer & &quot;'.&quot;)
end if
end if

Thanks for all the help,
antyem
 
is gethost a function of yours? I can't find it in vbscript or asp help files codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
<insert witticism here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top