Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
php script include file problem
Old 07-08-2010, 08:39 PM php script include file problem
Novice Talker

Posts: 6
Trades: 0
I purchased a template and I was beginning to write php code to make the admin. I am having a problem that the site is showing up in chrome and firefox properly, but in internet explorer, the whole code is messed up.

At the top of the page I have an include with php code, that if I take it out the site displays properly. Why should this include effect anything? the php does not give any html output...

in google chrome I viewed the source and i see a character like a dash before the html tag, though it is not a character that I can copy and paste.

Can someone help me please? This is urgent, I have a deadline for the project.

More Information: URL of the site is: http://skubu.com/sys/superadmin/login.php

the problem I am having is in internet explorer 8. If you make a comparison, the page shows fine in all browsers other than ie (tested in chrome and firefox).

The code for login.php is:

PHP Code:
<?php
include 'inc/settings.php';

if (isset(
$_SESSION["username"]))
    
$username $_SESSION["username"];
elseif (isset(
$_COOKIE["username"]))
    
$username $_COOKIE["username"];
    
if (isset(
$_SESSION["password"]))
    
$password $_SESSION["password"];
elseif (isset(
$_COOKIE["password"]))
    
$password $_COOKIE["password"];
    
if (isset(
$_COOKIE["remember"]))
    
$remember $_COOKIE["remember"];
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $login_title;?></title>
<link href="css/960.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/reset.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/text.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/login<?php echo $dir;?>.css" rel="stylesheet" type="text/css" media="all" />
</head>

<body dir="<?php echo $dir;?>">
<div class="container_16">
  <div class="grid_6 prefix_5 suffix_5">
         <h1><?php echo $login_title;?></h1>
        <div id="login">
          <!--<p class="tip">You just need to hit the button and you're in!</p>-->
          <?php
            
if (isset($_SESSION["errors"]))
                foreach (
$_SESSION["errors"] as $err)
                    echo 
'<p class="error">'.$err.'!</p>';
          
?>
          <form id="form1" name="form1" method="post" action="doLogin.php">
            <p>
              <label><strong><?php echo $login_username;?></strong>
<input type="text" name="username" class="inputText" id="textfield" value="<?php if (isset($username)) echo $username;?>"/>
              </label>
            </p>
            <p>
              <label><strong><?php echo $login_password;?></strong>
  <input type="password" name="password" class="inputText" id="textfield2" value="<?php if (isset($password)) echo $password;?>"/>
              </label>
            </p>
            <a class="black_button" href="#" onClick="document.form1.submit();"><span><?php echo $login_login;?></span></a>
             <label>
             <input type="checkbox" name="remember" id="checkbox" <?php if (isset($remember)) echo $remember;?>/>
              <?php echo $login_remember;?></label>            
          </form>
          <br clear="all" />
          <a href="<?php echo $_SERVER['PHP_SELF'];?>?lang=english"><img src = "images\flag_icons\png\us.png" style="height:15px;" alt="english" border="0"></a>
          <a href="<?php echo $_SERVER['PHP_SELF'];?>?lang=hebrew"><img src = "images\flag_icons\png\il.png" style="height:15px;" alt="hebrew" border="0"></a>
        </div>
        <div id="forgot">
        <a href="#" class="forgotlink"><span><?php echo $login_forgot;?></span></a></div>
  </div>
</div>
<br clear="all" />
</body>
</html>
<?php
unset($_SESSION["errors"]);
unset(
$_SESSION["username"]);
unset(
$_SESSION["password"]);
?>
meirarmon is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-08-2010, 08:50 PM Re: php script include file problem
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
From the top closing php tag ?> and the open <!DOCTYPE...

You have multiple strange charactures in there that look like a space and newline to the eye, but it is throwing IE in quirks mode.

Replace anything in there with a simple newline and that should solve it (?)
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 07-09-2010, 03:41 AM Re: php script include file problem
Novice Talker

Posts: 6
Trades: 0
Thank you for the reply.

What do you mean by a newline character? where should I put it?
meirarmon is offline
Reply With Quote
View Public Profile
 
Old 07-09-2010, 04:32 AM Re: php script include file problem
Novice Talker

Posts: 6
Trades: 0
Also, when I comment out the include at the top, it works fine.
meirarmon is offline
Reply With Quote
View Public Profile
 
Old 07-09-2010, 06:10 AM Re: php script include file problem
Defies a Status

Posts: 1,606
Trades: 0
That would lead me to believe that it might be something in the settings.php file that is causing the problem. Can you post a copy of that file? Use **** stars to edit any confidential info in what your post.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 07-09-2010, 06:12 AM Re: php script include file problem
Novice Talker

Posts: 6
Trades: 0
PHP Code:
<?php
$conn_host 
"*****";
$conn_username "*****";
$conn_password "*****";
$conn_database "*****";

include 
'inc/functions.php';
include 
'lang/'.determineLanguageFile().'.php';

//classes
include '../lib/class_database.php';
include 
'../lib/class_user.php';

session_start();

auth(); //check if user is logged in
?>
meirarmon is offline
Reply With Quote
View Public Profile
 
Old 07-09-2010, 06:41 AM Re: php script include file problem
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
there is a bunch of unicode characters "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">"
before the DTD which will "break" IE
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-09-2010, 06:56 AM Re: php script include file problem
Novice Talker

Posts: 6
Trades: 0
Where did they come from? in all my php code i did not output any html. I am trying to get rid of them.
meirarmon is offline
Reply With Quote
View Public Profile
 
Old 07-09-2010, 12:07 PM Re: php script include file problem
Defies a Status

Posts: 1,606
Trades: 0
What do you use for a text editor? Notepad does weird things sometimes and all word processors do almost all the time. Grab a free copy of notepad2 or the like to use for editing.

Nothing jumped out at me in the file above.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 07-11-2010, 07:42 AM Re: php script include file problem
Novice Talker

Posts: 6
Trades: 0
I managed to solve it.

What I did was, I converted all the encoding of the include files to utf8 without BOM and it worked. Can anyone tell me why this was the solution?

Thanks for everything
meirarmon is offline
Reply With Quote
View Public Profile
 
Old 07-11-2010, 08:15 AM Re: php script include file problem
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Because the BOM is before the DTD which "breaks" IE by putting it into "quirks mode".

The characters before the DTD means that IE will ignore the Doctype and (mis)behave as if the DTD was not there
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-12-2010, 04:42 PM Re: php script include file problem
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
Quote:
Originally Posted by meirarmon View Post
I managed to solve it.

What I did was, I converted all the encoding of the include files to utf8 without BOM and it worked. Can anyone tell me why this was the solution?

Thanks for everything
What is BOM?
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 07-12-2010, 05:31 PM Re: php script include file problem
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Byte Order Mark

It indicates whether the document is using "big endian" or "little endian" coding.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to php script include file problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.42759 seconds with 12 queries