Page 1 of 1

PHP application help

Posted: Mon Nov 17, 2008 10:32 am
by Snobbery08
Hey,

Currently my site can be viewed on an external site's application with my site in an iframe.

Now what i have is this on the file on my server which is what the external site loads for the application:

Code: Select all

<?php
require_once 'library/client/library.php';
session_start();
$_SESSION['Var'] = 1;
?>
<iframe src ="http://www.domain.com" width="630" height="600" style="overflow-x: hidden;">
</iframe>
?>
 
This is working perfectly but when $_SESSION['Var'] is set, a different CSS file is loaded so that the site loads and fits in the iframe perfectly.

Now if a user leaves the site with the iframe and visits the main site normally, the $_SESSION['Var'] is still set and thus it loads the wrong layout. Is there a way I can check when the following situation occurs:

if user views http://www.domain.com via iframe on secondary site
if user views http://www.domain.com normally on browser

That way i can unset $_SESSION['Var'] if its the latter so the layout is back to normal.
Perhaps theres a way in php to check if the site is in an iframe ?

Any thoughts that may help is much appreciated.

Re: PHP application help

Posted: Mon Nov 17, 2008 10:56 am
by aceconcepts
Why dont you style your site using % thus having the site fit a minimum and larger resolution or dimension.

Re: PHP application help

Posted: Mon Nov 17, 2008 11:36 am
by Snobbery08
Because i designed the layout for 1000px wide, and it has 3 columns Left center and right.

With the iframe compressing it all down to 600px it became very difficult to read the site. So i had decided to make another layout, one for the application and one for normal use.

Hope you can help with my issue though. :)

Thanks.

Re: PHP application help

Posted: Tue Nov 18, 2008 3:33 am
by aceconcepts
What happens if you echo $_SERVER['HTTP_HOST'] from within the iframe?

$_SERVER['HTTP_HOST'] returns the domain name such as devnetwork.net.