Re: [PHP] Problem with comma in mail form

2002-12-26 Thread Ben Edwards
Here is the code with suggestion added, message still gets truncated after 
comma.

Ben

?

include( common.inc );

$db = open_db();

html_header( Contact Us );

if(isset($doit))
{
  $errors=array();

  check_email( $email, $errors );

  if(!isset ($message) || $message == '')
  {
array_push($errors, Message was empty);
  }

  if(sizeof($errors))
  {
include($SESSION[libdir] . /show_errors.inc);
  }
  else
  {

$admin_email  =
  \.lookup_domain( PARAMETERS, ADMIN_NAME, $db ).\ .
  lookup_domain( PARAMETERS, ADMIN_EMAIL, $db ).;

if(!isset($subject)) {
  $subject = Message from email form on $SERVER_NAME;
}

table_top(Sending mail...);
table_middle();

$msg = trim( stripslashes( $_POST[message] ) );

echo $msg;

mail( $admin_email, $subject, $msg, From: $email );

echo centerspan class=BigTextbrbrYour mail has been 
sent...brbr;
//echo redirect( $SESSION[homedir]./index.php, Home Page, 3 );
echo brbr/span/center;
table_bottom();
html_footer();
exit;
  }
}

table_top(Contact Us);

//echo( Contact Us );

table_middle();

$admin_email  = lookup_domain( PARAMETERS, ADMIN_EMAIL, $db );

?

center
br
bspan class=BigTextCultureShop.org, PO Box 29683, London E2 6XH/span/b
brbrb
To send us an email fill in this form and press submit/bbrbr
form method=post
  input type=hidden name=doit value=1
  bYour Email Address:/b
  br
  input type=text name=email size=40 value=?
  if(isset($email)) { echo $email; }
?
  brbr
  bSubject:/b
  br
  input type=text name=subject size=40 value=?
  if(isset($subject)) { echo $subject; }
?
  brbr
  bMessage:/b
  br
  textarea name=message rows=10 cols=40?
  if(isset($message)) { echo $message; }
?/textarea
  brbr
  input type=submit name=Submit value=Submit
  input type=reset name=Submit2 value=Reset
/form
br/center

?php

table_bottom();

html_footer();

close_db( $db );

?

At 11:47 25/12/2002 -0800, Chris Wesley wrote:

On Wed, 25 Dec 2002, Ben Edwards wrote:

 I have a fairly simple mail form which gets email, subject and message and
 posts to itself.
 It then use mail() function to send a email.
 mail( $admin_email, $subject, $message, From: $email );
 Problem is the message gets truncated if there is a comma in the message
 after the comma.

I have forms that have identical functionality, but don't exhibit that
erroneous behavior.  I can't tell what you've done to the arguments to
mail() before using them, but the only thing I do is run them through
stripslashes() and trim().  i.e. -

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

If that's what you do too ... weird!  If not, give it a try and see what
happens.

g.luck  cheers!
~Chris


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



* Ben Edwards  +44 (0)117 9400 636 *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Smashing the Corporate image   http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8 *



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


Re: [PHP] Problem with comma in mail form

2002-12-26 Thread Ben Edwards


I have actually discovered the problem is in fact that the message gets 
truncated after a Carriage Return.

The even wearder thing is that
  $msg = ereg_replace( \n, NL, $msg );

Douse put NL where the carriage return was but also seems to leave some 
kind on new line character.

So when I run $mgs through the function, do echo $msg, and look in the 
source of the HTML $msg is still on a number of different lines,

Ben

* Ben Edwards  +44 (0)117 9400 636 *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Smashing the Corporate image   http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8 *


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


Re: [PHP] Problem with comma in mail form

2002-12-26 Thread 1LT John W. Holmes
 I have actually discovered the problem is in fact that the message gets
 truncated after a Carriage Return.

 The even wearder thing is that
$msg = ereg_replace( \n, NL, $msg );

 Douse put NL where the carriage return was but also seems to leave some
 kind on new line character.

 So when I run $mgs through the function, do echo $msg, and look in the
 source of the HTML $msg is still on a number of different lines,

I'm still not sure why the message would be truncated, but try replacing
\r\n instead of just \n. Windows uses \r\n, *nix uses \n and I think MAC
uses \r.

What are you using to view the message?

---John Holmes...


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




Re: [PHP] Problem with comma in mail form

2002-12-26 Thread Ben Edwards
Sorted it out with

$message = ereg_replace((\r\n|\n|\r), \n, trim( stripslashes( 
$message) ) );

trim and stripslashes not strictly speaking nessesery.  Not 100% sure what 
happened here but guess \r\n or \r was causing problems.

Ben

At 11:11 26/12/2002 -0500, 1LT John W. Holmes wrote:

 I have actually discovered the problem is in fact that the message gets
 truncated after a Carriage Return.

 The even wearder thing is that
$msg = ereg_replace( \n, NL, $msg );

 Douse put NL where the carriage return was but also seems to leave some
 kind on new line character.

 So when I run $mgs through the function, do echo $msg, and look in the
 source of the HTML $msg is still on a number of different lines,

I'm still not sure why the message would be truncated, but try replacing
\r\n instead of just \n. Windows uses \r\n, *nix uses \n and I think MAC
uses \r.

What are you using to view the message?

---John Holmes...


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



* Ben Edwards  +44 (0)117 9400 636 *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Smashing the Corporate image   http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8 *



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


Re: [PHP] Problem with comma in mail form

2002-12-26 Thread Paul Roberts
what mailserver are you using and how is it called in php.ini?
and what else is in the message causing the problem.

Best Wishes  Happy New Year

Paul Roberts
[EMAIL PROTECTED]


- Original Message - 
From: Ben Edwards [EMAIL PROTECTED]
To: 1LT John W. Holmes [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, December 26, 2002 4:36 PM
Subject: Re: [PHP] Problem with comma in mail form


Sorted it out with

 $message = ereg_replace((\r\n|\n|\r), \n, trim( stripslashes( 
$message) ) );

trim and stripslashes not strictly speaking nessesery.  Not 100% sure what 
happened here but guess \r\n or \r was causing problems.

Ben

At 11:11 26/12/2002 -0500, 1LT John W. Holmes wrote:

  I have actually discovered the problem is in fact that the message gets
  truncated after a Carriage Return.
 
  The even wearder thing is that
 $msg = ereg_replace( \n, NL, $msg );
 
  Douse put NL where the carriage return was but also seems to leave some
  kind on new line character.
 
  So when I run $mgs through the function, do echo $msg, and look in the
  source of the HTML $msg is still on a number of different lines,

I'm still not sure why the message would be truncated, but try replacing
\r\n instead of just \n. Windows uses \r\n, *nix uses \n and I think MAC
uses \r.

What are you using to view the message?

---John Holmes...


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


* Ben Edwards  +44 (0)117 9400 636 *
* Critical Site Builderhttp://www.criticaldistribution.com *
* online collaborative web authoring content management system *
* Get alt news/views films online   http://www.cultureshop.org *
* i-Contact Progressive Video  http://www.videonetwork.org *
* Smashing the Corporate image   http://www.subvertise.org *
* Bristol Indymedia   http://bristol.indymedia.org *
* Bristol's radical news http://www.bristle.org.uk *
* PGP : F0CA 42B8 D56F 28AD 169B  49F3 3056 C6DB 8538 EEF8 *








-- 
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




Re: [PHP] Problem with comma in mail form

2002-12-25 Thread Chris Wesley
On Wed, 25 Dec 2002, Ben Edwards wrote:

 I have a fairly simple mail form which gets email, subject and message and
 posts to itself.
 It then use mail() function to send a email.
 mail( $admin_email, $subject, $message, From: $email );
 Problem is the message gets truncated if there is a comma in the message
 after the comma.

I have forms that have identical functionality, but don't exhibit that
erroneous behavior.  I can't tell what you've done to the arguments to
mail() before using them, but the only thing I do is run them through
stripslashes() and trim().  i.e. -

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

If that's what you do too ... weird!  If not, give it a try and see what
happens.

g.luck  cheers!
~Chris


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