VP-ASP :: Shopping Cart Software

Shopping Cart Software Solutions for anywhere in the World

US/Canada(Toll Free): +1 888 587 2278
Europe/UK: +44 (020) 7193 9408
Australia/New Zealand: +61 3 9016 4497

VP-ASP Shopping Cart Customer Forum

Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 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-ASP 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