Page 1 of 1

Help, I broke something

Posted: Thu Feb 03, 2011 9:16 pm
by windkd
:oops:

I was trying to change the font size in a pdf file created from some php code on our website and I broke it.
I tried to restore it to the backup of the original and yet it is still broken...

The error we are getting is:

Warning: require_once(/MembersOnly/includes/clubs.inc.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/82/5428282/html/MembersOnly/pdf-book.php on line 7

Fatal error: require_once() [function.require]: Failed opening required '/MembersOnly/includes/clubs.inc.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/82/5428282/html/MembersOnly/pdf-book.php on line 7

This is running a file called pdf-book.php. The code for that file looks like this:

Code: Select all

<?php

session_start();

require '../config.php';

require_once $INCLUDES . 'clubs.inc.php';
require_once $INCLUDES . 'people.inc.php';
require_once $INCLUDES . 'teams.inc.php';

define('FPDF_FONTPATH', $INCLUDES . 'fpdf/font/' );

require_once $INCLUDES . 'fpdf/fpdi.php';

$hFactor = 1.15;
$vFactor = 5.25;
$fSize = 12;
$fFace = 'Arial';
$cl = new clsClubList();

$pdf = new fpdi();

$pagecount = $pdf->setSourceFile( $DIR_HOME . 'admin_prefix/files/prefix.pdf' );

for ( $i=0; $i < $pagecount; $i++ ) {
	$pdf->addPage();
	$image = $pdf->ImportPage( $i+1 );
	$pdf->useTemplate( $image );
}


for( $i=0; $i < count( $cl->items ); $i++ ) {
	$club = $cl->items[$i];

	//Start a new page
	$pdf->AddPage();

	//Render the club name and address
	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 0, $vFactor, $club->items['NAME'], 0, 1, 'C' );
	$pdf->SetFont( $fFace, '', $fSize );
	$pdf->Cell( 0, $vFactor, $club->items['STREET_ADDRESS'], 0, 1, 'C' );
	$pdf->Cell( 0, $vFactor, $club->items['CITY'] . ', ' . $club->items['STATE'] . ' ' . $club->items['ZIP'], 0, 1, 'C' );
	$pdf->Cell( 0, $vFactor, ' ', 0, 1, 'C' );

	//Render the course detail information
	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 35 * $hFactor, $vFactor, 'Course rating:', 0, 0, 'L' );
	$pdf->SetFont( $fFace, '', $fSize );
	$crl = new clsCourseRatingList( $club->items['ID'] );
	for ( $j=0; $j < count( $crl->items ); $j++ ) {
		$rating = $crl->items[$j];
		if ( ( ( $j % 2 ) == 0 ) && ( $j != 0 ) ) {
			$pdf->Cell( 35 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
		}
		$tempStr = $rating->items['NAME'] . '  ' . $rating->items['RATING'] . '  Slope: ' . $rating->items['SLOPE'];
		if ( ( $j % 2 ) == 0 ) {
			$pdf->Cell( 75 * $hFactor, $vFactor, $tempStr, 0, 0, 'L' );
		} else {
			$pdf->Cell( 75 * $hFactor, $vFactor, $tempStr, 0, 1, 'L' );
		}
	}
	if ( ( $j % 2 ) != 0 ) {
		$pdf->Cell( 35 * $hFactor, $vFactor, ' ', 0, 1, 'L' );
	}
	$pdf->Cell( 0, $vFactor, ' ', 0, 1, 'L' );


	//Render the course detail information
	$person = new clsPerson( $club->items['CLUB_MANAGER_ID'] );
	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 35 * $hFactor, $vFactor, 'Club Manager', 0, 0, 'L' );
	$pdf->SetFont( $fFace, '', $fSize );
	$buf = $person->items['FIRST_NAME'] . ' ' . $person->items['LAST_NAME'];
	$pdf->Cell( 45 * $hFactor, $vFactor, $buf, 0, 0, 'L' );
	$pdf->Cell( 35 * $hFactor, $vFactor, $person->items['PHONE'], 0, 0, 'L' );
	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 30 * $hFactor, $vFactor, 'Invitational:', 0, 0, 'L' );
	$pdf->SetFont( $fFace, '', $fSize );
	$pdf->Cell( 30 * $hFactor, $vFactor, $club->items['INVITATIONAL'], 0, 1, 'L' );

	$person = new clsPerson( $club->items['HEAD_PRO_ID'] );
	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 35 * $hFactor, $vFactor, 'Head Pro', 0, 0, 'L' );
	$pdf->SetFont( $fFace, '', $fSize );
	$buf = $person->items['FIRST_NAME'] . ' ' . $person->items['LAST_NAME'];
        $pdf->Cell( 45 * $hFactor, $vFactor, $buf, 0, 0, 'L' );
	$pdf->Cell( 35 * $hFactor, $vFactor, $person->items['PHONE'], 0, 0, 'L' );
	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 37 * $hFactor, $vFactor, 'Joined GCWGA:', 0, 0, 'L' );
	$pdf->SetFont( $fFace, '', $fSize );
	$pdf->Cell( 0, $vFactor, $club->items['JOINED'], 0, 1, 'L' );

	$person = new clsPerson( $club->items['GROUNDS_SUPER_ID'] );
	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 35 * $hFactor, $vFactor, 'Grounds Super.', 0, 0, 'L' );
	$pdf->SetFont( $fFace, '', $fSize );
	$buf = $person->items['FIRST_NAME'] . ' ' . $person->items['LAST_NAME'];
	$pdf->Cell( 45 * $hFactor, $vFactor, $buf, 0, 0, 'L' );
	$pdf->Cell( 35 * $hFactor, $vFactor, $person->items['PHONE'], 0, 0, 'L' );

	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 25 * $hFactor, $vFactor, 'Softspikes', 0, 0, 'L' );
	$pdf->SetFont( $fFace, '', $fSize );
	if ( $club->items['SOFTSPIKES_REQUIRED'] ) {
		$pdf->Cell( 0, $vFactor, 'Required', 0, 1, 'L' );
	} else {
		$pdf->Cell( 0, $vFactor, 'Recommended', 0, 1, 'L' );
	}

	$person = new clsPerson( $club->items['CLUB_CHAMP_ID'] );
	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 45 * $hFactor, $vFactor, 'Current Club champ:', 0, 0, 'L' );
	$pdf->SetFont( $fFace, '', $fSize );
	$buf = $person->items['FIRST_NAME'] . ' ' . $person->items['LAST_NAME'];
	$pdf->Cell( 45 * $hFactor, $vFactor, $buf, 0, 1, 'L' );

	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 45 * $hFactor, $vFactor, 'Delegates:', 0, 1, 'L' );
	$pdf->SetFont( $fFace, '', $fSize );

	//Delegate 1
	$delPerson = new clsPerson( $club->items['DELEGATE_1_ID'] );
	$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$buf = $delPerson->items['FIRST_NAME'] . ' ' . $delPerson->items['LAST_NAME'];
	$pdf->Cell( 35 * $hFactor, $vFactor, $buf, 0, 0, 'L' );

	//Alternate
	$altPerson = new clsPerson( $club->items['ALTERNATE_ID'] );
	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 60 * $hFactor, $vFactor, 'Alternate:', 0, 0, 'R' );
	$buf = $altPerson->items['FIRST_NAME'] . ' ' . $altPerson->items['LAST_NAME'];
	$pdf->SetFont( $fFace, '', $fSize );
	$pdf->Cell( 0, $vFactor, $buf, 0, 1, 'L' );

	//Back to Delegate 1
	$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$pdf->Cell( 35 * $hFactor, $vFactor, $delPerson->items['STREET_ADDRESS'], 0, 0, 'L' );

	//Back to Alternate
	$pdf->Cell( 60 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$pdf->Cell( 0, $vFactor, $altPerson->items['STREET_ADDRESS'], 0, 1, 'L' );

	//Back to Delegate 1
	$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$buf = $delPerson->items['CITY'] . ', ' . $delPerson->items['STATE'] . ' ' . $delPerson->items['ZIP'];
	$pdf->Cell( 35 * $hFactor, $vFactor, $buf, 0, 0, 'L' );

	//Back to Alternate
	$pdf->Cell( 60 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$buf = $altPerson->items['CITY'] . ', ' . $altPerson->items['STATE'] . ' ' . $altPerson->items['ZIP'];
	$pdf->Cell( 0, $vFactor, $buf, 0, 1, 'L' );

	//Back to Delegate 1
	$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$pdf->Cell( 35 * $hFactor, $vFactor, $delPerson->items['PHONE'], 0, 0, 'L' );

	//Back to Alternate
	$pdf->Cell( 60 * $hFactor, $vFactor, ' ' , 0, 0, 'L' );
	$pdf->Cell( 0, $vFactor, $altPerson->items['PHONE'], 0, 1, 'L' );

	//Blank line
	$pdf->Cell( 0, $vFactor, ' ', 0, 1, 'L' );

	//Second Delegate
	$delPerson = new clsPerson( $club->items['DELEGATE_2_ID'] );
	$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$buf = $delPerson->items['FIRST_NAME'] . ' ' . $delPerson->items['LAST_NAME'];
	$pdf->Cell( 35 * $hFactor, $vFactor, $buf, 0, 0, 'L' );

	//Ladies chair
	$ladPerson = new clsPerson( $club->items['LADIES_CHAIR_ID'] );
	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 60 * $hFactor, $vFactor, 'Ladies Golf Chair:', 0, 0, 'R' );
	$pdf->SetFont( $fFace, '', $fSize );
	$buf = $ladPerson->items['FIRST_NAME'] . ' ' . $ladPerson->items['LAST_NAME'];
	$pdf->Cell( 0, $vFactor, $buf, 0, 1, 'L' );

	//Back to Second Delegate
	$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$pdf->Cell( 35 * $hFactor, $vFactor, $delPerson->items['STREET_ADDRESS'], 0, 0, 'L' );

	//Back to Ladies chair
	$pdf->Cell( 60 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$pdf->Cell( 0, $vFactor, $ladPerson->items['STREET_ADDRESS'], 0, 1, 'L' );

	//Back to Second Delegate
	$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$buf = $delPerson->items['CITY'] . ', ' . $delPerson->items['STATE'] . ' ' . $delPerson->items['ZIP'];
	$pdf->Cell( 35 * $hFactor, $vFactor, $buf, 0, 0, 'L' );

	//Back to Ladies chair
	$pdf->Cell( 60 * $hFactor, $vFactor, ' ' , 0, 0, 'L' );
	$buf = $ladPerson->items['CITY'] . ', ' . $ladPerson->items['STATE'] . ' ' . $ladPerson->items['ZIP'];
	$pdf->Cell( 0, $vFactor, $buf, 0, 1, 'L' );

	//Back to Second Delegate
	$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$pdf->Cell( 35 * $hFactor, $vFactor, $delPerson->items['PHONE'], 0, 0, 'L' );

	//Back to Ladies chair
	$pdf->Cell( 60 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$pdf->Cell( 0, $vFactor, $ladPerson->items['PHONE'], 0, 1, 'L' );

        //Blank line
        $pdf->Cell( 0, $vFactor, ' ', 0, 1, 'L' );

	//Third delegate
	$delPerson = new clsPerson( $club->items['DELEGATE_3_ID'] );
	$buf = $delPerson->items['FIRST_NAME'] . ' ' . $delPerson->items['LAST_NAME'];
	$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$pdf->Cell( 0, $vFactor, $buf, 0, 1, 'L' );
	$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$pdf->Cell( 0, $vFactor, $delPerson->items['STREET_ADDRESS'], 0, 1, 'L' );
	$buf = $delPerson->items['CITY'] . ', ' . $delPerson->items['STATE'] . ' ' . $delPerson->items['ZIP'];
	$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$pdf->Cell( 0, $vFactor, $buf, 0, 1, 'L' );
	$pdf->Cell( 10 * $hFactor, $vFactor, ' ', 0, 0, 'L' );
	$pdf->Cell( 0, $vFactor, $delPerson->items['PHONE'], 0, 1, 'L' );

        //Blank line
        $pdf->Cell( 0, $vFactor, ' ', 0, 1, 'L' );

	//Team header
	$pdf->SetFont( $fFace, 'B', $fSize );
	$pdf->Cell( 55 * $hFactor, $vFactor, 'Spring Team Roster', 0, 0, 'L' );
	$pdf->Cell( 25 * $hFactor, $vFactor, '', 0, 0, 'L' );
	$pdf->Cell( 35 * $hFactor, $vFactor, 'HCP index', 0, 0, 'L' );
	$pdf->Cell( 35 * $hFactor, $vFactor, 'Phone Number', 0, 1, 'L' );

	//Team roster
	$pdf->SetFont( $fFact, '', $fSize-2 );
	$tl = new clsTeamItemList( $club->items['ID'], 'ACTIVE', $limit );

	for( $j=0; $j < count( $tl->items ); $j++ ) {
		$teamItem = $tl->items[$j];
		$teamPerson = $teamItem->getPerson();
		$personName = $teamPerson->items['FIRST_NAME'] . ' ' . $teamPerson->items['LAST_NAME'];
		$pdf->Cell( 55 * $hFactor, $vFactor, $personName, 0, 0, 'L' );
		if ( $teamItem->items['CAPTAIN'] ) {
			$pdf->Cell( 25 * $hFactor, $vFactor, 'captain', 0, 0, 'L' );
		} else {
			$pdf->Cell( 25 * $hFactor, $vFactor, '', 0, 0, 'L' );
		}
		$pdf->Cell( 35 * $hFactor, $vFactor, $teamPerson->items['HANDICAP'], 0, 0, 'L' );
		$pdf->Cell( 35 * $hFactor, $vFactor, $teamPerson->items['PHONE'], 0, 1, 'L' );
	}


	//Render the team information

}


$pdf->Output();


?>
Again, I had made a backup first, but restoring the backup didn't fix the error code. No other files were touched. This is now causing an outage for everyone on the board, etc. I was stupidly thinking I could mess with it but restore it if I broke it. Obviously, I was wrong.

Anyone have any ideas of what I can do to fix my mistake? I can provide more documentation if needed.

THANK YOU!!!! To anyone and everyone who is willing to help this newbie :)

Re: Help, I broke something

Posted: Thu Feb 03, 2011 11:32 pm
by gooney0
Well...

Does the file:

/MembersOnly/includes/clubs.inc.php

still exist? Are the permissions set properly so that the web server can read this file?

PHP seems to think the file isn't there. Keep in mind your system may be case sensitive too.

Re: Help, I broke something

Posted: Thu Feb 03, 2011 11:43 pm
by windkd
gooney, thanks for the quick reply!
Yes, it does in fact exist. I can see it there and nothing was changed on any of the other files, and the permissions are valid.
That is why its so confusing... nothing else has been touched. Only the one bit of code $fSize = 12; had been changed between the two versions of the pdf-book.php file. And when the error started, we went back to the original file.

Any thing you can think of that I may be able to try next?

Is it possible its a cache issue? If so, where would I check that?
Is there somewhere I could go and tell this file that the included file is indeed where it says it is :)

Sorry, I probably sound pretty naive and green about this :?

Thanks!

Re: Help, I broke something

Posted: Thu Feb 03, 2011 11:52 pm
by windkd
My sincere apologies for wasting everyone's time.... but we found an older copy of the file, restored it and all is right with the world again. Issue resolved.

Thank you, Gooney, for your help!!