I have been trying to fix my website for over a week now and I am at a loss for what to do.

The siite functions normally for the most part. You can browse, search, view pages, list items, and even bid on items.

The website is http://www.bidnshop.com/phpauction/

The username is: buy_computers

The password is: 123456

Please try it out to see what I mean.

The problem is when logging in or out. It gives a message like this:

Warning: Cannot modify header information - headers already sent by (output started at /home/bidnshop/public_html/phpauction/phpAdsNew/config.inc.php:277) in /home/bidnshop/public_html/phpauction/user_login.php on line 48


There is no login error since it actually does log you in and if you back up to the main page, you will be successfully logged in and can access your account and auction information.

I have searched through the scripts for an error or break and cannot find anything that should prevent the page from coming up correctly.

The header and footer seem to come up fine anytime other than when submitting the login/logout function.

I am really frustrated because I don't have the knowledge to fix this problem.

I would even be willing to pay someone for assistance (Paypal, of course).

Also, I would like to send a "Thank You" to everyone who has answered any of my previous posts about this problem. Your experience and consideration are a gift for which I am very grateful.

If you need to contact me, please do so.

I can supply copies of any or all scripts used on my site for your observance.

Thanks for your taking tim to read this post,

ProZ@
BID-n-SHOP

    The easy way out (if you want a quick temp until you can find what's wrong) would be to use a meta tag to redirect:
    echo("<meta http-equiv=\"refresh\" content=\"0; URL=index.php\">");

    I'd suggest looking at your config.inc.php file at line 277, and see what was printed, and why.

      Neither one of the config.inc.php files have 277 lines so how can I fix i?.

      One has 203 and the other has 263.

      I tried different text editors and the numbers were the same.

        Open up config.inc.php and if you're using a text editor or php editor, search the script for the word

        "header" (wihout the quotes)

        find where that function is called, and make sure that there is nothing outputted to the visitor before the call to header(), including html and spaces.

        echo " ";
        
        header("location: bla.php");

        Would cause an error as well as

        
        echo "<html>";
        echo "<body>";
        
        header("Location: bla.php");

        Because you are outputting something to the visitor's browser in both cases.

        Cgraz

          I have looked at the scripts that are called when logging in/out and have not the ability to find any HTML before the header script is called. (I hope I said that dorrectly)

          I think I have tried everything that has been suggested so far.

          Could it possibly be anything else? I do notice that index.php is called in one of the login scripts. Does that mean that it should go to the main page?

          Here are the login scripts one-by-one:

          logout.php

          <?
          include "includes/config.inc.php";

          session_name($SESSION_NAME);
          session_unregister("PHPAUCTION_LOGGED_IN");
          session_unregister("PHPAUCTION_LOGGED_IN_USERNAME");
          
          Header("Location: index.php");
          exit;

          ?>


          login.php

          <?
          include "includes/config.inc.php";

          if($action && $username && password)
          {
          	$query = "select id from PHPAUCTION_users where nick='$username' and password='".md5($MD5_PREFIX.$password)."' and suspended=0";
          	$res = mysql_query($query);
          	//print $query;;
          	if(mysql_num_rows($res) > 0)
          	{
          		$PHPAUCTION_LOGGED_IN = mysql_result($res,0,"id");
          		$PHPAUCTION_LOGGED_IN_USERNAME = $HTTP_POST_VARS[username];
          		session_name($SESSION_NAME);
          		session_register("PHPAUCTION_LOGGED_IN","PHPAUCTION_LOGGED_IN_USERNAME");
          	}
          }
          
          Header("Location: $HTTP_REFERER");
          exit;

          ?>


          user_login.php

          <?
          /*
          include "./includes/messages.inc.php";
          include "./includes/config.inc.php";
          include "./includes/countries.inc.php";

          if(empty($action))
          {
          	$action = "login";
          }
          
          if ($HTTP_POST_VARS[action] != "login") 
          {
          	include "header.php";	
          	include "templates/template_user_login_php.html";
          }
          
          
          if ($HTTP_POST_VARS[action] == "login") 
          {
          	$query = "select id from PHPAUCTION_users where nick='$username' and password='".md5($MD5_PREFIX.$password)."' and suspended=0";
          	$res = mysql_query($query);
          	//print $query;;
          	if(mysql_num_rows($res) > 0)
          	{
          		$PHPAUCTION_LOGGED_IN = mysql_result($res,0,"id");
          		$PHPAUCTION_LOGGED_IN_USERNAME = $HTTP_POST_VARS[username];
          		session_name($SESSION_NAME);
          		session_register("PHPAUCTION_LOGGED_IN","PHPAUCTION_LOGGED_IN_USERNAME");
          		Header("Location: user_menu.php");
          		exit;
          	}
          	else
          	{
          		$TPL_err=1;
          		$TPL_errmsg = $ERR_038;
          		include "header.php";	
          		include "templates/template_user_login_php.html";
          	}
          }
          
          if ($REQUEST_METHOD=="POST" && $action=="update") 
          {
          	if ($TPL_email && $TPL_address && $TPL_city && $TPL_country && $TPL_zip && $TPL_phone && TPL_nletter) 
          	{
          
          	 if (strlen($TPL_password)<6 && strlen($TPL_password) > 0) 
          		{
          			$TPL_err=1;
          			$TPL_errmsg=$ERR_011;
          		}
          		else if ($TPL_password!=$TPL_repeat_password) 
          		{
          			$TPL_err=1;
          			$TPL_errmsg=$ERR_109;
          		}
          		else if (strlen($TPL_email)<5)		//Primitive mail check 
          		{
          			$TPL_err=1;
          			$TPL_errmsg=$ERR_110;
          		}
          		else if (strlen($TPL_zip)<5) //Primitive zip check
          		{
          			$TPL_err=1;
          			$TPL_errmsg=$ERR_616;
          		}
          		else if (strlen($TPL_phone)<3) //Primitive phone check
          		{
          			$TPL_err=1;
          			$TPL_errmsg=$ERR_617;
          		}
          		else 
          		{
          			$TPL_birthdate = substr($TPL_birthdate,6,4).
          								  substr($TPL_birthdate,0,2).
          								  substr($TPL_birthdate,3,2);
          
          			$sql="UPDATE PHPAUCTION_users SET email=\"".			AddSlashes($TPL_email)
          
          							 ."\", birthdate=\"".	AddSlashes($TPL_birthdate)
          							 ."\", address=\"".		AddSlashes($TPL_address)
          							 ."\", city=\"".			AddSlashes($TPL_city)
          							 ."\", prov=\"".			AddSlashes($TPL_prov)
          							 ."\", country=\"".		AddSlashes($TPL_country)
          							 ."\", zip=\"".			AddSlashes($TPL_zip)
          							 ."\", phone=\"".			AddSlashes($TPL_phone)
          
          							  ."\", nletter=\"".			AddSlashes($TPL_nletter);
          
          			if(strlen($TPL_password) > 0)
          			{	
          				$sql .= 	"\", password=\"".		md5($MD5_PREFIX.AddSlashes($TPL_password));
          			}
          
          			$sql .= "\" WHERE id='".			AddSlashes($TPL_id_hidden)."'";
          			$res=mysql_query ($sql);
          
          			include "header.php";	
          			include "templates/template_updated.html";
          
          		}
          	}
          	else 
          	{
          		$TPL_err=1;
          		$TPL_errmsg=$ERR_112;
          	}
          }
          
          
          
          
          include "footer.php";
          $TPL_err=0;
          $TPL_errmsg="";

          ?>


          user_menu.php

          <SCRIPT Language=PHP>

          */

          // Include messages file	

          require('./includes/messages.inc.php');

          // Connect to sql server & inizialize configuration variables
          require('./includes/config.inc.php');

          #// If user is not logged in redirect to login page
          if(!isset($HTTP_SESSION_VARS["PHPAUCTION_LOGGED_IN"]))
          {
          	Header("Location: user_login.php");
          	exit;
          }

          </SCRIPT>

          <HTML>
          <HEAD>
          <TITLE><? print $SETTINGS[sitename]?></TITLE>

          </HEAD>

          <BODY BGCOLOR="#FFFFFF" >

          <?

          require("header.php");
          include "templates/template_user_menu_php.html";
          include "./footer.php";

          ?>
          </BODY>
          </HTML>


            Open the file that it says has already sent the headers. The php parser obviously thinks that there are 177 lines so check that there are no carriage returns at the end of the file or tabs or any other control characters as these are sent to the browser and can be responsible for the error you are getting. you can do this by going to the end of the file using the arrows keys, this will let you see where the file actually ends. Otherwise open the file in word and choose the show control characters option or view. This will let you see where they are appearing.

            Try this - let me know how you go!

            Cheers

              Just have a:

              You have been sucessfully logged in.
              You will be returned to the website in 5 seconds.

              If Not then please click here.

              Then use the meta refresh.

              This is also good as you are telling the user that he/she has been logged in rather than just carrying on through the site without any direct notification.

                LiquidChild, I am so glad you put in your 2Β’.

                You have solved my problem. (at least that one-ha!)

                Without even realizing it, some empty lines were somehow added to the scripts when I uploaded them to my server.

                My thanks to all who have contributed to my ongoing education.

                Have a great day!

                ProZπŸ™‚

                  2 years later

                  well i have phpauction running and well the prob it that when someone list a item say for 6 days as soon as they click to add it . It close the auction it dont run for 1 sec if you know how come this doing it you can email me at needtosa@needtosaleit.com thanks

                    Write a Reply...