Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot add header information--- Help me please!!

Status
Not open for further replies.

wayne186

MIS
Apr 25, 2002
10
GB
Hi, I am trying to use a web based calendar on my site but I am having difficulty getting it running. Whilst the php program that I have seen in demo and live versions does exactly what I want... I can't get around this 'Cannot add header' problem. I am not a php guru and I am really struggling with this, the developer of the calendar does not offer any support by mail, telephone or forum and I'm stuck in a case of 'I want it' but 'it won't work'. The error I receive when going to the default.php page is inserted below:

Warning: Cannot add header information - headers already sent by (output started at /homepages/18/d24357956/htdocs/wayne186/selfbuild/calendar/common.php:328) in /homepages/18/d24357956/htdocs/wayne186/selfbuild/calendar/index.php on line 5

The content of the default.php file is:

<?
require(&quot;common.php&quot;);
//
// what view is the default? let's go there
Header(&quot;Location: ./&quot;.$glbl_DefaultView.&quot;.php?LocationID=&quot;.$LocationID);
exit;
?>

From what I can see the default.php file uses common.php for all of the variables ie conections to database, paths and variables. I have also pasted this file below.. I am sorry if this breaches net etiquet by posting the contents of the file, I would absolutley love to get this working and soon as I have a very real and practicle requirement for it. Please e-mail me or post a reply to this thread if you have any thoughts.

Thanks a lot.

content of common.php pasted below (with some obvious removals of passwords and variables).::


<?
/////////////////////////////////////////////////////////////////
// This is the configuration file for phpCommunityCalendar. //
// For installation instructions and more information, consult //
// the README file. //
// Full documentation is available in the docs directory and //
// on the web at //
/////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// LICENSE AGREEMENT //
// phpCommunityCalendar is Open Source software and may be distributed //
// free of charge. AppIdeas.com also sells commercial installation and //
// support of the phpCommunityCalendar application. If you feel so //
// inclined, you may offer portions of your profits from sales of this //
// application to AppIdeas.com to help us continue development of Open //
// Source apps. //
// All installations of phpCommunityCalendar, including those that have //
// been heavily customized, must include this notice, in its entirety, //
// in a file called &quot;common.php&quot;. phpCommunityCalendar carries no //
// warranty, either stated or implied, for any use. Furthermore, //
// AppIdeas.com will not be responsible for any damage, real or imagined, //
// that occurs as a result of the use of phpCommunityCalendar. Even //
// though this is free software, the images, coding and other material //
// herein is copyrighted material. Copyrights are held and maintained by //
// Christopher Ostmo and/or AppIdeas.com. The right to distribute this //
// software may be revoked by the author at any time. Certain features //
// may require registration for services from third party vendors or //
// companies. By using this software and these scripts, you are //
// agreeing to these terms. Please note: AppIdeas.com does not offer //
// free technical support for phpCommunityCalendar. AppIdeas.com staff //
// will delete any personal requests for free technical support. //
// Technical support for this and other Open Source applications is //
// available at: //
// //
// and discussion forums are available at: //
// //
// The current home page address for all of AppIdeas.com's Open Source //
// applications is: //
// //
// //
// You may contact AppIdeas.com for commercial installation and/or //
// support of phpCommunityCalendar or any other PHP/MySQL web project at: //
// AppIdeas.com //
// 2305-C Ashland St. #271 //
// Ashland, OR 97520 //
// Web: //
// E-mail: sales@appideas.com //
// //
// Be sure to check out our complete list of product offerings at: //
// //
// //
// Finally, a CVS-like system is available (or will be soon) at: //
// //
// If you have code to contribute, you can do so there. Updates and //
// new add-ons for this application will also be made available at this //
// site. Check in every once in a while to see if there are any new //
// features that you need or desire. //
// //
// ENJOY! //
////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////
// If the comment blocks within this file are read, most of the //
// features should be fairly self-explanatory. //
//////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////
// Replace these variables with information for connecting to your //
// database server //
/////////////////////////////////////////////////////////////////////
$DBHost = &quot;db.mydomain.com&quot;;
$DBUser = &quot;dbo38350525&quot;;
$DBPass = &quot;mypassword&quot;;
$DBName = &quot;db38350525&quot;;
mysql_pconnect(&quot;$DBHost&quot;,&quot;$DBUser&quot;,&quot;$DBPass&quot;);
// comment above and uncomment below if your hosting provider
// does not allow persistent database connections.
// mysql_connect(&quot;$DBHost&quot;,&quot;$DBUser&quot;,&quot;$DBPass&quot;);

/////////////////////////////////////////////////////////////////////////////////
// The $glbl_WebAddress, $glbl_WebRoot, $glbl_AdminRoot and $glbl_WebAdminRoot //
// variables are used to form URLs for inclusion in e-mail notifications to be //
// sent to admins on public event submission. They should not end with a //
// trailing forward slash. The other variables are reserved for future use. //
/////////////////////////////////////////////////////////////////////////////////
$glbl_WebAddress = &quot;$glbl_UnixPath = &quot;/usr/local/$glbl_WebRoot = &quot;/calendar&quot;;
$glbl_AdminRoot = $glbl_WebRoot.&quot;/admin&quot;;
$glbl_WebAdminRoot = $glbl_WebRoot.&quot;/webadmin&quot;;
$glbl_ImagePath = $unixPath.&quot;/img&quot;;
$glbl_ImageRoot = $webRoot.&quot;/img&quot;;
$glbl_MailFrom = &quot;calendar@localhost&quot;;
$glbl_EmailSubject = &quot;Calendar Submission&quot;;

////////////////////////////////////////////////////////////////////
// The code below places the configuration options from the DB in //
// the global scope so that code doesn't have to be dropped into //
// every script to get the options. //
////////////////////////////////////////////////////////////////////
global $glbl_LocationTitle, $glbl_AllowPublicSubmission, $glbl_ApprovePublicSubmission, $glbl_ApprovalBySiteAdmin,
$glbl_ApprovalByLocationAdmin, $glbl_AllowCrossLocationSubmission, $glbl_DefaultView, $glbl_AllowMonth,
$glbl_AllowWeek, $glbl_AllowDay, $glbl_UseEventLocation, $glbl_TruncateLength, $glbl_SiteTitle, $glbl_AllowEventPrint,
$glbl_AdminEmail;
$result = mysql(&quot;$DBName&quot;,&quot;SELECT * FROM phpCalendar_Config&quot;) or die(mysql_error());
while ($row = mysql_fetch_row($result)) {
$glbl_LocationTitle = $row[0];
$glbl_AllowPublicSubmission = $row[1];
$glbl_ApprovePublicSubmission = $row[2];
$glbl_ApprovalBySiteAdmin = $row[3];
$glbl_ApprovalByLocationAdmin = $row[4];
$glbl_AllowCrossLocationSubmission = $row[5];
$glbl_DefaultView = $row[6];
$glbl_AllowMonth = $row[7];
$glbl_AllowWeek = $row[8];
$glbl_AllowDay = $row[9];
$glbl_UseEventLocation = $row[10];
$glbl_TruncateLength = $row[11];
$glbl_SiteTitle = $row[12];
$glbl_AllowEventPrint = $row[13];
$glbl_AdminEmail = $row[14];
}

//////////////////////////////////////////////////////////////////////
// commonHeader() defines the common site layout elements above and //
// to the left of the calendar content. To change the site layout, //
// alter the commonHeader() and commonFooter() functions. //
//////////////////////////////////////////////////////////////////////
function commonHeader($title) {
?>
<html>
<head>
<title><? echo $title; ?></title>
<!-- Changing the style sheet definitions below will change the default text
attributes throughout the site. You should not use &quot;<body...&quot; or &quot;<font...&quot;
tags to perform this task - those methods are becoming deprecated. -->
<style type=&quot;text/css&quot;>
<!--
body { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 12px; color: #000000}
small { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 9px; color: #000000}
big { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 16px; color: #000000}
a { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 12px; color: #000099}
table { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 12px; color: #000000}
td { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 12px; color: #000000}
tr { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 12px; color: #000000}
th { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 12px; color: #000000}
h1 { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 26px; color: #000000}
h2 { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 22px; color: #000000}
h3 { font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 18px; color: #000000}
-->
</style>
</head>

<body bgcolor=&quot;#FFFFFF&quot; leftmargin=&quot;0&quot; topmargin=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot;>

<table align=&quot;center&quot; border=&quot;0&quot;>
<tr><td valign=&quot;top&quot;>
<?
}

//////////////////////////////////////////////////////////////////////
// commonFooter() defines the common site layout elements below and //
// to the right of the calendar content. //
//////////////////////////////////////////////////////////////////////
function commonFooter() {
if (date(&quot;Y&quot;) == 2001) {
$showDate = 2001;
} else {
$showDate = &quot;2001 - &quot;.date(&quot;Y&quot;);
}
?>
</td></tr>
<tr><td align=&quot;center&quot;>
<font size=&quot;-2&quot;>Calendar programming by </font>
<a href=&quot; target=&quot;_new&quot;><font size=&quot;-2&quot;>AppIdeas.com</font></a><br>
<font size=&quot;-2&quot;>Copyright &copy; <? echo $showDate; ?></font><p>
</td></tr></table>

<?
}

///////////////////////////////////////////////////////////////////////
// popUp() defines the size of the javascript popups for event data. //
// These values can (and probably should) be changed from with the //
// scripts also. //
///////////////////////////////////////////////////////////////////////
function popUp($width=&quot;300&quot;,$height=&quot;200&quot;) { ?>
<script language='javascript'>
<!--
function openSmallWindow(url) {
window.open(url,&quot;smallWindow&quot;,&quot;width=<? echo $width; ?>,height=<? echo $height; ?>,scrollbars,resizable&quot;);
return false;
}
// -->
</script>
<? }


////////////////////////////////////////////////////////////////////
// getEvent() displays events on the calendar for non-IE browsers //
////////////////////////////////////////////////////////////////////
function getEvent($ID, $AbbrTitle, $Date) {
echo &quot;<a href=\&quot;./event.php?ID=$ID&Date=$Date\&quot; onClick=return(openSmallWindow('./event.php?ID=$ID&Date=$Date'))>$AbbrTitle</a>\n\n&quot;;
}

////////////////////////////////////////////////////////////////
// getEvent() displays events on the calendar for IE browsers //
// This distinction is made because IE is currently the only //
// browser on which the javascript mouseover effects work. //
////////////////////////////////////////////////////////////////
function getEventIE($ID, $LinkTitle, $AbbrTitle, $Date) {
$LinkTitle =ereg_replace(&quot;'&quot;,&quot;&#146;&quot;,$LinkTitle);
$AbbrTitle =ereg_replace(&quot;'&quot;,&quot;&#146;&quot;,$AbbrTitle);
echo &quot;<script>
dLink('./event.php?ID=$ID&Date=$Date','$LinkTitle','$AbbrTitle');
</script>\n\n&quot;;
}

//////////////////////////////////////////////////////////////////
// expandItems() calls a javascript that replaces one string of //
// text with another on mouseover (IE only) //
//////////////////////////////////////////////////////////////////
function expandItems() {
?>
<script language=&quot;JavaScript&quot;><!--
var no=0;

function mover(object,text) {
eval(object + '.innerText = text');
}

function mout(object,text) {
eval(object + '.innerText = text');
}

function dLink(href,text,txet) {
document.write('<a href=&quot;'+href+'&quot; onMouseOut=&quot;mout(\'link'+no+'\',\''+txet+'\')&quot; onMouseOver=&quot;mover(\'link'+no+'\',\''+text+'\')&quot; id=&quot;link'+no+'&quot; onClick=return(openSmallWindow(\''+href+'\'))>'+txet+'<\/a>');
no+=1;
}
//--></script>
<?
}

////////////////////////////////////////////////////////////////
// closeButton() is a javascript button for closing the event //
// data screens. //
////////////////////////////////////////////////////////////////
function closeButton() {
?>
<form name=&quot;form1&quot; action=&quot;javascript:window.close();&quot; method=&quot;post&quot;>
<input type=&quot;submit&quot; value=&quot;Close This Window&quot;>
</FORM>
<?
}

/////////////////////////////////////////////////////////////////
// printButton() is a javascript button for printing the event //
// data screens. //
/////////////////////////////////////////////////////////////////
function printButton() {
?>
<form name=&quot;form2&quot; action=&quot;javascript:window.print();&quot; method=&quot;post&quot; >
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Print This Page&quot;>
</form>
<?
}

//////////////////////////////////////////////////////////
// altBG() alternates table background colors in menus. //
// To change the alternating background colors, change //
// the values below. These currently only apply to the //
// menus in the admin areas. //
//////////////////////////////////////////////////////////
function altBG($lastColor) {
if ($lastColor == 1) {
echo &quot;<tr bgcolor=\&quot;#C9C9C9\&quot;>&quot;;
} elseif ($lastColor == 0) {
echo &quot;<tr bgcolor=\&quot;#E9E9E9\&quot;>&quot;;
}
}

////////////////////////////////////////////////////////////
// sessionGo() is used to track category admin users. For //
// insurance of proper functionality, these users should //
// have cookies enabled. If your server uses something //
// other than $PHPSESSID for the session identifier, //
// you'll need to reflect that change in the code below. //
////////////////////////////////////////////////////////////
function sessionGo() {
if (!$PHPSESSID) {
global $PHPSESSID;
ini_alter(&quot;session.auto_start&quot;,&quot;1&quot;);
session_start();
session_register();
}
}

//////////////////////////////////////////////////////////
// checkAdmin() is used to verify proper privileges for //
// category administration tools. //
//////////////////////////////////////////////////////////
function checkAdmin($PHPSESSID, $WebAdminRoot, $DBName) {
// place the LocationID in the global scope
global $glbl_LocationID;

// see if they're logged in
$result = mysql(&quot;$DBName&quot;,&quot;SELECT phpCalendar_AdminSessions.AdminUserID, phpCalendar_AdminUsers.LocationID
FROM phpCalendar_AdminSessions, phpCalendar_AdminUsers
WHERE phpCalendar_AdminSessions.SessionID = '$PHPSESSID'
AND phpCalendar_AdminSessions.AdminUserID = phpCalendar_AdminUsers.AdminUserID&quot;) or die(mysql_error());
$num = mysql_num_rows($result);
// if not, send them to the login page
if ($num < 1) {
Header(&quot;Location: &quot;.$WebAdminRoot.&quot;/login.php&quot;);
exit;
// or else they're logged in, get the LocationID
} else {
while ($row = mysql_fetch_row($result)) {
$glbl_LocationID = $row[1];
}
}
}



?>
 
Wow, too much code to look at... Simple answer, you cannot send header information after anything else (even a space or a carriage return or line feed) has been sent to the browser window. it looks like it happens first here:

Code:
function commonHeader($title) {
?>
<html>

at that HTML tag...

Try reversing the require and Header in default.php...

Kevin
 
Well reversing the header and require lines fixed it in that page - but returned this error...

Multiple Choices
The document name you requested (/selfbuild/calendar/.php) could not be found on this server. However, we found documents with names similar to the one you requested.
Available documents:

/selfbuild/calendar/.?LocationID= (common basename)
/selfbuild/calendar/..?LocationID= (common basename)
/selfbuild/calendar/.htaccess?LocationID= (common basename)

I suspect that this is down to the configuration of my common.php file - can anybody advise on the entries I should have for the following entries??

$glbl_UnixPath = &quot;/homepages/18/d24357956/htdocs/wayne186/selfbuild&quot;;
$glbl_WebRoot = &quot;/selfbuild&quot;;
$glbl_AdminRoot = $glbl_WebRoot.&quot;/admin&quot;;
$glbl_WebAdminRoot = $glbl_WebRoot.&quot;/webadmin&quot;;
$glbl_ImagePath = $unixPath.&quot;/imgages&quot;;
$glbl_ImageRoot = $webRoot.&quot;/imgages&quot;;

if I select any of the url's that the above error returns I am returned with a document not found error, so I navigated around and entered a url of a document I do know exists and it gave me another error:

Warning: Cannot add header information - headers already sent by (output started at /homepages/18/d24357956/htdocs/wayne186/selfbuild/calendar/common.php:328) in /homepages/18/d24357956/htdocs/wayne186/selfbuild/calendar/admin/viewConfig.php on line 33

I've applied the same thing to the viewconfig.php file and found the header was after the require again. Seems to be quite a few instances with this in the code. If anybody fancies helping me out to fix the code on this it looks like a really nice calendar and the demo and live versions look really good. If anybody would like to assist me then I would really appreciate it.. you can find the code on the developers site at in the meantime I shall try to work through the one's that I can now that I know to look for the header and require stuff.

cheers for your advice Kevin, much appreciate it..
 
hmmm... don't think I have the time right now to dedicate to that project, though the demo looks good. Just a general design consideration: I have 800x600 for my resolution and I have to scroll both ways to see the calendar days off to the right and bottom... I'm suree it looks fine on 1024x768, though. If that is a concern for you, then you may want to try to &quot;shrink&quot; the calendar...

Kevin
 
Is there anybody else who is willing to help me on this calendar please?

Kevin, the calendar size can be altered by changing a couple of parameters and altering the 'subject' of an appointments title length will reduce the calendar size to a suitable level. The default is 15 characters but you could reduce it to say 8 andthen when you place your mouse over the title - that column will automatically expand.. pretty cool I think.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top