/    Sign up×
Community /Pin to ProfileBookmark

header problem

Hi the below code is give me an error

Warning: Header may not contain more than a single header, new line detected. in /mnt/w0400/d11/s01/b02a5c57/www/etreasures.ca/Scripts/codeEmailMembers.php on line 29

I cannot figure out where the second header is being send from

any help is excellent

[code=php]
<?php
include (“../Connections/db.php”);

$subject = $_POST[‘subject’];
$message = $_POST[‘message’];

$x = 1;
$hold = 50; // quantity of emails sent before 3 sec delay
$emails = mysql_query(“SELECT email_address FROM members”);

$email_count=mysql_num_rows($emails);

while ($sendemail = mysql_fetch_array($emails)) {
$email = $sendemail[“email_address”];
mail($email, $subject,
$message, “From:eTreasures.ca <[email protected]>”);

$x++;
if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout
sleep(3);
$x = 0;

} // end of while loop
}

$msg .= “<script language=”JavaScript”>n”;
$msg .= “alert(‘$email_count email(s) have been sent’);n”;
$msg .= “</script>”;
header (“location: ../admin/emailMembers.php?msg=$msg”);
?>
[/code]

to post a comment
PHP

10 Comments(s)

Copy linkTweet thisAlerts:
@kprocauthorFeb 18.2007 — I figured out the header problem, its not sending to all the people in the database.

it sent to the first 50.
[code=php]
<?php
include ("../Connections/db.php");

$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);

$x = 1;
$hold = 50; // quantity of emails sent before 3 sec delay
$emails = mysql_query("SELECT email_address FROM solicitation WHERE date_emailed != '2007-02-17'")or die (mysql_error());

$email_count=mysql_num_rows($emails);
$dateMailed = date("Y-m-d");
while ($sendemail = mysql_fetch_array($emails)) {
$email = $sendemail["email_address"];

mysql_query("UPDATE solicitation SET date_emailed = '$dateMailed' WHERE email_address = '$email'")or die (mysql_error());

mail($email, $subject,
$message, "From:eTreasures.ca <[email protected]>");

$x++;
if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout
sleep(3);
$x = 0;


} // end of while loop
}
?>
<?php
$msg = "<script language="JavaScript">n";
$msg .= "alert('$email_count email(s) have been sent');n";
$msg .= "</script>";
$msg .= "Emails Sent";
$msg = urlencode($msg);
header("location: ../admin/solicitationEmailer.php?msg=$msg");
?>
[/code]
Copy linkTweet thisAlerts:
@kprocauthorFeb 18.2007 — as it goes through the loop it pop asking to down load the form.. Not shure why this is happening
Copy linkTweet thisAlerts:
@kprocauthorFeb 18.2007 — I'm having a problem with headers on this page, it works great until the last section

thank you

Warning: Header may not contain more than a single header, new line detected. in /mnt/w0400/d11/s01/b02a5c57/www/etreasures.ca/Scripts/CodeChangePassword.php on line 52
[code=php]
<?php session_start();
include ("../Connections/db.php");

if(isset($submit_password)){
$user_id = $_SESSION['user_id'];
$email_address =$_SESSION['email_address'];

$new_password = $_POST['new_password'];
$confirm_password = $_POST['confirm_password'];

if($new_password != $confirm_password){

$msg .= 'Passwords do not match.<br />';

urlencode($msg);
header("Location: ../portal/editprofile.php?msg=$msg");
exit();
}

if(($new_password =="")) {

$msg .= 'Enter Password.<br />';


urlencode($msg);
header("Location: ../portal/editprofile.php?msg=$msg");
exit();
}
$db_password = md5($new_password);

$sql = mysql_query("UPDATE members SET password='$db_password' WHERE user_id='$user_id'");

$subject = "You changed your password at Etreasures!";
$message = "Save this email as it contains the password that you selected.
Not to worry your password has been encrypted to protect your privacy

New Password: $new_password

http://www.etreasures.ca

Thanks!
etreasures.ca

This is an automated response, please do not reply!";

mail($email_address, $subject, $message, "From: Etreasures.ca<[email protected]>");


$msg = "Your Password has been changed. You will receive an email
with your new password!";
urlencode($msg);
header("Location: ../portal/editprofile.php?msg=$msg");
}
?>
[/code]
Copy linkTweet thisAlerts:
@NightShift58Feb 18.2007 — Change:[code=php] $msg = "Your Password has been changed. You will receive an email
with your new password!";
urlencode($msg);
header("Location: ../portal/editprofile.php?msg=$msg"); [/code]
to this:[code=php]
$msg = "Your Password has been changed. You will receive an email with your new password!";
// the above on 1 (one) line, no line breaks...
urlencode($msg);
header("Location: ../portal/editprofile.php?msg=$msg"); [/code]
Copy linkTweet thisAlerts:
@bokehFeb 18.2007 — And by the way, according to RFC2616 the argument to [I]Location[/I] should be absolute.
Copy linkTweet thisAlerts:
@kprocauthorFeb 18.2007 — thanks that fixed the problem

I'm not sure what you mean by this
according to RFC2616 the argument to Location should be absolute.[/QUOTE]
Copy linkTweet thisAlerts:
@bokehFeb 18.2007 — I'm not sure what you mean by this[/QUOTE][B]RFC2616[/B]

[I][B]14.30 Location[/B]

The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion of the request or identification of a new resource. [...] For 3xx responses, the location SHOULD indicate the server's preferred URI for automatic redirection to the resource. The field value consists of a single [COLOR="Red"][B]absolute URI[/B][/COLOR].



Location = "Location" ":" [COLOR="Red"][B]absoluteURI[/B][/COLOR][/I]
Copy linkTweet thisAlerts:
@kprocauthorFeb 18.2007 — I picked up a bad habit some where, should I be going through all my pages and fixing this
Copy linkTweet thisAlerts:
@bokehFeb 18.2007 — I picked up a bad habit some where, should I be going through all my pages and fixing this[/QUOTE]Well none of the majority browsers I have tried stumble on this but it is incorrect.
Copy linkTweet thisAlerts:
@kprocauthorFeb 18.2007 — As I work thought my pages I will fix it thanks for the information
×

Success!

Help @kproc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...