Re: [PHP] Parse Error in my Mail Function -UPDATED

2002-06-07 Thread Anti-Blank

Lines 29, 30, and 31
//29
$headers = $from . "\r\n" . $bcc . "\r\n"
//30 - The Next Line is where I'm getting the parse Error at:
mail ($to, $setting_site_name, $mailpost, $headers) or $emailsuccess
="Failure sending email.";
//31
if ($emailsuccess == "") {$emailsuccess = "Email Sent Successfully.";}

- Original Message -
From: "Chris Knipe" <[EMAIL PROTECTED]>
To: "Anti-Blank" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, June 07, 2002 12:40 PM
Subject: Re: [PHP] Parse Error in my Mail Function -UPDATED


> >The problem being now I am getting a parse error on lines 30.
>
> Line 29, 30, and 31 is where exactly in all this??
>
>
> Kind Regards,
>
> Chris Knipe
> MegaLAN Corporate Networking Services
> Tel: +27 21 854 7064
> Cell: +27 72 434 7582
>
> - Original Message -
> From: "Anti-Blank" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, June 07, 2002 7:53 PM
> Subject: [PHP] Parse Error in my Mail Function -UPDATED
>
>
> Sorry I was too sleepy to realize the Red and BOLD wouldn't come through
on
> the list.  Here is the message again but I was smart enough this time to
> comment those section.
>
> All right I've used the help that I've gotten before about this and edited
> this function of code I have.  Initially the code was meant to mail out a
> post to every email that was listed in the database.  The problem was that
> it sent all the emails in the TO: section of the email.  Now being that I
> didn't want to give out the emails of everyone on the list, I wanted to
> instead hardcode the TO: section and then drop all of the emails from the
> database into the BCC: section.  The problem being now I am getting a
parse
> error on lines 30.  Included are the original code and my version(which is
> spitting the error).  If anyone can offer any insight as to what I'm
missing
> or messing up I should say it would be most appericated.
>
> ORIGINAL SECTION OF MAIL FUNCTION:
> function postNews () {
> // Get input from form, and members name.
> global $cookie_username, $headline, $post, $mail;
> // check to see if we should send email.
> if ($mail == "yes") {
> global $setting_site_name, $setting_site_url, $setting_mail_email;
> $fhandle = fopen("newstemps/mailpost.tmp", "r") or die("could not open
> newstemps/mailpost.tmp");
> $mailpost = fread($fhandle, filesize("newstemps/mailpost.tmp"));
> fclose ($fhandle);
>
> $mailpost = $mailpost;
> $mailpost = str_replace("{setting_site_name}", $setting_site_name,
> $mailpost);
> $mailpost = str_replace("{setting_site_url}", $setting_site_url,
$mailpost);
> $mailpost = str_replace("{setting_mail_email}", $setting_mail_email,
> $mailpost);
> $mailpost = str_replace("{post_poster}", $cookie_username, $mailpost);
> $mailpost = str_replace("{post_headline}", $headline, $mailpost);
> $mailpost = str_replace("{post_date}", date("M d, Y", time()), $mailpost);
> $mailpost = str_replace("{post_post}", $post, $mailpost);
>
> $to = "";
> $query = mysql_query("SELECT * FROM members");
> while ($member = mysql_fetch_array($query)) {
> if ($to == "") {$to = $member['email'];}
> else {$to .= ", " . $member['email'];}
> }
> $from = "from: " . $setting_mail_email;
> mail ($to, $setting_site_name, $mailpost, $from) or $emailsuccess =
"Failure
> sending email.";
> if ($emailsuccess == "") {$emailsuccess = "Email Sent Successfully.";}
> }
>
> MY MODIFIED SECTION (I've commented the sections I changed and also the
line
> with the parse error:)
>
> function postNews () {
> // Get input from form, and members name.
> global $cookie_username, $headline, $post, $mail;
> // check to see if we should send email.
> if ($mail == "yes") {
> global $setting_site_name, $setting_site_url, $setting_mail_email;
> $fhandle = fopen("newstemps/mailpost.tmp", "r") or die("could not open
> newstemps/mailpost.tmp");
> $mailpost = fread($fhandle, filesize("newstemps/mailpost.tmp"));
> fclose ($fhandle);
>
> $mailpost = $mailpost;
> $mailpost = str_replace("{setting_site_name}", $setting_site_name,
> $mailpost);
> $mailpost = str_replace("{setting_site_url}", $setting_site_url,
$mailpost);
> $mailpost = str_replace("{setting_mail_email}", $setting_mail_email,
> $mailpost);
> $mailpost = str_replace("{post_poster}", $cookie_username, $mailpost);

Re: [PHP] Parse Error in my Mailing Code

2002-06-07 Thread Anti-Blank

1) As for the nesting thats fine, I thought sections were clear, I suppose
not.
2) My apologies there, my client says that line wrapping is turned on.
3) The full text of the error message isn't very helpful at least not to me.

Parse error: parse error in /www/foo/htdocs/updates/functions.php on line 30

4)As for just the line in question:
mail ($to, $setting_site_name, $mailpost, $headers) or $emailsuccess =
"Failure sending email.";

Is that more helpful.  Or can you show me what exactly the error message is
saying so I can apperently easily go fix it.  Maybe I just don't understand
the small details of reading the error message.

Anti-Blank

- Original Message -
From: "Analysis & Solutions" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Friday, June 07, 2002 12:37 PM
Subject: Re: [PHP] Parse Error in my Mailing Code


> Dear Anonymous Person:
>
> To solve your problems and get prompt, accurate, friendly help from this
> list please...
>
> 1) Write readable code.  By that I mean use nesting.  That way we, and
>might I add, you, can quickly understand the logic of your script.
> 2) Turn line wrapping on in your email client.
> 3) Post the full text of the error message in question.
> 4) With simple things like parse errors, start by posting only the line
>with the error.
>
> But, before even getting to that point, go take a look at the error
> message and figure out which line is line 30.  Fix the error on that
> line that's explained in the error message.
>
> --Dan
>
> --
>PHP classes that make web design easier
> SQL Solution  |   Layout Solution   |  Form Solution
> sqlsolution.info  | layoutsolution.info |  formsolution.info
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Parse Error in my Mail Function -UPDATED

2002-06-07 Thread Anti-Blank

Sorry I was too sleepy to realize the Red and BOLD wouldn't come through on the list.  
Here is the message again but I was smart enough this time to comment those section.

All right I've used the help that I've gotten before about this and edited this 
function of code I have.  Initially the code was meant to mail out a post to every 
email that was listed in the database.  The problem was that it sent all the emails in 
the TO: section of the email.  Now being that I didn't want to give out the emails of 
everyone on the list, I wanted to instead hardcode the TO: section and then drop all 
of the emails from the database into the BCC: section.  The problem being now I am 
getting a parse error on lines 30.  Included are the original code and my 
version(which is spitting the error).  If anyone can offer any insight as to what I'm 
missing or messing up I should say it would be most appericated.

ORIGINAL SECTION OF MAIL FUNCTION:
function postNews () {
// Get input from form, and members name.
global $cookie_username, $headline, $post, $mail;
// check to see if we should send email.
if ($mail == "yes") {
global $setting_site_name, $setting_site_url, $setting_mail_email;
$fhandle = fopen("newstemps/mailpost.tmp", "r") or die("could not open 
newstemps/mailpost.tmp");
$mailpost = fread($fhandle, filesize("newstemps/mailpost.tmp"));
fclose ($fhandle);

$mailpost = $mailpost;
$mailpost = str_replace("{setting_site_name}", $setting_site_name, $mailpost);
$mailpost = str_replace("{setting_site_url}", $setting_site_url, $mailpost);
$mailpost = str_replace("{setting_mail_email}", $setting_mail_email, $mailpost);
$mailpost = str_replace("{post_poster}", $cookie_username, $mailpost);
$mailpost = str_replace("{post_headline}", $headline, $mailpost);
$mailpost = str_replace("{post_date}", date("M d, Y", time()), $mailpost);
$mailpost = str_replace("{post_post}", $post, $mailpost);

$to = "";
$query = mysql_query("SELECT * FROM members");
while ($member = mysql_fetch_array($query)) {
if ($to == "") {$to = $member['email'];}
else {$to .= ", " . $member['email'];}
}
$from = "from: " . $setting_mail_email;
mail ($to, $setting_site_name, $mailpost, $from) or $emailsuccess = "Failure sending 
email.";
if ($emailsuccess == "") {$emailsuccess = "Email Sent Successfully.";}
}

MY MODIFIED SECTION (I've commented the sections I changed and also the line with the 
parse error:)

function postNews () {
// Get input from form, and members name.
global $cookie_username, $headline, $post, $mail;
// check to see if we should send email.
if ($mail == "yes") {
global $setting_site_name, $setting_site_url, $setting_mail_email;
$fhandle = fopen("newstemps/mailpost.tmp", "r") or die("could not open 
newstemps/mailpost.tmp");
$mailpost = fread($fhandle, filesize("newstemps/mailpost.tmp"));
fclose ($fhandle);

$mailpost = $mailpost;
$mailpost = str_replace("{setting_site_name}", $setting_site_name, $mailpost);
$mailpost = str_replace("{setting_site_url}", $setting_site_url, $mailpost);
$mailpost = str_replace("{setting_mail_email}", $setting_mail_email, $mailpost);
$mailpost = str_replace("{post_poster}", $cookie_username, $mailpost);
$mailpost = str_replace("{post_headline}", $headline, $mailpost);
$mailpost = str_replace("{post_date}", date("M d, Y", time()), $mailpost);
$mailpost = str_replace("{post_post}", $post, $mailpost);

//Everything Below here is where my changes occur
$to = "[EMAIL PROTECTED]";
$from = "from: " . $setting_mail_email;
$bcc = "bcc: ";

$query = mysql_query("SELECT * FROM members");
while ($member = mysql_fetch_array($query)) {
  if ($bcc == "") {$bcc = $member['email'];}
  else {$bcc .= ", " . $member['email'];}
}

$headers = $from . "\r\n" . $bcc . "\r\n"
//The Next Line is where I'm getting the parse Error at
mail ($to, $setting_site_name, $mailpost, $headers) or $emailsuccess = "Failure 
sending email.";
if ($emailsuccess == "") {$emailsuccess = "Email Sent Successfully.";}
}

Thanks for any insight that anyone might have.






[PHP] Parse Error in my Mailing Code

2002-06-07 Thread Anti-Blank

All right I've used the help that I've gotten before about this and edited this 
function of code I have.  Initially the code was meant to mail out a post to every 
email that was listed in the database.  The problem was that it sent all the emails in 
the TO: section of the email.  Now being that I didn't want to give out the emails of 
everyone on the list, I wanted to instead hardcode the TO: section and then drop all 
of the emails from the database into the BCC: section.  The problem being now I am 
getting a parse error on lines 30.  Included are the original code and my 
version(which is spitting the error).  If anyone can offer any insight as to what I'm 
missing or messing up I should say it would be most appericated.

ORIGINAL SECTION OF MAIL FUNCTION:
function postNews () {
// Get input from form, and members name.
global $cookie_username, $headline, $post, $mail;
// check to see if we should send email.
if ($mail == "yes") {
global $setting_site_name, $setting_site_url, $setting_mail_email;
$fhandle = fopen("newstemps/mailpost.tmp", "r") or die("could not open 
newstemps/mailpost.tmp");
$mailpost = fread($fhandle, filesize("newstemps/mailpost.tmp"));
fclose ($fhandle);

$mailpost = $mailpost;
$mailpost = str_replace("{setting_site_name}", $setting_site_name, $mailpost);
$mailpost = str_replace("{setting_site_url}", $setting_site_url, $mailpost);
$mailpost = str_replace("{setting_mail_email}", $setting_mail_email, $mailpost);
$mailpost = str_replace("{post_poster}", $cookie_username, $mailpost);
$mailpost = str_replace("{post_headline}", $headline, $mailpost);
$mailpost = str_replace("{post_date}", date("M d, Y", time()), $mailpost);
$mailpost = str_replace("{post_post}", $post, $mailpost);

$to = "";
$query = mysql_query("SELECT * FROM members");
while ($member = mysql_fetch_array($query)) {
if ($to == "") {$to = $member['email'];}
else {$to .= ", " . $member['email'];}
}
$from = "from: " . $setting_mail_email;
mail ($to, $setting_site_name, $mailpost, $from) or $emailsuccess = "Failure sending 
email.";
if ($emailsuccess == "") {$emailsuccess = "Email Sent Successfully.";}
}

MY MODIFIED SECTION (I've set the more exact section I changed in bold & the line 
giving me the parse error is listed in red)

function postNews () {
// Get input from form, and members name.
global $cookie_username, $headline, $post, $mail;
// check to see if we should send email.
if ($mail == "yes") {
global $setting_site_name, $setting_site_url, $setting_mail_email;
$fhandle = fopen("newstemps/mailpost.tmp", "r") or die("could not open 
newstemps/mailpost.tmp");
$mailpost = fread($fhandle, filesize("newstemps/mailpost.tmp"));
fclose ($fhandle);

$mailpost = $mailpost;
$mailpost = str_replace("{setting_site_name}", $setting_site_name, $mailpost);
$mailpost = str_replace("{setting_site_url}", $setting_site_url, $mailpost);
$mailpost = str_replace("{setting_mail_email}", $setting_mail_email, $mailpost);
$mailpost = str_replace("{post_poster}", $cookie_username, $mailpost);
$mailpost = str_replace("{post_headline}", $headline, $mailpost);
$mailpost = str_replace("{post_date}", date("M d, Y", time()), $mailpost);
$mailpost = str_replace("{post_post}", $post, $mailpost);

$to = "[EMAIL PROTECTED]";
$from = "from: " . $setting_mail_email;
$bcc = "bcc: ";

$query = mysql_query("SELECT * FROM members");
while ($member = mysql_fetch_array($query)) {
  if ($bcc == "") {$bcc = $member['email'];}
  else {$bcc .= ", " . $member['email'];}
}

$headers = $from . "\r\n" . $bcc . "\r\n"
mail ($to, $setting_site_name, $mailpost, $headers) or $emailsuccess = "Failure 
sending email.";
if ($emailsuccess == "") {$emailsuccess = "Email Sent Successfully.";}
}

Thanks for any insight that anyone might have.





[PHP] Really slow include

2002-04-02 Thread anti-blank

I have a header section for my website and I'd like to include it into each page.  
Since this is where
I'm housing all of my navagation.  Here is my problem though.  I have the header 
tables sitting in a page
header.htm.  I'm calling it as so:


This works fine as long as I stay in the main folder /htdocs where the header.htm file 
is.
The problem lies when I go any deeper.  I tried replacing the link with:

Hoping that would put it back to the /htdocs folder as it works for my standard links. 
 Instead
I get this:
Fatal error: Failed opening required '/header.htm' 
(include_path='.:/usr/local/lib/php') in /www/foo/htdocs/foo/index_test.php on line 82

I've tried correcting it by including the full path: 
http://www.foo.com/header.htm";)
?>

This does work but it's so amazingly slow.  Even on my cable connection it will take 
20-30 seconds
to load this.  I've switched back and forth between require and include with no change 
in speed.  Anyone
have a suggestion or an idea on why my load time is suffering so much?

I hope all of that was clear enough.

Thanks
anti-blank



[PHP] Not to harp the subject Vins

2002-03-30 Thread anti-blank

But actually be it one email, two emails or 1000 emails what you did really is 
considered spam.

spam 
1.  (From Hormel's Spiced Ham, via the Monty Python "Spam" song) To post 
irrelevant or inappropriate messages to one or more Usenet newsgroups, mailing lists, 
or other messaging system in deliberate or accidental violation of netiquette. 
http://www.dictionary.com/search?q=spam


In all actualality what I am doing right now is considered Spam as well, and yet I 
will apologize for it.
But it's best not to start a flame war with people which is very well the route you 
are starting to take with this.
This is suppose to be a list for coding, for PHP to be specific, and no your post 
about your auction site to the
list is inappropriate material for the list.  So yes, it was Spam.  Your best bet 
really would have been to drop it,
let everyone chalk it up as a mistake on your part and move on, not:

> You people take everything too seriously.
> I'm sure you've also doen it once in you life before.
> 
> And a message for bvr and caspe kennerdale.
> You are obviousely Americans


1. I know very few people that have resorted to Spam, I run several pay sites and I 
won't do it, because it is bothersome
to people, and that isn't the way to attract clients/users.
2. What really is the relevance of your statement about how they must obviously be 
Americans?  This is the point I was
making about taking the wrong path and inciting a flame war.  It serves no purpose, 
undermines the list, and wastes 
people's email box space with useless mail.  

Again as I've admited this message itself can be considered Spam and it very well is.  
But I apologize for it, since it is not
in the topic of the list, but I for one prefer to see emails about code, not 'What 
I've always been waiting for'.

Thanks and my apologies for being off topic to the list.


Anti-Blank
Sr. Designer/Developer
Site Administrator
[EMAIL PROTECTED]




[PHP] From To to BCC in a Mail script

2002-03-24 Thread anti-blank

I've got this script here to send out a mail whenever I enter an update to my site to 
my mailing list.
The problem is it wants to dump everyone's email into the To field, and since I don't 
want to give my 
users email addresses away I need to convert this to the bcc field.  Below is the 
original code and then
the modification that I made (which doesn't seem to work).  Also if anyone has any 
idea how to include
in this block a line to tell php to send this as HTML email as well that would be even 
more helpful.  
Thanks.


ORIGINAL CODE:
$mailpost = $mailpost;
$mailpost = str_replace("{setting_site_name}", $setting_site_name, $mailpost);
$mailpost = str_replace("{setting_site_url}", $setting_site_url, $mailpost);
$mailpost = str_replace("{setting_mail_email}", $setting_mail_email, $mailpost);
$mailpost = str_replace("{post_poster}", $cookie_username, $mailpost);
$mailpost = str_replace("{post_headline}", $headline, $mailpost);
$mailpost = str_replace("{post_date}", date("M d, Y", time()), $mailpost);
$mailpost = str_replace("{post_post}", $post, $mailpost);
$to = "";
$query = mysql_query("SELECT * FROM members");
while ($member = mysql_fetch_array($query)) {
if ($to == "") {$to = $member['email'];}
else {$to .= ", " . $member['email'];}
}
$from = "from: " . $setting_mail_email;
mail ($to, $setting_site_name, $mailpost, $from) or $emailsuccess = "Failure sending 
email.";
if ($emailsuccess == "") {$emailsuccess = "Email Sent Successfully.";}
}



My MODIFIED CODE:
$mailpost = $mailpost;
$mailpost = str_replace("{setting_site_name}", $setting_site_name, $mailpost);
$mailpost = str_replace("{setting_site_url}", $setting_site_url, $mailpost);
$mailpost = str_replace("{setting_mail_email}", $setting_mail_email, $mailpost);
$mailpost = str_replace("{post_poster}", $cookie_username, $mailpost);
$mailpost = str_replace("{post_headline}", $headline, $mailpost);
$mailpost = str_replace("{post_date}", date("M d, Y", time()), $mailpost);
$mailpost = str_replace("{post_post}", $post, $mailpost);
$bcc = "";
$query = mysql_query("SELECT * FROM members");
while ($member = mysql_fetch_array($query)) {
if ($bcc == "") {$bcc = $member['email'];}
else {$bcc .= ", " . $member['email'];}
}
$from = "from: " . $setting_mail_email;
mail ($bcc, $setting_site_name, $mailpost, $from) or $emailsuccess = "Failure sending 
email.";
if ($emailsuccess == "") {$emailsuccess = "Email Sent Successfully.";}
}