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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent loading PHP pages into Joomla wrapper

Status
Not open for further replies.

Eliott

Programmer
Nov 8, 2009
91
BA
I'm owner of some web site with dozen of web pages. Pages were made by using PHP. before some time I discovered that some guys by using Joomla CMS and wrapper menu option included starting (login page) there and on this way confused members and other visitors, especially because "window" of wrapper isn't enough big and some information on my page aren't visible. On this way visitors connect these pages with me and put bad feeling about whole my site. I contacted these guys but no answer, then I tried to solve it by using $_SERVER['HTTP_REFERER'] super variable but I didn't get right and working solution for this problem.
$wl=$_SERVER['HTTP_REFERER'];
$duz=strlen($wl);
$sta="my_domain"; //part of my domain name just for check
$pos1 = stripos($wl, $sta);
if($duz>0 and $pos1 === false)
{
echo "<font size='25'>This is not genuine location"."</font><br/>";
die;
}
else
{
echo "OK, original web location"."<br/>";
}
?>
Maybe is problem because login page in this form call itself after submit and after successful login call other page (script) and on this way trigger protection routine? I just want to inform users on these web sites that they looks at "wrapped pages" not genuine location, is that possible?
thank you...

There is no good nor evil, just decisions and consequences.
 
using a referer is not a foolproof plan. it can be spoofed, turned off or whatever.

is your site being framed on another page? or just opened in a small pop-up?

if it is being framed, then this code should fix the problem (replace your body tag with this or add a js event):

Code:
<body onLoad="if (self != top) top.location = self.location">

if your site is being popped up in a small window then consider a javascript solution. without going in to detail in a php forum what you could do is this

Code:
<script type="text/javascript">
var minwidth= 800;
var minheight = 600;
window.onLoad = function(){
  if(screen.width < minwidth || screen.height < minheight){
    window.resizeTo(minwidth, minheight);
  }
}
</script>

bear in mind I am lousy at javascript and the above might well not work.
 
Hi

Just two minor things to add.
jpadie said:
[tt]<body onLoad="if (self != top) top.location = self.location">[/tt]
That is usually placed at the very beginning of the document, to be executed ASAP. Executing it [tt]onload[/tt] will make the visitor to wait two full page loads. ( Ok, minus what spares the caching on the second load. )
jpadie said:
[tt] if(screen.width < minwidth || screen.height < minheight){
window.resizeTo(minwidth, minheight);[/tt]
Resizing the window to 800*600 when the screen is smaller than 800*600 should not have a pleasant result. ( However modern browsers mostly refuse to resize the window bigger than the screen. ) Theoretically the comparison should be made against [tt]window.outerWidth[/tt] and [tt]window.outerHeight[/tt], but practically I get correct values only in Gecko, while WebKit and Presto show some obscure numbers.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top