TinyPortal

General => Chit chat => Topic started by: Nokonium on October 02, 2006, 10:23:23 PM

Title: Can someone help me with some PHP please
Post by: Nokonium on October 02, 2006, 10:23:23 PM
I have go lots of the same error on one of my boards,

8: Undefined index: start
File: /#########/sgr/Sources/Subs.php
Line: 3345


It started when I updated it to RC3 & TP 0.95. I think that it is being caused by a print page script, but only because the php print file and SSI.php both use the variable $start. If I were to rename the variable in phprint.php would that solve the problem?

TIA

<?php

/*PHPrint - This file is phprint.php
Make any Page Printer Friendly! Version 2.1 - With error handling
Copyright by MikeNew.Net, Notice must stay intact
Any improvements to this script are welcome: www.mikenew.net/contact.asp
************
Legal: MikeNew.Net is not responsible for any damages caused
by use of this script. (Highly unlikely. Hasn't yet.)
This script will make your pages printer friendly.
Optionally, it will strip images as well. (Instructions for that below)*/

//Do you want to strip images from the printable output?
// If no, change to "no". Otherwise, images are stripped by default.
$stripImages = "no";

//what's the base domain name of your site, without trailing slash?
// Just the domain itself, so we can fix any relative image and link problems.
$baseURL="http://nokonium.co.uk/sgr";

// That's it! No need to go below here. Upload it and test by going to yoursite.com/page.php
// (The page containing the two tags and a link to this script)
// -----------------------------------------------------

$startingpoint = "<!-- startprint -->";
$endingpoint = "<!-- stopprint -->";
// let's turn off any ugly errors for a sec so we can use our own if necessary...
error_reporting(0);
// $read = fopen($HTTP_REFERER, "rb") ... this line may work better if you're using NT, or even FreeBSD
$read = fopen($HTTP_REFERER, "r") or die("<br /><font face=\"Verdana\">Sorry! There is no access to this file directly. You must follow a link. <br /><br />Please click your browser's back button. </font><br><br><a href=\"http://webbuildinginfo.com/\"><img src=\"http://webbuildinginfo.com/i.gif\" alt=\"Website building info\" border=\"0\"></a>");
// let's turn errors back on so we can debug if necessary
error_reporting(1);

$value = "";
while(!
feof($read)){
$value .= fread($read, 1000); // reduce number to save server load
}
fclose($read);
$start= strpos($value, "$startingpoint");
$finish= strpos($value, "$endingpoint");
$length= $finish-$start;
$value=substr($value, $start, $length);

function
i_denude($variable) {
return(
eregi_replace("<img src=[^>]*>", "", $variable));
}
function
i_denudef($variable) {
return(
eregi_replace("<font[^>]*>", "", $variable));
}

$PHPrint = ("$value");
if (
$stripImages == "yes") {
$PHPrint = i_denude("$PHPrint");
}

$PHPrint = i_denudef("$PHPrint");
$PHPrint = str_replace( "</font>", "", $PHPrint );
$PHPrint = stripslashes("$PHPrint");

echo
"<base href=\"$baseURL\">";

echo
$PHPrint;

flush ();
?>
Title: Re: Can someone help me with some PHP please
Post by: G6Cad on October 02, 2006, 10:27:29 PM
nokonium, Read the bugtracker ;)
Title: Re: Can someone help me with some PHP please
Post by: Nokonium on October 02, 2006, 10:44:58 PM
Ah! on page 2, strange though, I'm only getting it on the one board.
Title: Re: Can someone help me with some PHP please
Post by: G6Cad on October 02, 2006, 10:58:05 PM
I had it to, but it seems like it's gone now after the upgrades of the themes i use :)
Title: Re: Can someone help me with some PHP please
Post by: Nokonium on October 03, 2006, 07:19:24 AM
My theme is one I did myself, it is based on the default theme with my custom header and css changes. When I ran 'search in files' no theme or TP files were found that contained 'start', just index.php, SSI.php and phprint.php  :-\