Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Add-ons for VP-ASP
 URL referrer check
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bobren4
Starting Member

7 Posts

Posted - October 23 2007 :  15:54:42  Show Profile  Reply with Quote
Is there a way to check for referrer and based on it, either grant or deny access to the site?

In PHP I can do it with the code below, but how can I do it in ASP?


<? $referer_c = "1";
$referer = array("allowed.com","www.allowed.com");
$fail = "yes.html";
$success = "no.html";

if($referer_c=="1") {
if(!isset($_REQUEST['grant'])) { // Check if user hasn't given a value for grant using url

while(list($key,$val)=each($referer)) {
if(strstr($_SERVER['HTTP_REFERER'],$val)) {
$grant = 'true';
} // End giving grant a value
} // End while
} // End if grant

if($grant=='true') {
header("Location: $success");
}

if($grant!='true') {
header("Location: $fail");
exit;
}
}

?>


Edited by - bobren4 on October 23 2007 15:55:16

Happy
VP-CART New User

90 Posts

Posted - October 23 2007 :  19:27:15  Show Profile  Reply with Quote
One way could be:

If InStr(UCase(Request.ServerVariables ("HTTP_REFERER")),"URL_TO_DENY") > 0 Then
Response.Redirect ("URL_OF_ERROR_PAGE")
Response.End()
End If

Thanks,
Happy
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00