Jump to content

Recommended Posts

Can the byte order mark have an effect on the stylesheet? I was editing a php file and as soon as I saved it, the entire layout of my website was distorted, well in IE, but both browsers the font size has increased  :confused:

 

I have never came across something like this in years. I think I changed the encoding but it may of placed a BOM on every page.

I have no idea how to rectify this... anyhelp would be nice!

 

http://team-x1.co.uk/site/

Link to comment
https://forums.phpfreaks.com/topic/218986-something-went-badly-wrong-bom/
Share on other sites

I don't think there is any problem with the code..

I changed the safe_query function in the below code, then noticed the layout change, reverted changes back but layout did not revert back.

 

It's strange.

 

<?php
/*
##########################################################################
#                                                                        #
#           Version 4       /                        /   /               #
#          -----------__---/__---__------__----__---/---/-               #
#           | /| /  /___) /   ) (_ `   /   ) /___) /   /                 #
#          _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___               #
#                       Free Content / Management System                 #
#                                   /                                    #
#                                                                        #
#                                                                        #
#   Copyright 2005-2010 by webspell.org                                  #
#                                                                        #
#   visit webSPELL.org, webspell.info to get webSPELL for free           #
#   - Script runs under the GNU GENERAL PUBLIC LICENSE                   #
#   - It's NOT allowed to remove this copyright-tag                      #
#   -- http://www.fsf.org/licensing/licenses/gpl.html                    #
#                                                                        #
#   Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at),   #
#   Far Development by Development Team - webspell.org                   #
#                                                                        #
#   visit webspell.org                                                   #
#                                                                        #
##########################################################################
*/

// -- ERROR REPORTING -- //

define('DEBUG', "ON");
error_reporting(0); // E_ALL = public mode, E_ALL = development-mode

// -- SET ENCODING FOR MB-FUNCTIONS -- //

mb_internal_encoding("UTF-8");

// -- SET HTTP ENCODING -- //

header('content-type: text/html; charset=utf-8');

// -- CONNECTION TO MYSQL -- //

mysql_connect($host, $user, $pwd) or system_error('ERROR: Can not connect to MySQL-Server');
mysql_select_db($db) or system_error('ERROR: Can not connect to database "'.$db.'"');

mysql_query("SET NAMES 'utf8'");

// -- GENERAL PROTECTIONS -- //

function globalskiller() {		// kills all non-system variables

  $global = array('GLOBALS', '_POST', '_GET', '_COOKIE', '_FILES', '_SERVER', '_ENV',  '_REQUEST', '_SESSION');
  foreach ($GLOBALS as $key=>$val) {
  	if(!in_array($key, $global)) {
  		if(is_array($val)) unset_array($GLOBALS[$key]);
  		else unset($GLOBALS[$key]);
  	}
  }
}

function unset_array($array) {

foreach($array as $key) {
	if(is_array($key)) unset_array($key);
	else unset($key);
}
}

globalskiller();

if(isset($_GET['site'])) $site=$_GET['site'];
else $site= null;
if($site!="search") {
$request=strtolower(urldecode($_SERVER['QUERY_STRING']));
$protarray=array("union","select","into","where","update ","from","/*","set ",PREFIX."user ",PREFIX."user(",PREFIX."user`",PREFIX."user_groups","phpinfo",
"escapeshellarg","exec","fopen","fwrite","escapeshellcmd","passthru","proc_close","proc_get_status","proc_nice",
"proc_open","proc_terminate","shell_exec","system","telnet","ssh","cmd","mv","chmod","chdir","locate","killall",
"passwd","kill","script","bash","perl","mysql","~root",".history","~nobody","getenv"
);
$check=str_replace($protarray, '*', $request);
if($request != $check) system_error("Invalid request detected.");
}

function security_slashes(&$array) {
foreach($array as $key => $value) {
	if(is_array($array[$key])) {
		security_slashes($array[$key]);
	}
	else {
		if(get_magic_quotes_gpc()) {
			$tmp = stripslashes($value);
		}
		else {
			$tmp = $value;
		}
		if(function_exists("mysql_real_escape_string")) {
			$array[$key] = mysql_real_escape_string($tmp);
		}
		else {
			$array[$key] = addslashes($tmp);
		}
		unset($tmp);
	}
}
}

security_slashes($_POST);
security_slashes($_COOKIE);
security_slashes($_GET);
security_slashes($_REQUEST);

// -- MYSQL QUERY FUNCTION -- //
$_mysql_querys = array();
function safe_query($query="") {
global $_mysql_querys;
if(stristr(str_replace(' ', '', $query), "unionselect")===FALSE AND stristr(str_replace(' ', '', $query), "union(select")===FALSE){
	$_mysql_querys[] = $query;
	if(empty($query)) return false;
	if(DEBUG == "OFF") $result = mysql_query($query) or die('Query failed!');
	else {
		$result = mysql_query($query) or die('Query failed: '
		.'<li>errorno='.mysql_errno()
		.'<li>error='.mysql_error()
		.'<li>query='.$query);
	}
	return $result;
}
else die();
}

// -- SYSTEM ERROR DISPLAY -- //

function system_error($text,$system=1) {
if($system) {
	include('version.php');
	$info='webSPELL Version: '.$version.'<br />PHP Version: '.phpversion().'<br />MySQL Version: '.mysql_get_server_info().'<br />';
} else {
	$info = '';
}
die('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="description" content="Clanpage using webSPELL 4 CMS" />
  <meta name="author" content="webspell.org" />
  <meta name="keywords" content="webspell, webspell4, clan, cms" />
  <meta name="copyright" content="Copyright © 2005 - 2009 by webspell.org" />
  <meta name="generator" content="webSPELL" />
  <title>webSPELL</title>
  </head>
  <body>
  <center>
  <table border="0" cellpadding="1" cellspacing="1" bgcolor="#eeeeee">
    <tr>
      <td><a href="http://www.webspell.org" target="_blank"><img src="images/banner.gif" style="border:none;" alt="webSPELL.org" title="webSPELL.org" /></a></td>
    </tr>
    <tr bgcolor="#ffffff">
      <td><div style="color:#333333;font-family:Tahoma,Verdana,Arial;font-size:11px;padding:5px;">'.$info.'<br /><font color="red">'.$text.'</font><br /> </div></td>
    </tr>
    <tr bgcolor="#ffffff">
      <td><div style="color:#333333;font-family:Tahoma,Verdana,Arial;font-size:11px;padding:5px;">For support visit <a href="http://webspell.org" target="_blank">webspell.org</a></div></td>
    </tr>
  </table>
  </center>
  </body>
  </html>');
}

// -- SYSTEM FILE INCLUDE -- //

function systeminc($file) {
if(!include('src/'.$file.'.php')) system_error('Could not get system file for '.$file);
}

// -- IGNORED USERS -- //

function isignored($userID, $buddy) {
$anz=mysql_num_rows(safe_query("SELECT userID FROM ".PREFIX."buddys WHERE buddy='$buddy' AND userID='$userID' "));
if($anz) {
	$ergebnis=safe_query("SELECT * FROM ".PREFIX."buddys WHERE buddy='$buddy' AND userID='$userID' ");
	$ds=mysql_fetch_array($ergebnis);
	if($ds['banned']==1) return 1;
	else return 0;
}
else return 0;
}

// -- GLOBAL SETTINGS -- //

$ds = mysql_fetch_array(safe_query("SELECT * FROM ".PREFIX."settings"));

$maxshownnews				=	$ds['news']; 				if(empty($maxshownnews)) $maxshownnews = 10;
$maxnewsarchiv				=	$ds['newsarchiv']; 			if(empty($maxnewsarchiv)) $maxnewsarchiv = 20;
$maxheadlines				=	$ds['headlines']; 			if(empty($maxheadlines)) $maxheadlines = 10;
$maxheadlinechars			=	$ds['headlineschars']; 		if(empty($maxheadlinechars)) $maxheadlinechars = 18;
$maxtopnewschars			=	$ds['topnewschars']; 		if(empty($maxtopnewschars)) $maxtopnewschars = 200;
$maxarticles				=	$ds['articles']; 			if(empty($maxarticles)) $maxarticles = 20;
$latestarticles				=	$ds['latestarticles']; 		if(empty($latestarticles)) $latestarticles = 5;
$articleschars				=	$ds['articleschars']; 		if(empty($articleschars)) $articleschars = 18;
$maxclanwars				=	$ds['clanwars']; 			if(empty($maxclanwars)) $maxclanwars = 20;
$maxresults					=	$ds['results']; 			if(empty($maxresults)) $maxresults = 5;
$maxupcoming				=	$ds['upcoming']; 			if(empty($maxupcoming)) $maxupcoming = 5;
$maxguestbook				=	$ds['guestbook']; 			if(empty($maxguestbook)) $maxguestbook = 20;
$maxshoutbox				=	$ds['shoutbox']; 			if(empty($maxshoutbox)) $maxshoutbox = 5;
$maxsball					=	$ds['sball']; 				if(empty($latestarticles)) $latestarticles = 5;
$sbrefresh					=	$ds['sbrefresh']; 			if(empty($sbrefresh)) $sbrefresh = 60;
$maxtopics					=	$ds['topics']; 				if(empty($maxtopics)) $maxtopics = 20;
$maxposts					=	$ds['posts']; 				if(empty($maxposts)) $maxposts = 10;
$maxlatesttopics			=	$ds['latesttopics']; 		if(empty($maxlatesttopics)) $maxlatesttopics = 10;
$maxlatesttopicchars		=	$ds['latesttopicchars']; 	if(empty($maxlatesttopicchars)) $maxlatesttopicchars = 18;
$maxfeedback				=	$ds['feedback']; 			if(empty($maxfeedback)) $maxfeedback = 5;
$maxmessages				=	$ds['messages']; 			if(empty($maxmessages)) $maxmessages = 5;
$maxusers					=	$ds['users']; 				if(empty($maxusers)) $maxusers = 5;
$hp_url						=	$ds['hpurl'];
$admin_name					=	$ds['adminname'];
$admin_email				=	$ds['adminemail'];
$myclantag					=	$ds['clantag'];
$myclanname					=	$ds['clanname'];
$maxarticles				=	$ds['articles']; 			if(empty($maxarticles)) $maxarticles = 5;
$maxawards					=	$ds['awards']; 				if(empty($maxawards)) $maxawards = 20;
$maxdemos					=	$ds['demos']; 				if(empty($maxdemos)) $maxdemos = 20;
$profilelast				=	$ds['profilelast']; 		if(empty($profilelast)) $profilelast = 20;
$topnewsID					=	$ds['topnewsID'];
$sessionduration			=	$ds['sessionduration']; 	if(empty($sessionduration)) $sessionduration = 24;
$closed						=	(int)$ds['closed'];
$gb_info					=	$ds['gb_info'];
$imprint_type				=	$ds['imprint'];
$picsize_l					=	$ds['picsize_l'];			if(empty($picsize_l)) $picsize_l = 9999;
$picsize_h					=	$ds['picsize_h'];			if(empty($picsize_h)) $picsize_h = 9999;
$gallerypictures			=	$ds['pictures'];
$publicadmin				=	$ds['publicadmin'];
$thumbwidth					=	$ds['thumbwidth'];  		if(empty($thumbwidth)) $thumbwidth = 120;
$usergalleries				=	$ds['usergalleries'];
$maxusergalleries			=	$ds['maxusergalleries'];
$default_language			=	$ds['default_language']; 	if(empty($default_language)) $default_language = 'uk';
$rss_default_language		=	$ds['default_language']; 	if(empty($rss_default_language)) $rss_default_language = 'uk';
$search_min_len				=	$ds['search_min_len']; 		if(empty($search_min_len)) $search_min_len = '4';
$autoresize 				= 	$ds['autoresize']; 			if(!isset($autoresize)) $autoresize = 2;
$max_wrong_pw 				= 	$ds['max_wrong_pw']; 		if(empty($max_wrong_pw)) $max_wrong_pw = 3;
$lastBanCheck 				= 	$ds['bancheck']; 
$insertlinks				=	$ds['insertlinks'];
$new_chmod = 0666;

// -- STYLES -- //

$ergebnis=safe_query("SELECT * FROM ".PREFIX."styles");
$ds=mysql_fetch_array($ergebnis);

define('PAGEBG', $ds['bgpage']);
define('BORDER', $ds['border']);
define('BGHEAD', $ds['bghead']);
define('BGCAT', $ds['bgcat']);
define('BG_1', $ds['bg1']);
define('BG_2', $ds['bg2']);
define('BG_3', $ds['bg3']);
define('BG_4', $ds['bg4']);

$hp_title = stripslashes($ds['title']);
$pagebg = PAGEBG;
$border = BORDER;
$bghead = BGHEAD;
$bgcat  = BGCAT;

$wincolor = $ds['win'];
$loosecolor = $ds['loose'];
$drawcolor = $ds['draw'];
?>

The UTF-8 representation of the BOM is the byte sequence 0xEF,0xBB,0xBF, which appears as the ISO-8859-1 characters  in most text editors and web browsers not prepared to handle UTF-8. -- http://en.wikipedia.org/wiki/Byte_order_mark

 

It seems you do have a BOM issue (look in the upper left corner). This text preceding the HTML tag has the nasty effect of enlarging your font size.

I managed to solve that but I have a problem with php header location. None of my headers location works.. it is blank?

 

For example in PHP, if output buffering is disabled, it has the subtle effect of causing the page to start being sent to the browser, preventing custom headers from being specified by the PHP script. -- http://en.wikipedia.org/wiki/Byte_order_mark
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.