Header Location Problem

Status
Not open for further replies.

xevell

Member
Messages
39
Reaction score
0
Points
6
Hi x10hosting staff

I would like to know if there's any problem with my site
since I am trying to develop a web application but for some
strange reason I am having problems and getting the
following error:

Warning: Cannot modify header information - headers already sent by (output started at /home/xevell/public_html/SignCard/Scripts/functions.php:100) in /home/xevell/public_html/SignCard/Scripts/process.php on line 12

Since the application is in its basic level I went easily
through every single line looking for any output before
the header function but I couldnt find anything, however
I keep on getting the same error message.

The website is http://xevic.net
The application is located in http://xevic.net/SingCard
and the error I am getting it in http://xevic.net/SignCard/Scripts/process.php?Action=RegForm

Thanks Guys.
 
Last edited:

Christopher

Retired
Messages
14,659
Reaction score
8
Points
0
You are trying to execute code that should be executed before anything is sent to the browser.
What is line 12 of /home/xevell/public_html/SignCard/Scripts/process.php
 

xevell

Member
Messages
39
Reaction score
0
Points
6
Code:
<?php

	require("functions.php");
	
	switch($_GET['Action']){
		case "RegForm":
			$signuser = safe($_POST['signusr']);
			$signpasswd = safe($_POST['signpwd']);
					
			if(authentication($signuser,$signpasswd) == 1 || authentication($signuser,$signpasswd == 3)){
				$authreturn = authentication($signuser,signpasswd);
				header("Location: /index.php?Msg=".$authreturn);
			}elseif(authentication($signuser,$signpasswd) == 2){    //They Good, Proceed to sign in/out
				if(checkstatus($signuser)){     
					signout();
				}else{
					signin();
				}
		
			}
		break;
			}
	
	
	?>

That's the file nothing is outputted before
 

Christopher

Retired
Messages
14,659
Reaction score
8
Points
0
header("Location: /index.php?Msg=".$authreturn);
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

You can use output buffering to fix the problem.
http://www.phpit.net/article/output-buffer-fun-php/
 
Last edited:

xevell

Member
Messages
39
Reaction score
0
Points
6
It is useful the ansewer given, but I would like to know whats really causing the problem if there is no output sent before the header function.

Thanks
 

Christopher

Retired
Messages
14,659
Reaction score
8
Points
0
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.
 

xevell

Member
Messages
39
Reaction score
0
Points
6
But I wonder why the error says that the function page included is the one starting the output at line 100 but when I checked it line 100 is ?> meaning the end of the script there is no output.

Could it be a server problem or something?
 

Corey

I Break Things
Staff member
Messages
34,553
Reaction score
204
Points
63
No, it's not a server problem. This is a standard PHP Error.

Remember white space counts as output.

-Corey
 
Status
Not open for further replies.
Top