[PHP] Odd problem with ereg_replace and addslahes

2003-12-03 Thread Ian Truelsen
Here is what I am doing:

I am reading in the contents of a text file that contains variables
whose properties I want to output. So, as was suggested on the list I
used the following:

eval(\$rest = \.addslashes($pre_rest).\;);

This works quite well, with one problem: if I use a contraction, like
won't, it will output as won\'t. So, I tried changing it to a backtic
(`) in the text file and after the eval statement, the output was won`t.
So, I thought I had it. I added:
ereg_replace(', `, $pre_rest);
before the eval statement. However, the output then became won\`t.

I don't understand why it is that changing quote to backtic in the text
file will give me the proper output, but the ereg_replace, which should
provide the same input to the eval statement, gets the slash added.

Does anyone have any ideas on why this is happening, and what I can do
to avoid the quote being slashed?

-- 
Ian Truelsen
Email: [EMAIL PROTECTED]
AIM: ihtruelsen
Homepage: http://www.ihtruelsen.dyndns.org
Signature key (742B740D) available at pgp.mit.edu



pgp0.pgp
Description: PGP signature


[PHP] Odd problem with ereg_replace and addslashes

2003-12-03 Thread Ian Truelsen
Here is what I am doing:

I am reading in the contents of a text file that contains variables
whose properties I want to output. So, as was suggested on the list I
used the following:

eval(\$rest = \.addslashes($pre_rest).\;);

This works quite well, with one problem: if I use a contraction, like
won't, it will output as won\'t. So, I tried changing it to a backtic
(`) in the text file and after the eval statement, the output was won`t.
So, I thought I had it. I added:
ereg_replace(', `, $pre_rest);
before the eval statement. However, the output then became won\`t.

I don't understand why it is that changing quote to backtic in the text
file will give me the proper output, but the ereg_replace, which should
provide the same input to the eval statement, gets the slash added.

Does anyone have any ideas on why this is happening, and what I can do
to avoid the quote being slashed?

-- 
Ian Truelsen
Email: [EMAIL PROTECTED]
AIM: ihtruelsen
Homepage: http://www.ihtruelsen.dyndns.org
Signature key (742B740D) available at pgp.mit.edu



pgp0.pgp
Description: PGP signature


[PHP] Odd Problem

2002-10-13 Thread Stephen

Hello,

I'm running a script that inserts a form's contents into a MySQL table. However, when 
I insert the contents, I get an error telling me this:

Unknown column 'employee' in 'field list'

I can't find the problem. I have a field in my table called employee but I guess it 
doesn't see it. Any ideas why?

Thanks,
Stephen Craton
http://www.melchior.us
http://php.melchior.us


RE: [PHP] Odd Problem

2002-10-13 Thread John W. Holmes

Print your SQL to the screen and verify it's value is what you think it
is. Make sure it's accessing the right table. 

---John Holmes...

 -Original Message-
 From: Stephen [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, October 13, 2002 5:03 PM
 To: PHP List
 Subject: [PHP] Odd Problem
 
 Hello,
 
 I'm running a script that inserts a form's contents into a MySQL
table.
 However, when I insert the contents, I get an error telling me this:
 
 Unknown column 'employee' in 'field list'
 
 I can't find the problem. I have a field in my table called employee
but I
 guess it doesn't see it. Any ideas why?
 
 Thanks,
 Stephen Craton
 http://www.melchior.us
 http://php.melchior.us



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




Re: [PHP] Odd Problem

2002-10-13 Thread Stephen

I got the spelling and everything right...

- Original Message -
From: John W. Holmes [EMAIL PROTECTED]
Newsgroups: php.general
To: 'Stephen' [EMAIL PROTECTED]; 'PHP List'
[EMAIL PROTECTED]
Sent: Sunday, October 13, 2002 4:17 PM
Subject: RE: [PHP] Odd Problem


 Print your SQL to the screen and verify it's value is what you think it
 is. Make sure it's accessing the right table.

 ---John Holmes...

  -Original Message-
  From: Stephen [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, October 13, 2002 5:03 PM
  To: PHP List
  Subject: [PHP] Odd Problem
 
  Hello,
 
  I'm running a script that inserts a form's contents into a MySQL
 table.
  However, when I insert the contents, I get an error telling me this:
 
  Unknown column 'employee' in 'field list'
 
  I can't find the problem. I have a field in my table called employee
 but I
  guess it doesn't see it. Any ideas why?
 
  Thanks,
  Stephen Craton
  http://www.melchior.us
  http://php.melchior.us




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




RE: [PHP] Odd Problem

2002-10-13 Thread John W. Holmes

What does your script look like? PHP isn't going to just make up an
error. If it tells you that was the error from a query, then it really
was.

---John Holmes...

 -Original Message-
 From: Stephen [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, October 13, 2002 8:44 PM
 To: PHP List; [EMAIL PROTECTED]
 Subject: Re: [PHP] Odd Problem
 
 I got the spelling and everything right...
 
 - Original Message -
 From: John W. Holmes [EMAIL PROTECTED]
 Newsgroups: php.general
 To: 'Stephen' [EMAIL PROTECTED]; 'PHP List'
 [EMAIL PROTECTED]
 Sent: Sunday, October 13, 2002 4:17 PM
 Subject: RE: [PHP] Odd Problem
 
 
  Print your SQL to the screen and verify it's value is what you think
it
  is. Make sure it's accessing the right table.
 
  ---John Holmes...
 
   -Original Message-
   From: Stephen [mailto:[EMAIL PROTECTED]]
   Sent: Sunday, October 13, 2002 5:03 PM
   To: PHP List
   Subject: [PHP] Odd Problem
  
   Hello,
  
   I'm running a script that inserts a form's contents into a MySQL
  table.
   However, when I insert the contents, I get an error telling me
this:
  
   Unknown column 'employee' in 'field list'
  
   I can't find the problem. I have a field in my table called
employee
  but I
   guess it doesn't see it. Any ideas why?
  
   Thanks,
   Stephen Craton
   http://www.melchior.us
   http://php.melchior.us
 
 




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




[PHP] Odd problem using sendmail - possibly to do with set_time_limit?

2002-03-04 Thread Alexis Birkill

Hi,

I'm trying to track down an odd problem in a script I'm writing, the 
purpose of which is below:

The script takes data of a subject and a body for an e-mail from an HTML 
form, and sends this out to a list of recipients stored in a datafile 
parsed by the PHP.  The size of the e-mails can be quite large (~100kb, 
all text), and this can be required to be sent to ~400 users.

Currently, we have a problem in that when sending a mail of 
approximately 70kb text, it will not complete - after approximately 2 
minutes, it gives an Internal Server Error (not a php error) and fails. 
  In this time, it has sent out approximately 25 messages.  This speed 
wouldn't be too much of an issue, if it would send to all 400 people on 
the list!

The PHP can be found below - I'm already resetting the set_time_limit on 
each loop execution, so as I understand it the script should happily run 
for as long as necessary.  We do not have access to configure the PHP 
installation on the server (running 4.1.2)

Code follows - I hasten to add that this appears to work admirably on 
small lists.


   if($file = fopen($list, r))
   {
  // Initialise variable
  $counter = 0;

  // Repeat until end-of-file reached.
  while(!feof($file))
  {
 // Open link to sendmail program with write permissions - assign
 // reference to $mailout
$mailout = popen(/usr/sbin/sendmail -t -i,w);

// Set address variable to next line of datafile, up to a
 // maximum length of 255 characters.
// This assigns the $address variable the next address from the
 // data file on each loop of the
 // while statement.
$address = fgets($file, 255);

// Write out to sendmail the correct information.
fputs($mailout, To: $address \n);
fputs($mailout, From: Sender [EMAIL PROTECTED]\n);

// $subject and $body are passed from the html form page - these
 // are the names of the form elements.
fputs($mailout, Subject: $subject\n);

// Send top of body out
fputs($mailout, header goes here\n);

// Send out user-entered body
fputs($mailout, $body\n);

// Send bottom of body out - need escape characters if using
 // reserved characters (like )
fputs($mailout, foot goes here\n);

// Tidy up and close sendmail link - this needs to be done on
 // each loop, otherwise seperate e-mails
// not generated.
pclose($mailout);

// Reset PHP timeout.
set_time_limit(30);

// Increment counter of e-mail messages sent.
$counter = $counter + 1;

  }

  // Tidy up and close the datafile.
  fclose($file);

  // Print out confirmation of send
  print(Message successfully sent to $counter recipients from the 
$list);
   }

Any help gratefully appreciated,

A.


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