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
Warning: Header may not contain more than a single header, new line detected???
Old 06-14-2006, 06:57 AM Warning: Header may not contain more than a single header, new line detected???
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Hi

Im getting an error msg ive never seen before, can anybody shed some light on what it means please, this is the error-

Warning: Header may not contain more than a single header, new line detected. in /home/thedoors/public_html/your_systems_process.php on line 35

and this is the page of code:
PHP Code:

<?php
include('dbinfo.php');
$name $_POST["name"];
//$image = $_POST["image"];
$email $_POST["email"];
$bob='0';

if(
trim($email)   =='')                                                               { $bob='1';}
else{  if(!
ereg("[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]"$email)){ $bob='1';} 
  else if( 
ereg("[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]"$email)){$bob='0';} }
if(
trim($name)=='' || strlen(trim($name)) <|| strlen(trim($name)) >30)                  {$bob='1'; } 
                    
//if(trim($image)=='' || strlen(trim($image)) <2 || strlen(trim($image))>10000){$bob='1'; } 
if ($bob== "1")
  {
//1 if the submitted data was wrong redisplay form
  
header("Location:your_systems.php?email=$email&name=$name"); 
 exit();
    }
//1
else
  {
//1 otherwise the submitted data was ok, save to mysql 
  
move_uploaded_file($_FILES['imagefile']['tmp_name'],"latest.img");
  
$instr fopen("latest.img","rb");
  
$image addslashes(fread($instr,filesize("latest.img")));
  
$status 'pending';

 
  if (
strlen($instr) < 149000
    { 
//2 if the file is the right size insert it
    
mysql_query ("insert into your_systems  (title, imgdata, date, email, status) values (
                \""
.$_REQUEST[whatsit]."\",
                \""
.$image."\",
                NOW(),
                \""
.$email."\",
                \""
.$status."\")");
//BELOW IS LINE 35
 
header("Location:your_systems_finish.php?email=$email&name=$name&image=$image&msg=1"); 
 exit();
    }
//2
    
  
else 
    {
//2 otherwise the image is too big 
      
header("Location:your_systems_finish.php?email=$email&name=$name&image=$image&msg=0"); 
 exit();
 
        
        
    }
//2
}//1
Ive highlighted line 35 where the error occurrs in the above code. There is a header(location) prior to the one at line 35 but the user should only ever encounter 1 header as they are all seperated by if/ else if statments. Anybody got any ideas?

Thanks in advance

Mark
hiptobesquare is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-14-2006, 01:59 PM Re: Warning: Header may not contain more than a single header, new line detected???
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
Perhaps one of your variables $email, $name, $image contain a newline. Pass them through urlencode() first.

Also note that with Location, you need to use a full URL, not just a path. So http://mydomain.com/your_systems_finish.php.. If you do not, then some browsers may not redirect the user as expected.
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 06-15-2006, 04:55 PM Re: Warning: Header may not contain more than a single header, new line detected???
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Yes you are right. $image didn't hold a value, i deleted it from the url and now it works. I didn't know you had to put the whole url into the header, i will do that too. Thanks
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Old 02-29-2008, 03:46 AM Re: Warning: Header may not contain more than a single header, new line detected???
Junior Talker

Posts: 1
Trades: 0
Hey, I have a solution for this:

You may not have spaces in vars you put in the $location beneath, so do this:
$location = ereg_replace( ' +', '%20', $location );
header("Location:$location");

This error was generated after a migration to PHP5.
Remco is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Warning: Header may not contain more than a single header, new line detected???
 

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.14160 seconds with 12 queries