Jump to content

include working on Firefox but not IE


adam.bruzon

Recommended Posts

Hello PHP helpers,

 

I am very confused. I have designed a really good login script for the company i am working for. I was testing it in Firefox all the way through. Now i just tested it in IE and it doesnt work!!!!  >:(

 

this is an example of the script i am using:

 

if ($_POST['member']))

{

include 'login.php';

}

elseif ($_POST['login'])

{

include 'loginvalidation.php';

}

elseif ($_POST['nonmember'])

{

include 'form2.php';

}

etc......

 

then within all the include files the form action is: action="<?php echo $_SERVER[php_SELF]; ?>"

 

I know that the include function is working because the menu of the page is using an include function and it displays the first time i load the page, but when i click the links and they are supposed to include another file then it just refreshes the page with exactly what was on there when i loaded the page for the first time.

 

So what is wrong. Please Help Me.

 

I am so annoyed

 

Yours Thankfully

 

Adam

Link to comment
Share on other sites

$HTTP_REFERER (when register_globals are on) and $_SERVER['HTTP_REFERER '] (which is what you should be using since register_globals have been eliminated in php6) is an optional header that is sent only by some browsers and only when they are enabled in the browser settings and then only under some conditions.

 

Your code should not be relying on HTTP_REFERER for anything more than logging information.

 

If you want to detect that someone visited any particular page on your site, start a session on that page and set a session variable with a particular value. Then resume/start a session on the next page and check if that particular session variable exists with the value you put in it.

 

Edit: Unfortunately, going back and editing your code in the first post so that it is no longer what caused the stated symptoms, makes solving problems twice as hard as they need to be.  ::)

Link to comment
Share on other sites

$HTTP_REFERER (when register_globals are on) and $_SERVER['HTTP_REFERER '] (which is what you should be using since register_globals have been eliminated in php6) is an optional header that is sent only by some browsers and only when they are enabled in the browser settings and then only under some conditions.

 

Your code should not be relying on HTTP_REFERER for anything more than logging information.

 

If you want to detect that someone visited any particular page on your site, start a session on that page and set a session variable with a particular value. Then resume/start a session on the next page and check if that particular session variable exists with the value you put in it.

 

Thank you very much for your tip - I have changed $HTTP_REFERER to $_SERVER['HTTP_REFERER '] - but this still does not help me with the current problem!!!

Link to comment
Share on other sites

Perhaps you should read what I wrote.

 

HTTP_REFERER is optional and cannot be reliably used.

 

I also stated what you needed to do that would work.

 

But i removed the $HTTP_REFERER code aswell and tested it but still no luck!!!

Lets forget i ever put it in and see if there is a reason why the if statement are not being recognised.

 

Thank you

Link to comment
Share on other sites

but when i click the links and they are supposed to include another file then it just refreshes the page with exactly what was on there when i loaded the page for the first time.

 

Sounds like a possible caching issue.  Is the URL changing from page to page?  Your use of $_POST to determine which page to display leads me to believe the URL might be static and that IE is just caching the page.

Link to comment
Share on other sites

print_r($_POST) and see what is actually being set.

 

Ok, print_r($_POST) returns result "Array ( [member_x] => 74 [member_y] => 15 )"

I guess that is right because the post data is 'member' and the number corresponds to the mouse position when i clicked. (Correct??)

 

 

???

Link to comment
Share on other sites

Sounds like a possible caching issue.  Is the URL changing from page to page?  Your use of $_POST to determine which page to display leads me to believe the URL might be static and that IE is just caching the page.

 

I think you might be right, the url always stays the same and the information changes on the page, is there a way to stop IE caching through php or any other code.

 

Thanks

 

Link to comment
Share on other sites

print_r($_POST) and see what is actually being set.

 

Ok, print_r($_POST) returns result "Array ( [member_x] => 74 [member_y] => 15 )" in IE7

I guess that is right because the post data is 'member' and the number corresponds to the mouse position when i clicked. (Correct??)

 

EDIT:

Firefox returns Array ( [member_x] => 103 [member_y] => 10 => member ) I think this is the key. But how do i make IE return this result?????

Link to comment
Share on other sites

definately a caching problem...

 

use these headers on top of your script

 

<?php
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
?>

 

if that does not work check your IE settings Tools->Internet Options

 

 

 

 

Link to comment
Share on other sites

definately a caching problem...

 

use these headers on top of your script

 

<?php
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
?>

 

if that does not work check your IE settings Tools->Internet Options

 

Thank you very much for your input, however, this did not sovle the problem.

Also it is not only me that is going to view this site so i cannot just change my IE setting because that would mean everyone viewing my site would have to do the same.

 

???

Link to comment
Share on other sites

the other thing that I noticed, when I switched from absolute layout (like 600 pixels) to percentages, but forgot to change the value of the unit (thus, leaving the table at 600%) was that IE renders it properly and you have no idea where the data's gone.

 

I suppose this is a good example of Microsoft doing something right...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.