homepage Welcome to WebmasterWorld Guest from 54.234.2.88
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Header Location does not work in IE
rigaconnect




msg:4542002
 1:08 pm on Feb 3, 2013 (gmt 0)

This does not work in Internet Explorer....
Why?




<?php
session_start(); // Start the php session
ob_start();
ini_set("session.cookie_httponly", 1);
$httponly = true;

if (isset($_SESSION['HTTP_USER_AGENT'])) {
if ($_SESSION['HTTP_USER_AGENT'] != md5($_SERVER['HTTP_USER_AGENT'])) {
header('Location: http://www.google.com');
exit;

}
elseif ( $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']) ) {
header('Location: http://www.ok.com');
}
}

 

rigaconnect




msg:4542003
 1:10 pm on Feb 3, 2013 (gmt 0)

I mean header('Location: [google.com');...] does not work
Works only in Chrome...
What is wrong?

g1smd




msg:4542005
 1:15 pm on Feb 3, 2013 (gmt 0)

Most likely: browser has cached a previous status and ignores the new one.


Root URL should end with trailing slash.

Your code produces a 302 redirect. Should it be a 301?

rigaconnect




msg:4542008
 1:24 pm on Feb 3, 2013 (gmt 0)

Tried with IE7, FF, Safari and Chrome and only Chrome works. Cleared all history in FF. No success

Changed to header('Location: [google.com...] Also no success...

Excuse me.. how to produce 301 redirect? What need to change?

rigaconnect




msg:4542021
 2:50 pm on Feb 3, 2013 (gmt 0)

sorry, my mistake
$_SESSION['HTTP_USER_AGENT']
is not equal to
md5($_SERVER['HTTP_USER_AGENT']

$_SESSION['HTTP_USER_AGENT'] is not displaying at all... do not know why

coopster




msg:4542262
 2:26 pm on Feb 4, 2013 (gmt 0)

Are you certain the HTTP_USER_AGENT is being sent with the request in the other browsers? Perhaps you have a setting in your browser(s) or even somewhere in between (firewall) that is not allowing that setting to be sent over in the request stack.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved