PHP include problem

Discussion in 'Programming/Scripts' started by meirarmon, Jul 9, 2010.

  1. meirarmon

    meirarmon New Member

    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:
    <?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"]);
    ?>
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Did you clear IE's browser cache?
     
  3. meirarmon

    meirarmon New Member

    yes, it still does not work
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Does inc/settings.php generate any output?
     
  5. meirarmon

    meirarmon New Member

    no, there is not output.
     
  6. meirarmon

    meirarmon New Member

    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
     

Share This Page