Hi there guys,
I've looked through the forum, and I've seen this error being caused by invisible illegal characters, as well as unended include statements, but my problem is a little bit different.
1) If I post this in either of my servers, it works fine without a hitch.
2) If I post it on the lady's server that is trying to use it, she gets:
Parse error: syntax error, unexpected T_INCLUDE in /home/dfezines/public_html/autopilotadvertising/ad/at/test_block4.php on line 1
Note that it's line 1 🙁
Here's the code:
<?php
include("config.php");
$limit = 4;
// cleaning function
function nicetrim($s, $length)
{
$str_to_count = html_entity_decode($s);
if (strlen($str_to_count) <= $length)
{
return $s;
}
$s2 = substr($str_to_count, 0, $length);
$s2 = substr($str_to_count, 0, $length - 3);
$s2 .= "...";
return $s2;
}
$query = "SELECT debug,use_highlight,block_width,block_scroll,block_showtitle,block_showdate,block_showauth,block_showauthweb,block_titlecount,block_textcount FROM ".$prefix."config";
$result = mysql_query($query) or die('MySQL error: ' . mysql_error() . '<hr/>' . $query);
while ($row = mysql_fetch_assoc($result)) {
$debug = $row['debug'];
$use_highlight = $row['use_highlight'];
$block_width = $row['block_width'];
$block_scroll = $row['block_scroll'];
$block_showtitle = $row['block_showtitle'];
$block_showdate = $row['block_showdate'];
$block_showauth = $row['block_showauth'];
$block_showauthweb = $row['block_showauthweb'];
$block_titlecount = $row['block_titlecount'];
$block_textcount = $row['block_textcount'];
if($debug==1){
error_reporting(E_ALL);
}
}
/* display the data */
// Dont forget the encodiung and html version, keywords yadieyadie
echo("
<html>
<head>
<script language=\"javascript\" type=\"text/javascript\">
<!--
/****************************************************
Author: Eric King
Url: http://redrival.com/eak/index.shtml
This script is free to use as long as this info is left in
Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos==\"random\"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos==\"center\"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!=\"center\" && pos!=\"random\") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
// -->
</script>
</head>
<body>
<div align=center>
<table width=$block_width border=1 style='border-collapse: collapse; border: 1px solid #EEEEEE' cellpadding=1 cellspacing=0>
");
/* this query will get a random testimonial result */
$query = "SELECT id,postdate,author,authorweb,authorwebname,title,testtext,highlight FROM ".$prefix."testimonials WHERE active=1 ORDER BY rand() LIMIT ".$limit;
$result = mysql_query ($query) or die('MySQL error: ' . mysql_error() . '<hr/>' . $query);
$result_rows = mysql_num_rows($result);
/*Shut them down if the record does not exist.*/
if($result_rows==0){
echo("<tr>
<td>
There are currently no testimonials in the database.<br>
<br>
Would you like to
<a href=\"$siteurl/form.php\" onclick=\"NewWindow(this.href,'submit','600','400','yes','center');return false\" onfocus=\"this.blur()\">Submit your own</a>?
</td>
</tr>");
}else{
$result = mysql_query ($query);
while ($row = mysql_fetch_assoc ($result)) {
$id = $row['id'];
$postdate = $row['postdate'];
$author = $row['author'];
$authorweb = $row['authorweb'];
$authorwebname = $row['authorwebname'];
$title2 = $row['title'];
$testtext1 = strip_tags ($row['testtext'], '<br>');
$highlight = $row['highlight'];
$testtext = nicetrim($testtext1, $block_textcount);
$title = nicetrim($title2, $block_titlecount);
/* display the data */
if($block_showtitle == 1) {
echo("<tr>
<td bgcolor='#ffffff' width=400>
<font size=3><b>$title</b></font>
</td>
</tr>");
}
echo(" <tr>
<td bgcolor='#ffffff'>
<font size=2>");
if($use_highlight == 1){
if($highlight != ""){
echo("...".$highlight."...
<hr>
<a href=\"$siteurl/index.php?id=$id\" onclick=\"NewWindow(this.href,'submit','800','600','yes','center');return false\" onfocus=\"this.blur()\">View this testimonial</a><br>");
}else{
echo("$testtext
<a href=\"$siteurl/index.php?id=$id\" onclick=\"NewWindow(this.href,'submit','800','600','yes','center');return false\" onfocus=\"this.blur()\">View this testimonial</a><br>");
}
}else{
echo("$testtext
<a href=\"$siteurl/index.php?id=$id\" onclick=\"NewWindow(this.href,'submit','800','600','yes','center');return false\" onfocus=\"this.blur()\">View this testimonial</a><br>");
}
echo("</font><p>
</td>
</tr>");
if($block_showauth == 1) {
echo("<tr>
<td align='right'>
<font size='1'>$author</font>
</td>
</tr>");
}
if($authorweb != "") {
if($block_showauthweb == 1) {
echo("<tr>
<td align='right'>
<font size='1'><a href='$authorweb' target='_blank'>$authorwebname</a></font>
</td>
</tr>");
}
}
echo("<tr>
<td bgcolor='#ffffff'>
<font size=2>");
//*************************//
//comment the next two lines to get rid of the "view testimonials" and "submit your own"
//*************************//
// echo("<a href=\"$siteurl\" onclick=\"NewWindow(this.href,'submit','800','600','yes','center');return false\" onfocus=\"this.blur()\">View all testimonials</a><br>");
// echo("<a href=\"$siteurl/form.php\" onclick=\"NewWindow(this.href,'submit','600','400','yes','center');return false\" onfocus=\"this.blur()\">Submit your own</a>");
echo("</font><p>
</td>
</tr>");
}
}
echo "
</table>
</div><br>
<br>
</body>
</html>";
mysql_close($autoconn);
?>
I went through to make sure there was no white space behind anything as well as no new lines. I pasted it to a text file, viewed it and copied that to see if I could get rid of any illegal characters that might be hanging out in it. In spite of this the error persists (only on her server).
Can someone help me with what I might need to do to sniff the problem out?
thanks,
json