CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Prevent Direct Link (Referer?)

Print topic Send  topic

Author Message
Suntower

Posts: 225
Posted: 06/09/2009, 11:07 AM

Hi,

I usually use ASP so I am not sure how to do the following.

We have a WordPress blog (in PHP). We'd like to prevent users from accessing the blog directly, but rather only getting there from our web site HTML page. Is there a snippet of code someone could provide that we could add to the index page of the WordPress Blog that would exit() if the referring page is not our HTML page?

TIA,

---JC
_________________
---On a campaign for more examples and better docs!
View profile  Send private message
melvyn


Posts: 333
Posted: 06/09/2009, 11:38 AM

  
if($_SERVER['HTTP_REFERER'] == "http://suntower/home.html"){  
// allow access. do nothing here  
}else{  
header("Location: http://suntower/home.html"); // send the visitor to the homepage  
}  

_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com
View profile  Send private message
Suntower

Posts: 225
Posted: 06/09/2009, 10:13 PM

You rock. Like a hurricane, baby. Just what I needed.

CHEERS!

---JC

Quote melvyn:
  
if($_SERVER['HTTP_REFERER'] == "http://suntower/home.html"){  
// allow access. do nothing here  
}else{  
header("Location: http://suntower/home.html"); // send the visitor to the homepage  
}  

_________________
---On a campaign for more examples and better docs!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.