[solved w/session] Trouble passing variable on redirect
Posted: Sun Mar 06, 2005 12:18 pm
Hello, this is my first post. I am new to php (and this board) ... so if I'm not doing something the best/recommended way, let me know.
I'm trying to pass a variable (actually several environmental variables, but just testing with one that's already been defined).
I've checked my host's version of php (via phpinfo() - 4.3.10) and 'register_globals' is ON for both the local & master.
My redirect code and variable definition looks like:
As you can prolly gather, I'm identifying anything "Bill" and redirecting to another custom 404 error file. I'd like to pass a bunch of environmental variables across to the 404ie.php file, but I can't even seem to get the $browser variable.
I've tried a bunch of things:
I even created a start_session(), defined "$_SESSION['browser']='ie';" and tried getting it with an "echo $_SESSION['browser'];" in the 404ie.php file.
No errors, but none result in an output of "ie" to the screen.
Are the variables being passed? How do I fetch them in the 404ie.php file?
TIA
I'm trying to pass a variable (actually several environmental variables, but just testing with one that's already been defined).
I've checked my host's version of php (via phpinfo() - 4.3.10) and 'register_globals' is ON for both the local & master.
My redirect code and variable definition looks like:
Code: Select all
<?php
function inAgent($agent) {
global $HTTP_USER_AGENT;
$notAgent = strpos($HTTP_USER_AGENT,$agent) === false;
return !$notAgent; }
if ( inAgent('MSIE') ) { $browser = 'ie'; } ?>
<?php if ($browser == 'ie'): ?>
<?php header("Location: http://mysite.com/_errors/404ie.php"); ?>
<?php else: ?>
<html>I've tried a bunch of things:
Code: Select all
<?php echo $browser;
printf ('$browser');
echo $_GETїbrowser];No errors, but none result in an output of "ie" to the screen.
Are the variables being passed? How do I fetch them in the 404ie.php file?
TIA