#19157 [Fbk]: Location not working
| From: | sniper@php.net | Date: | Fri, 30 Aug 2002 03:11:31 +0000 |
| Subject: | #19157 [Fbk]: Location not working | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-18207@lists.php.net to get a copy of this message | ||
ID: 19157
Updated by: sniper@php.net
Reported By: shelley@databyte.com
Status: Feedback
Bug Type: Session related
Operating System: w2k server
PHP Version: 4.2.2
New Comment:
Please provide the _shortest_ possible script without any database
stuff or include()'s...the one here is not very useful for us. And just
for the record; header() works just fine for me on Linux/Apache. (even
when using sessions)
Previous Comments:
------------------------------------------------------------------------
[2002-08-29 12:56:21] shelley@databyte.com
I just cut and pasted this together for you. You might have to tweak
this a bit to run. I'm also using ADODB for the Connection the newest
Version. As you can see below.
<?
// defaults.inc
global $timestamp;
global $Version_no;
global $fusrname;
if (!isset($ERR)){
$ERR='';
}
if (!isset($sess_page)){
global $sess_page;
$sess_page='page1.php';
}
if (!isset($page_name)){
global $page_name;
$page_name="page1";
}
if (!isset($company)){
$company='tucker';
}
if (!isset($division)){
$division='tape';
}
if (!isset($$timestamp)){
$timestamp=date('Y-m-d').time();
}
//$timestamp=strftime();
//@ini_set('track_errors', true);
include_once("passfunc.inc");
// config.inc
require_once('Smarty.class.php');
require_once('Version.inc');
include_once('ecom_errors.inc');
include_once('EncPwd.inc');
//include_once('session.inc');
include_once('ADOdb-errorpear.inc.php');
include_once('adodb.inc.php');
include_once('tohtml.inc.php');
include_once('/Date/Calc.php');
include_once('PEAR.php');
require_once('adodb-session.php');
//include_once('chkSecurity.inc');
// conn.inc
$cn = '';
$rs = '';
$cmd = '';
$server='dewolfe';
$user='ecomm';
$pwd='ecomm';
$database='flexx65';
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$cn = NewADOConnection('mssql');
$cn->PConnect($server,$user,$pwd,$database);
include_once("ecom_errors.inc");
$tst=headers_sent();
session_start();
$sess_key=session_id();
$tst=headers_sent();
$access = 'grant';
$page_name='page1.php';
$login='shelley';
$HTTP_SESSION_VARS['saccess'] = $access;
$HTTP_SESSION_VARS['susername'] = 'Shelley Jones';
$HTTP_SESSION_VARS['suserid'] = $login;
$HTTP_SESSION_VARS['suseris'] = 'Cust';
$HTTP_SESSION_VARS['spage'] = $page_name;
$tst=headers_sent();
$g_url="Location:http://localhost/php/page2.php?K=".$sess_key."&L".$login;
redirect2($g_url);
exit;
?>
<?
// passfunc.inc
function redirect2($url){
header($url);
flush();
}
?>
Shelley
------------------------------------------------------------------------
[2002-08-28 23:08:20] kalowsky@php.net
I'm unable to reproduce this locally. Can you provide the simplest
script to reproduce this?
------------------------------------------------------------------------
[2002-08-28 15:07:21] shelley@databyte.com
The header("Location only works 1/3 of the time. I had the same problem
on PHP 4.2.1 so I upgraded to 4.2.2 to see if it fixed the problem, and
it doesn't. I'm using Zend and I tried this program without using Zend
same results. The Location command only works 1/3 of the time the other
times I get an CGI error msg. I need this ASAP we are working on a
major project and this is holding us up.
include_once("defaults.inc");
include_once("passfunc.inc");
$tst=headers_sent();
include_once("config.inc");
include_once("conn.inc");
$tst=headers_sent();
include_once("ecom_errors.inc");
$tst=headers_sent();
session_start();
$sess_key=session_id();
$tst=headers_sent();
// $gsess_key="'".$sess_key."'";
$access = 'grant';
$page_name='page1.php';
$login='shelley';
$HTTP_SESSION_VARS['saccess'] = $access;
$HTTP_SESSION_VARS['susername'] = 'Shelley Jones';
$HTTP_SESSION_VARS['suserid'] = $login;
$HTTP_SESSION_VARS['suseris'] = 'Cust';
$HTTP_SESSION_VARS['spage'] = $page_name;
$tst=headers_sent();
$g_url="Location:http://localhost/php/page2.php?K="."'".$sess_key."'";
redirect2($g_url);
exit;
This is the redirect function:
<?
// passfunc.inc
function redirect2($url){
header($url);
flush();
}
?>
Shelley
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19157&edit=1