View Single Post
  #1  
Old 05-02-2005, 03:04 AM
kyouens's Avatar
kyouens kyouens is offline
 
Join Date: Apr 2005
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Headers already sent by . . .Snag with integration with Amazon Shop -- SOLVED

Hi everybody,

I have a quick question. I'm working on an integration of Ghostscripter's Amazon Store with my vBulletin installation, and I've come across a problem. I've got the script fairly well integrated into my site, with the header and footer "sandwiching" the Amazon Store code. Here's the code I add to the beginning of the Amazon Store php files to make most of it work:

PHP Code:
<?php
error_reporting
(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''bookstore'); //Change to match file name
chdir('/var/www/html/vbulletin/');  //Change to server path of yoru forums
$globaltemplates = array(
    
'footer',
    
'header',
    
'navbar',
);
if (
$_REQUEST['page'])
{
    
$globaltemplates array_merge($globaltemplates);
}
require_once(
'./global.php');
globalize($_REQUEST, array('page' => STR,));

eval(
'$nakedheader = "' fetch_template('nakedheader') . '";');
eval(
'$footer = "' fetch_template('footer') . '";');
eval(
'$navbar = "' fetch_template('navbar') . '";');

$headinclude str_replace(array('"clientscript''url(images/gradients'), array("\"$vboptions[bburl]/clientscript""url($vboptions[bburl]/images/gradients"), $headinclude);
$footer str_replace('"cron.php'"\"$vboptions[bburl]/cron.php"$footer);

if (
$shownewpm AND $vboptions['showpm'])
{
    eval(
'$pmscript = "' fetch_template('pm_popup_script') . '";');
    
$footer .= str_replace('"private.php'"\"$vboptions[bburl]/private.php"$pmscript);
}
//-------- End call to VBulletin header and footer -------//
chdir("/var/www/html/amazon/");
After I do this, I have no problem with echoing my header and footer to the Amazon Store pages. The problem is when I try to access the cart.php to add items, etc. The urls when an item is to be added look like this:

HTML Code:
http://myserver.com/amazon/cart.php?cmd=add&asin=0345391802
When I try to do this, I get the following error, and no I don't have whitespaces before or after my php tags:
Quote:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/amazon/cart.php:35) in /cart.php on line 116
I know that this error is occurring because global.php sends header / cookie information and the cart.php file also sends header information. I guess something must be getting printed or echoed in between. Here's an example of the code from cart.php that's altering the header (would post more but this code is proprietary):
PHP Code:
case'clear':
    unset(
$_SESSION['cart']['items']);
    
header("Location: cart.php");
    break;
case 
'remove':
    unset(
$_SESSION['cart']['items'][$_GET['asin']]);
    
header("Location: cart.php");
    break; 
Does anyone know of 1) a way to put all the output of global.php into a variable or something like that, then echo it in the cart.php file? 2) some other brilliant thing I haven't thought of yet?

I know people doing integrations of external scripts have come across this problem and I was wondering if anyone had a clue.

Thanks,
Kenny
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01232 seconds
  • Memory Usage 1,796KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete