Solved

session help in php login script

Posted on 2007-11-28
24
604 Views
Last Modified: 2012-08-14
Im getting this error with this file and cant seem to figure it out.

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/devlendc/public_html/login.php:1) in /home/devlendc/public_html/login.php on line 2

<?php

session_start();

include 'config.php';

if(isset($_POST['login']))

{
 

	$username = trim(addslashes($_POST['username']));

	$password = md5(trim($_POST['password']));

	

	$query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error());

	

	$row = mysql_fetch_array($query);

	

	// now we check if they are activated

	

	if(mysql_num_rows($query) > 0)

	{

		

		if($row['Activated'] > 0)

		{

		

			$_SESSION['s_logged_n'] = 'true';

			$_SESSION['s_username'] = $username;

			$_SESSION['s_name'] = $row['Name'];

			

			header("Location: member.php");

			

		} else {

		

			echo '

			<html>

			<head>

			<title>Login</title>

			<link href="devlend.css" rel="stylesheet" type="text/css">

			

			</head>

			

			<body>

			<div id="error"><p>Sorry, you must activate your account first. Please check your email for the email.</p>

			<p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p></div>

			</body>

			</html>

			';

			

		}

			

	} else {

	

		echo '

		<html>

		<head>

		<title>Login</title>

		<link href="devlend.css" rel="stylesheet" type="text/css">

		</head>

		

		<body>

		<div id="error"><p>There was an error processing your login, it appears that your username and/or password was incorrect. Please try again.</p>

		  <p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>
 

		</div>

		</body>

		</html>

		';

		

	}
 

} else {

?>

<html>

<head>

<title>DevLend</title>

<style type="text/css">

	<!--

	@import url("devlend.css");

	-->

</style>

<script src="AC_RunActiveContent.js" type="text/javascript"></script>

<body>

<div id="wrapper">
 

<div id="head">the login page</div><br>

<div id="main"> 
 

<div id="kontener">
 

<div id="fejlec">

  <script type="text/javascript">

AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','860','height','200','src','header','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','header' ); //end AC code

</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="860" height="200">

    <param name="movie" value="header.swf">

    <param name="quality" value="high">

    <embed src="header.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="860" height="200"></embed>

  </object>

</noscript></div>
 

<div id="bal">
 

		<div class="fekete" id="bal_box">

		<div id="icon"><img src="images/icon_form.gif" width="43" height="45" /> <img src="images/txt_currentjobs.gif" width="115" height="24" /></div>

		<br /><a href="index.php">Home</a></li>

		<br /><a href="register.php">Register</a></li>

		<br /><a href="login.php">Login</a></li>

		<br /><a href="members.php">Downloads</a></li>
 

        </div>

</div>

<!--end of bal-->
 

<div id="jobb">
 

	<div id="cikk" class="szoveg">

      <p> 

      <blockquote>

        <p>You must login to view this page. Enter your username and password below and hit submit:</p>

      </blockquote>

      <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">

    <blockquote>

      <blockquote>

        <p>Username:<br>

              <input name="username" type="text" class="textBox" id="username">

          

            </p>

        <p>Password:<br>

            <input name="password" type="password" class="textBox" id="password">

              </p>

        <p>

          <input name="login" type="submit" class="textBox" id="login" value="Submit">

          </p>

      </blockquote>

    </blockquote>

  </form>

  <blockquote>

    <p>Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>

    <p>Need an account? <a href="register.php">Click here</a> to register, it's completely free! </p>

  </blockquote>

  </p>

      <p>&nbsp;</p>

      <br />

      <br />

	</div>	<!--end of cikk-->

</div>

<!--end of jobb-->

</div>

<!--end of kontener-->
 

<div id="lablec">

	<div id="lableft"></div>

	<div id="labkozep" class="szoveg2" align="center">

	  <div align="left"><a href="index.php">Home</a> | <a href="register.php">Register</a> | <a href="login.php">Login</a> | <a href="members.php">Downloads</a></div>

	</div>

<div id="labkozep2" align="center">

		<a href="http://www.webartdesign.com.au" target="_blank"><img src="images/wad_mini.gif" width="150" height="20" border="0" /></a>	</div>

	<div id="labright"></div>

</div>
 

</body>

</html>

<? } mysql_close($l); ?>

Open in new window

0
Comment
Question by:aarondarr
  • 10
  • 6
  • 2
  • +4
24 Comments
 
LVL 20

Expert Comment

by:steelseth12
ID: 20365191
try putting session_start() at the very first line

<?php session_start();
0
 

Author Comment

by:aarondarr
ID: 20365218
I get the same error just now on line one.


Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/devlendc/public_html/login.php:1) in /home/devlendc/public_html/login.php on line 1
0
 
LVL 40

Expert Comment

by:RQuadling
ID: 20365222
Are you sure there is no space in front?

If you can do a view-source on the output, can you cut and paste from the beginning of the saved source?
0
 
LVL 20

Expert Comment

by:steelseth12
ID: 20365228
any white space before <?php

???
0
 
LVL 40

Expert Comment

by:RQuadling
ID: 20365238
You may have an auto_prepend_file setting doing something.

Checking the output in the browser should show what was sent prior to the error message.

0
 

Author Comment

by:aarondarr
ID: 20365275
the start of the view source:

<br />
<b>Warning</b>:  session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home/devlendc/public_html/login.php:1) in <b>/home/devlendc/public_html/login.php</b> on line <b>1</b><br />
<html>
<head>
<title>DevLend</title>
<style type="text/css">
      <!--
      @import url("devlend.css");
      -->
</style>
0
 
LVL 1

Expert Comment

by:itsbth
ID: 20365614
Is the file saved as UTF-8?
What editor do you use?
0
 
LVL 12

Expert Comment

by:Rok-Kralj
ID: 20366012
Just open it in normal notepad (windows) or gedit (linux)... Remove all spaces in front of <?php.
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 20366275
also check if there is already session started before this page or inclusion of this page contains the session start.,
0
 
LVL 12

Expert Comment

by:Rok-Kralj
ID: 20367029
Your new code:
<?php

ob_start();

session_start();

include 'config.php';

if(isset($_POST['login']))

{

 

        $username = trim(addslashes($_POST['username']));

        $password = md5(trim($_POST['password']));

        

        $query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error());

        

        $row = mysql_fetch_array($query);

        

        // now we check if they are activated

        

        if(mysql_num_rows($query) > 0)

        {

                

                if($row['Activated'] > 0)

                {

                

                        $_SESSION['s_logged_n'] = 'true';

                        $_SESSION['s_username'] = $username;

                        $_SESSION['s_name'] = $row['Name'];

                        

                        header("Location: member.php");

                        

                } else {

                

                        echo '

                        <html>

                        <head>

                        <title>Login</title>

                        <link href="devlend.css" rel="stylesheet" type="text/css">

                        

                        </head>

                        

                        <body>

                        <div id="error"><p>Sorry, you must activate your account first. Please check your email for the email.</p>

                        <p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p></div>

                        </body>

                        </html>

                        ';

                        

                }

                        

        } else {

        

                echo '

                <html>

                <head>

                <title>Login</title>

                <link href="devlend.css" rel="stylesheet" type="text/css">

                </head>

                

                <body>

                <div id="error"><p>There was an error processing your login, it appears that your username and/or password was incorrect. Please try again.</p>

                  <p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>

 

                </div>

                </body>

                </html>

                ';

                

        }

 

} else {

?>

<html>

<head>

<title>DevLend</title>

<style type="text/css">

        <!--

        @import url("devlend.css");

        -->

</style>

<script src="AC_RunActiveContent.js" type="text/javascript"></script>

<body>

<div id="wrapper">

 

<div id="head">the login page</div><br>

<div id="main"> 

 

<div id="kontener">

 

<div id="fejlec">

  <script type="text/javascript">

AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','860','height','200','src','header','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','header' ); //end AC code

</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="860" height="200">

    <param name="movie" value="header.swf">

    <param name="quality" value="high">

    <embed src="header.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="860" height="200"></embed>

  </object>

</noscript></div>

 

<div id="bal">

 

                <div class="fekete" id="bal_box">

                <div id="icon"><img src="images/icon_form.gif" width="43" height="45" /> <img src="images/txt_currentjobs.gif" width="115" height="24" /></div>

                <br /><a href="index.php">Home</a></li>

                <br /><a href="register.php">Register</a></li>

                <br /><a href="login.php">Login</a></li>

                <br /><a href="members.php">Downloads</a></li>

 

        </div>

</div>

<!--end of bal-->

 

<div id="jobb">

 

        <div id="cikk" class="szoveg">

      <p> 

      <blockquote>

        <p>You must login to view this page. Enter your username and password below and hit submit:</p>

      </blockquote>

      <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">

    <blockquote>

      <blockquote>

        <p>Username:<br>

              <input name="username" type="text" class="textBox" id="username">

          

            </p>

        <p>Password:<br>

            <input name="password" type="password" class="textBox" id="password">

              </p>

        <p>

          <input name="login" type="submit" class="textBox" id="login" value="Submit">

          </p>

      </blockquote>

    </blockquote>

  </form>

  <blockquote>

    <p>Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>

    <p>Need an account? <a href="register.php">Click here</a> to register, it's completely free! </p>

  </blockquote>

  </p>

      <p>&nbsp;</p>

      <br />

      <br />

        </div>  <!--end of cikk-->

</div>

<!--end of jobb-->

</div>

<!--end of kontener-->

 

<div id="lablec">

        <div id="lableft"></div>

        <div id="labkozep" class="szoveg2" align="center">

          <div align="left"><a href="index.php">Home</a> | <a href="register.php">Register</a> | <a href="login.php">Login</a> | <a href="members.php">Downloads</a></div>

        </div>

<div id="labkozep2" align="center">

                <a href="http://www.webartdesign.com.au" target="_blank"><img src="images/wad_mini.gif" width="150" height="20" border="0" /></a>       </div>

        <div id="labright"></div>

</div>

 

</body>

</html>

<? } mysql_close($l); ?>

Open in new window

0
 
LVL 17

Expert Comment

by:nplib
ID: 20367234
what's in the config.php file?
0
 

Author Comment

by:aarondarr
ID: 20369926
itsbth: - I use dreamweaver

Rok-Kralj - opened in notepad there are no spaces in front of the <?php tag

logudotcom - I can navigate straight to this page and still have he error, the only onclude is config.php and this is just a database connection, there is no white space or startsession in this file

Rok-Kralj - the new code with the added line ob_start(); didnt work.

nplib - config.php has the connection to the database.


looking at the error on the page it seems to be formatted by the css file.

you can view this error yourself at www.devlend.com.au/login.php

Thanks guys for all your help so far.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 40

Expert Comment

by:RQuadling
ID: 20372334
My guess would be you have the auto session start setting enabled.

Can you create this file as info.php

<?php phpinfo(); ?>

and then load if through your browser.

Now take a look for (and supply) the SESSION related content.

This is mine ...

session
Session Support       enabled
Registered save handlers       files user
Registered serializer handlers       php php_binary wddx

Directive      Local Value      Master Value
session.auto_start      Off      Off <<<<<<<<<<<<<<<<<<<<<<< IMPORTANT ONE TO CHECK
session.bug_compat_42      Off      Off
session.bug_compat_warn      On      On
session.cache_expire      180      180
session.cache_limiter      nocache      nocache
session.cookie_domain      no value      no value
session.cookie_httponly      Off      Off
session.cookie_lifetime      0      0
session.cookie_path      /      /
session.cookie_secure      Off      Off
session.entropy_file      no value      no value
session.entropy_length      0      0
session.gc_divisor      1      1
session.gc_maxlifetime      3660      3660
session.gc_probability      1      1
session.hash_bits_per_character      6      6
session.hash_function      1      1
session.name      PHPSESSID      PHPSESSID
session.referer_check      no value      no value
session.save_handler      files      files
session.save_path      D:\Data\PHP\Sessions      D:\Data\PHP\Sessions
session.serialize_handler      php      php
session.use_cookies      On      On
session.use_only_cookies      On      On
session.use_trans_sid      0      0

0
 
LVL 40

Expert Comment

by:RQuadling
ID: 20372350
As a test, try the following steps ...

1 - Don't use session_start();
2 - Populate the $_SESSION with something.
3 - Reload the page.

<?php
var_dump($_SESSION);
$_SESSION['Set'] = 'Set';
var_dump($_SESSION);
?>

With no auto start I get ...

Notice: Undefined variable: _SESSION in D:\Data\Web Sites\Quick Scripts\public_html\sesstest.php on line 2
NULL array(1) { ["Set"]=> string(3) "Set" }

repeatedly.


With auto start enabled, I get ...

array(0) {} array(1) { ["Set"]=>  string(3) "Set" }

first and then ...

array(1) { ["Set"]=>  string(3) "Set" } array(1) { ["Set"]=>  string(3) "Set" }

for every repeat page.

Now, if I add a session_start() to the top of the script I get ...


Notice: A session had already been started - ignoring session_start() in D:\Data\Web Sites\Quick Scripts\public_html\sesstest.php on line 2
array(1) { ["Set"]=> string(3) "Set" } array(1) { ["Set"]=> string(3) "Set" }

0
 
LVL 40

Expert Comment

by:RQuadling
ID: 20372358
I'm on PHP 5.3.0-dev (cli) (built: Nov 20 2007 08:19:12), so the text is probably different due to the different versions.
0
 

Author Comment

by:aarondarr
ID: 20372478
RQuadling: here is the info.. www.devlend.com.au/info.php

session
Session Support       enabled
Registered save handlers       files user mm

Directive      Local Value      Master Value
session.auto_start      Off      Off
session.bug_compat_42      On      On
session.bug_compat_warn      On      On
session.cache_expire      180      180
session.cache_limiter      nocache      nocache
session.cookie_domain      no value      no value
session.cookie_lifetime      0      0
session.cookie_path      /      /
session.cookie_secure      Off      Off
session.entropy_file      no value      no value
session.entropy_length      0      0
session.gc_divisor      100      100
session.gc_maxlifetime      1440      1440
session.gc_probability      1      1
session.name      PHPSESSID      PHPSESSID
session.referer_check      no value      no value
session.save_handler      files      files
session.save_path      /tmp      /tmp
session.serialize_handler      php      php
session.use_cookies      On      On
session.use_only_cookies      Off      Off
session.use_trans_sid      Off      Off
0
 

Author Comment

by:aarondarr
ID: 20372501
I just added

<?php
var_dump($_SESSION);
$_SESSION['Set'] = 'Set';
var_dump($_SESSION);
?>

to the top and I get the same error

NULL array(1) { ["Set"]=>  string(3) "Set" }
0
 

Author Comment

by:aarondarr
ID: 20372508
latest code - i have no idea what is going wrong..
<?php

var_dump($_SESSION);

$_SESSION['Set'] = 'Set';

var_dump($_SESSION);
 

include 'config.php';

if(isset($_POST['login']))

{
 

	$username = trim(addslashes($_POST['username']));

	$password = md5(trim($_POST['password']));

	

	$query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error());

	

	$row = mysql_fetch_array($query);

	

	// now we check if they are activated

	

	if(mysql_num_rows($query) > 0)

	{

		

		if($row['Activated'] > 0)

		{

		

			$_SESSION['s_logged_n'] = 'true';

			$_SESSION['s_username'] = $username;

			$_SESSION['s_name'] = $row['Name'];

			

			header("Location: member.php");

			

		} else {

		

			echo '

			<html>

			<head>

			<title>Login</title>

			<link href="devlend.css" rel="stylesheet" type="text/css">

			

			</head>

			

			<body>

			<div id="error"><p>Sorry, you must activate your account first. Please check your email for the email.</p>

			<p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p></div>

			</body>

			</html>

			';

			

		}

			

	} else {

	

		echo '

		<html>

		<head>

		<title>Login</title>

		<link href="devlend.css" rel="stylesheet" type="text/css">

		</head>

		

		<body>

		<div id="error"><p>There was an error processing your login, it appears that your username and/or password was incorrect. Please try again.</p>

		  <p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>
 

		</div>

		</body>

		</html>

		';

		

	}
 

} else {

?>

<html>

<head>

<title>DevLend</title>

<style type="text/css">

	<!--

	@import url("devlend.css");

	-->

</style>

<script src="AC_RunActiveContent.js" type="text/javascript"></script>

<body>

<div id="kontener"><div id="fejlec"><script type="text/javascript">

AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','860','height','200','src','header','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','header' ); //end AC code

</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="860" height="200">

    <param name="movie" value="header.swf">

    <param name="quality" value="high">

    <embed src="header.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="860" height="200"></embed>

  </object>

</noscript></div>
 

<div id="bal">
 

		<div class="fekete" id="bal_box">

		<div id="icon"><img src="images/icon_form.gif" width="43" height="45" /> <img src="images/txt_currentjobs.gif" width="115" height="24" /></div>

		<br /><a href="index.php">Home</a></li>

		<br /><a href="register.php">Register</a></li>

		<br /><a href="login.php">Login</a></li>

		<br /><a href="members.php">Downloads</a></li>
 

        </div>

</div>

<!--end of bal-->
 

<div id="jobb">
 

	<div id="cikk" class="szoveg">

      <p> 

      <blockquote>

        <p>You must login to view this page. Enter your username and password below and hit submit:</p>

      </blockquote>

      <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">

    <blockquote>

      <blockquote>

        <p>Username:<br>

              <input name="username" type="text" class="textBox" id="username">

          

            </p>

        <p>Password:<br>

            <input name="password" type="password" class="textBox" id="password">

              </p>

        <p>

          <input name="login" type="submit" class="textBox" id="login" value="Submit">

          </p>

      </blockquote>

    </blockquote>

  </form>

  <blockquote>

    <p>Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>

    <p>Need an account? <a href="register.php">Click here</a> to register, it's completely free! </p>

  </blockquote>

  </p>

      <p>&nbsp;</p>

      <br />

      <br />

	</div>	<!--end of cikk-->

</div>

<!--end of jobb-->

</div>

<!--end of kontener-->
 

<div id="lablec">

	<div id="lableft"></div>

	<div id="labkozep" class="szoveg2" align="center">

	  <div align="left"><a href="index.php">Home</a> | <a href="register.php">Register</a> | <a href="login.php">Login</a> | <a href="members.php">Downloads</a></div>

	</div>

<div id="labkozep2" align="center">

		<a href="http://www.webartdesign.com.au" target="_blank"><img src="images/wad_mini.gif" width="150" height="20" border="0" /></a>	</div>

	<div id="labright"></div>

</div>
 

</body>

</html>

<? } mysql_close($l); ?>

Open in new window

0
 
LVL 40

Expert Comment

by:RQuadling
ID: 20373120
Did you check the phpinfo ?

Remove the session_start();
0
 
LVL 40

Expert Comment

by:RQuadling
ID: 20373131
To repeat myself ...

It is most likely that your php.ini file (or equivalent) has enabled auto session start. This means that every page automatically has sessions available to it, so you don't have to initialize them yourself.

0
 
LVL 40

Expert Comment

by:RQuadling
ID: 20373248
And next time, I'll read the posts too! Sorry.

Next thing to check is to see if the auto_prepend_file is set. (The info.php page is blank)

Also, do you have permissions to save in the /tmp folder?


I changed my session folder to a bad location and got (Using PHP 4.4.7-dev (cgi-fcgi) (built: Mar 25 2007 21:02:43)) ...

Warning: session_start() [function.session-start]: open(C:\Data\PHP\Sessions\sess_66f176d2b4ea291d3e87584fda923c45, O_RDWR) failed: No such file or directory (2) in D:\Data\Web Sites\Quick Scripts\public_html\sesstest.php4 on line 2

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\Data\Web Sites\Quick Scripts\public_html\sesstest.php4:2) in D:\Data\Web Sites\Quick Scripts\public_html\sesstest.php4 on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\Data\Web Sites\Quick Scripts\public_html\sesstest.php4:2) in D:\Data\Web Sites\Quick Scripts\public_html\sesstest.php4 on line 2
array(0) { } array(1) { ["Set"]=> string(3) "Set" }
Warning: Unknown(): open(C:\Data\PHP\Sessions\sess_66f176d2b4ea291d3e87584fda923c45, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\Data\PHP\Sessions) in Unknown on line 0


Can you use http://ee-stuff.com and place the login.php file there. The original file (with no debugs).



0
 
LVL 40

Expert Comment

by:RQuadling
ID: 20373279
I've just used WireShark to see what is actually sent/received.

Sent

GET /login.php HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, */*
Accept-Language: en-GB
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
Host: www.devlend.com.au
Connection: Keep-Alive

Recevied

HTTP/1.1 200 OK
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
Date: Thu, 29 Nov 2007 13:25:56 GMT
Content-Type: text/html
Server: Apache/1.3.39 (Unix) PHP/4.4.7 mod_auth_passthrough/1.8 mod_bwlimited/1.4 mod_log_bytes/1.2 mod_gzip/1.3.26.1a FrontPage/5.0.2.2635 mod_ssl/2.8.30 OpenSSL/0.9.7a
X-Powered-By: PHP/4.4.7
Keep-Alive: timeout=15, max=100



e5f
...<br />
<b>Warning</b>:  session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /home/devlendc/public_html/login.php:1) in <b>/home/devlendc/public_html/login.php</b> on line <b>1</b><br />
<br />
<b>Warning</b>:  session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home/devlendc/public_html/login.php:1) in <b>/home/devlendc/public_html/login.php</b> on line <b>1</b><br />
<html>
<head>
<title>DevLend</title>
<style type="text/css">
.<!--
.@import url("devlend.css");
.-->
</style>
<script src="AC_RunActiveContent.js" type="text/javascript"></script>
<body>



The important bit to note is the "e5f..."

In hex this is below.

I've highlighted the errors.

The next question is why.

Not too sure. Yet.


00000000  48 54 54 50 2f 31 2e 31  20 32 30 30 20 4f 4b 0d HTTP/1.1  200 OK.

00000010  0a 56 69 61 3a 20 31 2e  31 20 42 41 4e 44 4d 41 .Via: 1. 1 BANDMA

00000020  49 4c 0d 0a 43 6f 6e 6e  65 63 74 69 6f 6e 3a 20 IL..Conn ection: 

00000030  4b 65 65 70 2d 41 6c 69  76 65 0d 0a 50 72 6f 78 Keep-Ali ve..Prox

00000040  79 2d 43 6f 6e 6e 65 63  74 69 6f 6e 3a 20 4b 65 y-Connec tion: Ke

00000050  65 70 2d 41 6c 69 76 65  0d 0a 54 72 61 6e 73 66 ep-Alive ..Transf

00000060  65 72 2d 45 6e 63 6f 64  69 6e 67 3a 20 63 68 75 er-Encod ing: chu

00000070  6e 6b 65 64 0d 0a 44 61  74 65 3a 20 54 68 75 2c nked..Da te: Thu,

00000080  20 32 39 20 4e 6f 76 20  32 30 30 37 20 31 33 3a  29 Nov  2007 13:

00000090  32 35 3a 35 36 20 47 4d  54 0d 0a 43 6f 6e 74 65 25:56 GM T..Conte

000000A0  6e 74 2d 54 79 70 65 3a  20 74 65 78 74 2f 68 74 nt-Type:  text/ht

000000B0  6d 6c 0d 0a 53 65 72 76  65 72 3a 20 41 70 61 63 ml..Serv er: Apac

000000C0  68 65 2f 31 2e 33 2e 33  39 20 28 55 6e 69 78 29 he/1.3.3 9 (Unix)

000000D0  20 50 48 50 2f 34 2e 34  2e 37 20 6d 6f 64 5f 61  PHP/4.4 .7 mod_a

000000E0  75 74 68 5f 70 61 73 73  74 68 72 6f 75 67 68 2f uth_pass through/

000000F0  31 2e 38 20 6d 6f 64 5f  62 77 6c 69 6d 69 74 65 1.8 mod_ bwlimite

00000100  64 2f 31 2e 34 20 6d 6f  64 5f 6c 6f 67 5f 62 79 d/1.4 mo d_log_by

00000110  74 65 73 2f 31 2e 32 20  6d 6f 64 5f 67 7a 69 70 tes/1.2  mod_gzip

00000120  2f 31 2e 33 2e 32 36 2e  31 61 20 46 72 6f 6e 74 /1.3.26. 1a Front

00000130  50 61 67 65 2f 35 2e 30  2e 32 2e 32 36 33 35 20 Page/5.0 .2.2635 

00000140  6d 6f 64 5f 73 73 6c 2f  32 2e 38 2e 33 30 20 4f mod_ssl/ 2.8.30 O

00000150  70 65 6e 53 53 4c 2f 30  2e 39 2e 37 61 0d 0a 58 penSSL/0 .9.7a..X

00000160  2d 50 6f 77 65 72 65 64  2d 42 79 3a 20 50 48 50 -Powered -By: PHP

00000170  2f 34 2e 34 2e 37 0d 0a  4b 65 65 70 2d 41 6c 69 /4.4.7.. Keep-Ali

00000180  76 65 3a 20 74 69 6d 65  6f 75 74 3d 31 35 2c 20 ve: time out=15, 

00000190  6d 61 78 3d 31 30 30 0d  0a 0d 0a 65 35 66 0d 0a max=100. ...e5f..

                                                                       ^^^^^

000001A0  ef bb bf 3c 62 72 20 2f  3e 0a 3c 62 3e 57 61 72 ...<br / >.<b>War

                                                           ^^^

000001B0  6e 69 6e 67 3c 2f 62 3e  3a 20 20 73 65 73 73 69 ning</b> :  sessi

Open in new window

0
 
LVL 1

Accepted Solution

by:
itsbth earned 250 total points
ID: 20375318
The problem is that the file is saved as UTF-8 with Byte Order Mark (BOM) http://en.wikipedia.org/wiki/Byte_Order_Mark
The solution is to save it without BOM, or in another encoding.
How to disable BOM or use another encoding depends on the editor you're using, so I can't really help you without knowing what editor you use. For example, in Notepad++ it can be done with opening the format menu and selecting "Convert to UTF-8 (Without BOM)".
0
 
LVL 40

Assisted Solution

by:RQuadling
RQuadling earned 250 total points
ID: 20379439
BOM is a royal pain in the arse!

I believe that PHP6 will support/deal with this - PHP is unicode compliant - a LOT of work has been done for this.

And very good catch itsbth.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article discusses how to create an extensible mechanism for linked drop downs.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

744 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

13 Experts available now in Live!

Get 1:1 Help Now