Solved

Garbage text at top of page after website transfer

Posted on 2014-02-05
8
273 Views
Last Modified: 2014-02-06
I am just in the process of transferring a website, but on the new server I am getting garbage text at the top of the page. See http://46.32.231.136/~marblele/

The software used on this website is http://www.open-realty.org

Any idea why the garbage text is there and how to get rid of it?
0
Comment
Question by:petewinter
  • 3
  • 3
  • 2
8 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39836313
Looks like Unicode characters in one of your pages.
0
 

Author Comment

by:petewinter
ID: 39836357
Thanks, but any idea how to get rid of it?
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 100 total points
ID: 39836374
Check you top level pages i.e. open them and have a look, (and make sure they are encoded as UTF-8 without BOM as this will make sure any Unicode will show up incase they are 'hidden')
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 400 total points
ID: 39836445
Looks like invalid Unicode characters!

http://validator.w3.org/check?uri=http%3A%2F%2F46.32.231.136%2F~marblele%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

This will give you a little more guidance about character-encoding issues.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11880-Unicode-PHP-and-Character-Collisions.html

The fact that the pattern of junk is repeated four times might be an important clue.  How many include() steps are done before the browser output is started?  If it's four, you may find that all of your sub-scripts are spitting out a bit of junk.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:petewinter
ID: 39838466
Thanks for the advice all. I have narrowed the issue down to the code below...

error_reporting(E_ALL& ~E_NOTICE);
global $lang;
$lang = array();
if ($handle = opendir(dirname(__FILE__).'/versions')) {
	while (false !== ($file = readdir($handle))) {
		if ($file != "." && $file != ".." && $file != "CVS" && $file != ".svn") {
			if (!is_dir(dirname(__FILE__).'/versions/' . $file)) {
				include(dirname(__FILE__).'/versions/' . $file);
				}
			}
		}
	closedir($handle);
	}
if ($handle = opendir(dirname(__FILE__).'/custom')) {
	while (false !== ($file = readdir($handle))) {
		if ($file != "." && $file != ".." && $file != "CVS" && $file != ".svn") {
			if (!is_dir(dirname(__FILE__).'/custom/' . $file)) {
				include(dirname(__FILE__).'/custom/' . $file);
				}
			}
		}
	closedir($handle);
	}

Open in new window


Any idea what is wrong with the above?
0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 400 total points
ID: 39838648
There might be nothing wrong with the above.  All it does is include() some files.  You might want to look into those /versions/ and /custom/ directories.  Open each of the files in those directories with a text editor (not Notepad) and save them in UTF-8 without Byte Order Marks.  I am not sure this will fix it, but there is a chance it might.  

Another thing to look for would be garbage in the files themselves.

You might also want to rethink this:
error_reporting(E_ALL& ~E_NOTICE);

What that line of code means to you is that if you make a typographical error somewhere in that script or in any other script included after that script, PHP will not tell you about it.  Instead PHP will silently ignore reliance on undefined variables.  This is AntiPractice #4 -- it can make debugging very, very difficult.

You might also want to ask yourself what purpose the $lang variable plays.  It appears to be injected into the symbol table, and made global (why?) but not used in the script.
0
 

Author Closing Comment

by:petewinter
ID: 39838987
Many thanks. You advice has help me find a solution
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39839084
Thanks for the points.  Best of luck with the project, ~Ray
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now