php-general Digest 12 Sep 2005 17:07:12 -0000 Issue 3678

Topics (messages 222153 through 222195):

Mail System Error - Returned Mail
        222153 by: ramajej.mvelagroup.co.za

User notes script
        222154 by: Sumankumar R

Variables not available
        222155 by: Dotan Cohen
        222156 by: Burhan Khalid
        222161 by: Dotan Cohen
        222176 by: Ryan A
        222180 by: Dotan Cohen

Round with ONE-decimal... always...
        222157 by: Gustav Wiberg
        222158 by: Gustav Wiberg
        222163 by: Mark Rees
        222166 by: Gustav Wiberg
        222181 by: Jordan Miller

Re: QUERY TOKENIZER WAS Re: [new version] Re: [a proactive....
        222159 by: Jochem Maas

Re: PHP page counter
        222160 by: Michelle Konzack

help me to draw a listview in my website
        222162 by: Nahalingam N. Kanakavel
        222164 by: Burhan Khalid
        222165 by: Gustav Wiberg
        222167 by: Nahalingam N. Kanakavel
        222168 by: Jesper Gran

log4php
        222169 by: bruce

setting 'expiry date'
        222170 by: Ross
        222171 by: Jay Blanchard
        222173 by: Murray . PlanetThoughtful

PHP - LDAPS query
        222172 by: Vedanta Barooah

set_time_limit behavior
        222174 by: michael
        222175 by: Jay Blanchard
        222189 by: michael
        222190 by: Jim Moseby
        222191 by: michael

Re: mixing $_POST and $_GET vars
        222177 by: Brent Baisley

Best way to mass mail
        222178 by: Ryan A
        222183 by: Mark Rees
        222184 by: Matthew Weier O'Phinney
        222185 by: Manuel Lemos
        222186 by: Miles Thompson
        222187 by: Miles Thompson

mysql_connect
        222179 by: blackwater dev

SOAP and php
        222182 by: Leon Vismer

Handling file uploads for download
        222188 by: Charles Kline

confirmation email script/code
        222192 by: bruce
        222193 by: Jim Moseby
        222195 by: bruce

hidden database issue????
        222194 by: bruce

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
The original message was received at Sat, 10 Sep 2005 10:01:45 +0200 from 
155.85.224.29

----- The following addresses had permanent fatal errors -----
[email protected]

----- Transcript of session follows -----
.... while talking to server lists.php.net.:
550 5.1.2 <[email protected]>... Host unknown (Name server: host not 
found)


--- End Message ---
--- Begin Message ---
Hi
Where do I download the user notes script? One that allows people to
add notes to documentation like on the PHP manual? I want to try it
out on an HTML manual.
Suman

-- 
http://sumankumar.com

--- End Message ---
--- Begin Message ---
I am running php 5.0.4 at home on my Fedora Core 4 box. Post and get
variables are not available in my scripts. For instance, in
file.php?foo=bar the variable $foo is empty. Same thing for variables
passed in forms (get or post), which is how I came across this.

What could cause this? How could I repair it? Thanks.

Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/458/spice_girls.php
Spice Girls Song Lyrics

--- End Message ---
--- Begin Message ---
Dotan Cohen wrote:
I am running php 5.0.4 at home on my Fedora Core 4 box. Post and get
variables are not available in my scripts. For instance, in
file.php?foo=bar the variable $foo is empty. Same thing for variables
passed in forms (get or post), which is how I came across this.

What could cause this? How could I repair it? Thanks.

This is not a 'problem'.

See http://www.php.net/manual/en/security.globals.php

--- End Message ---
--- Begin Message ---
On 9/12/05, Burhan Khalid <[EMAIL PROTECTED]> wrote:
> Dotan Cohen wrote:
> > I am running php 5.0.4 at home on my Fedora Core 4 box. Post and get
> > variables are not available in my scripts. For instance, in
> > file.php?foo=bar the variable $foo is empty. Same thing for variables
> > passed in forms (get or post), which is how I came across this.
> >
> > What could cause this? How could I repair it? Thanks.
> 
> This is not a 'problem'.
> 
> See http://www.php.net/manual/en/security.globals.php
> 

Thanks. I should have known that, I guess.

Dotan
http://lyricslist.com/lyrics/artist_albums/127/cooper_alice.php
Cooper, Alice Song Lyrics

--- End Message ---
--- Begin Message ---
On 9/12/2005 9:00:46 AM, Dotan Cohen ([EMAIL PROTECTED]) wrote:
> I am running php 5.0.4 at home on my Fedora Core 4 box. Post and get
> variables are not available in my scripts. For instance, in
> file.php?foo=bar the variable $foo is empty. Same thing for variables
> passed in forms (get or post), which is how I came across this.
> 
> What could cause this? How could I repair it? Thanks.


Have you checked your register_globals?

--- End Message ---
--- Begin Message ---
On 9/12/05, Ryan A <[EMAIL PROTECTED]> wrote:
> 
> On 9/12/2005 9:00:46 AM, Dotan Cohen ([EMAIL PROTECTED]) wrote:
> > I am running php 5.0.4 at home on my Fedora Core 4 box. Post and get
> > variables are not available in my scripts. For instance, in
> > file.php?foo=bar the variable $foo is empty. Same thing for variables
> > passed in forms (get or post), which is how I came across this.
> >
> > What could cause this? How could I repair it? Thanks.
> 
> 
> Have you checked your register_globals?
> 

The 'problem' was in fact register globals. I did a little research
and decided to leave it off. So I'm accessing the variables like
$_POST['foo']. Thanks.

Dotan
http://lyricslist.com/lyrics/artist_albums/332/mccartney_paul.php
McCartney, Paul Song Lyrics

--- End Message ---
--- Begin Message ---
Hi there!

I want to adjust the round() -function a little...

If I put round(6,0) there will be an output of 6
If I put round(6,32) there will be an output of 6,3

I want it to have 6,0 instead of just 6... I guess there is an easy solution to this? Suggestions?

/G
http://www.varupiraten.se/

--- End Message ---
--- Begin Message ---
Thanx!

/G

----- Original Message ----- From: "George Pitcher" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Monday, September 12, 2005 10:55 AM
Subject: RE: [PHP] Round with ONE-decimal... always...


Look at sprint_f() in the manual.

George

-----Original Message-----
From: Gustav Wiberg [mailto:[EMAIL PROTECTED]
Sent: 12 September 2005 9:52 am
To: PHP General
Subject: [PHP] Round with ONE-decimal... always...


Hi there!

I want to adjust the round() -function a little...

If I put round(6,0) there will be an output of 6
If I put round(6,32) there will be an output of 6,3

I want it to have 6,0 instead of just 6... I guess there is an
easy solution
to this? Suggestions?

/G
http://www.varupiraten.se/

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




--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.21/96 - Release Date: 2005-09-10



--- End Message ---
--- Begin Message ---
>
> I want to adjust the round() -function a little...
>
> If I put round(6,0) there will be an output of 6
> If I put round(6,32) there will be an output of 6,3
>
> I want it to have 6,0 instead of just 6... I guess there is an easy
solution
> to this? Suggestions?

Have a look at this.

http://uk2.php.net/manual/en/function.number-format.php






--- End Message ---
--- Begin Message ---

----- Original Message ----- From: "Mark Rees" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, September 12, 2005 11:12 AM
Subject: [PHP] Re: Round with ONE-decimal... always...


>
I want to adjust the round() -function a little...

If I put round(6,0) there will be an output of 6
If I put round(6,32) there will be an output of 6,3

I want it to have 6,0 instead of just 6... I guess there is an easy
solution
to this? Suggestions?

Have a look at this.

http://uk2.php.net/manual/en/function.number-format.php






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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.21/96 - Release Date: 2005-09-10


Thanx!

/G
http://www.varupiraten.se/

--- End Message ---
--- Begin Message ---
besides sprintf, number_format will also do it:

number_format(6, 1, ',', '');    // Outputs '6,0'

Jordan



On Sep 12, 2005, at 3:52 AM, Gustav Wiberg wrote:


Hi there!

I want to adjust the round() -function a little...

If I put round(6,0) there will be an output of 6
If I put round(6,32) there will be an output of 6,3

I want it to have 6,0 instead of just 6... I guess there is an easy solution to this? Suggestions?

/G
http://www.varupiraten.se/

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






--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
[snip]
This is another rather hackish attempt at using the tokeniser.

Which isn't perfect by a long shot, but I'm away home now so it'll have
to do.

I'd be interested to know what it makes of your queries.
[/snip]

This little slice of code is really well done, and I think that when it

ditto - nice code Robin.

I have been on holiday for 2 weeks without a computer - shock,horror (what
kind of holiday is that anyway ;-) and have been out of the running

I will make an attempt shortly to integrate robins tokenizing code into
the 'tool' I hackd up on the basis of Jays code.... given that I'm a firebirder
and you (two) Are mysqler (at least as far as this little exercise is concerned)
I think it's well worth the effort to make it possible to 'switch' DB
extensions... (or maybe make it grab stuff from any extension...)

if I've missed some comms on this thread/topic could you repost me (without the
[PHP] in the subject - cos it's a little tough to weed thru the 2500 unread
php mails in my inbox :-P

rgds,
Jochem

is combined with the code from the original so that the file names for
each query can be identified and the other items can be specified from
the command line as Jochem had done this will be one really popular
little application. I made one change Robin and have one suggestion

I changed line 4 from //looks at all $dir/*.php files.
$dir = '/path/to/php/files';

//looks at all $dir/*.php files.
$dir = $_SERVER['PWD']; 

Which means that you will not have to modifiy the line each time you
place it in a different directory. Other than that, using glob in this
function;

function getPhpFileList($dir)
{
  if (!is_dir($dir)) $dir = '.';
  return glob($dir . '/*.php');
}

Will not work in older versions of PHP. Some folks still have these
older versions running (for various reasons) and may need this changed.

What's possibly next for this little application? Perhaps a method to
determine which type of database is being used based on connection

we are of like minds regarding this :-)

information or what have you. Learning by hacking, isn't it cool?

si senor ;-)



--- End Message ---
--- Begin Message ---
Hello Vedanta,

Thanks for the Link, I have registered and downloaded.
I will test it.

Thanks again
Michelle


Am 2005-09-12 10:33:52, schrieb Vedanta Barooah:
> there is one here : http://www.phpclasses.org/browse/package/2212.html
> see if it suffices your need,
> thanks,
> vedanta
> 
------------------------- END OF REPLYED MESSAGE -------------------------


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---
hi all,

If any scripts available to draw a list view.
Plz help me, by giving some links or scripts avilable with you.

thanks in advance.

-- 
with regds,
Nahalingam.

--- End Message ---
--- Begin Message ---
Nahalingam N. Kanakavel wrote:
hi all,

If any scripts available to draw a list view.
Plz help me, by giving some links or scripts avilable with you.

What is a list view?

--- End Message ---
--- Begin Message ---
Hi there!

What do you mean with listview? Of what?

/G
http://www.varupiraten.se/

----- Original Message ----- From: "Nahalingam N. Kanakavel" <[EMAIL PROTECTED]>
To: "PHP" <[email protected]>
Sent: Monday, September 12, 2005 11:05 AM
Subject: [PHP] help me to draw a listview in my website


hi all,

If any scripts available to draw a list view.
Plz help me, by giving some links or scripts avilable with you.

thanks in advance.

--
with regds,
Nahalingam.



--------------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.21/96 - Release Date: 2005-09-10

--- End Message ---
--- Begin Message ---
hi,

I want to display several fields of values as a row, with header such as

------------------------------------------------------------------ |
Name age mail-id | Header part, by clicking over this I want to sort the
------------------------------------------------------------------- | rows 
below this.
. 
here rows of values. 
.
---------------------------------------------------------------------

On 9/12/05, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
> 
> Hi there!
> 
> What do you mean with listview? Of what?
> 
> /G
> http://www.varupiraten.se/
> 
> ----- Original Message -----
> From: "Nahalingam N. Kanakavel" <[EMAIL PROTECTED]>
> To: "PHP" <[email protected]>
> Sent: Monday, September 12, 2005 11:05 AM
> Subject: [PHP] help me to draw a listview in my website
> 
> 
> hi all,
> 
> If any scripts available to draw a list view.
> Plz help me, by giving some links or scripts avilable with you.
> 
> thanks in advance.
> 
> --
> with regds,
> Nahalingam.
> 
> 
> 
> 
> --------------------------------------------------------------------------------
> 
> 
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.10.21/96 - Release Date: 2005-09-10
> 
> 


-- 
with regds,
Nahalingam.

--- End Message ---
--- Begin Message ---
Maybe this could be something? I haven't tried it though.

http://www.activewidgets.com/grid/

/Jesper

--- End Message ---
--- Begin Message ---
hi...

has anyone used log4php in your php code? any success/horror stories? i'm
considering using it as i want/need a way of tracking different msg/error
levels within the code i'm starting to create. i'm looking for some method
of being able to determine/state the level of msgs i want to capture for the
various functions/modules within the app. i'd really like to be able to set
this up from an 'admin' function within the app. i'd also like the ability
to capture this information to either a log file, or db tbl..

thanks

-bruce
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
I have a php/mysql database with articles. What I need is a php sctipt that 
will compare the current day with the 'expiry date' entered by the user and 
if the there is a difference then drop it from the database..

I retrieve the date (called time and format it like this...

$query= "SELECT DATE_FORMAT(time, '%d.%m.%Y') AS time, article, id FROM news 
ORDER BY id DESC";


The expiry date is entered through a javascript widget and is in the format 
dd/mm/yyyy.


thanks,


Ross 

--- End Message ---
--- Begin Message ---
[snip]
I have a php/mysql database with articles. What I need is a php sctipt that 
will compare the current day with the 'expiry date' entered by the user and 
if the there is a difference then drop it from the database..

I retrieve the date (called time and format it like this...

$query= "SELECT DATE_FORMAT(time, '%d.%m.%Y') AS time, article, id FROM news

ORDER BY id DESC";

The expiry date is entered through a javascript widget and is in the format 
dd/mm/yyyy.
[/snip]

If you want to delete articles whose expiration date is not equal to today's
date;

$sql = "DELETE FROM news WHERE time < NOW() ";

--- End Message ---
--- Begin Message ---
> I have a php/mysql database with articles. What I need is a php sctipt
> that
> will compare the current day with the 'expiry date' entered by the user
> and
> if the there is a difference then drop it from the database..
> 
> I retrieve the date (called time and format it like this...
> 
> $query= "SELECT DATE_FORMAT(time, '%d.%m.%Y') AS time, article, id FROM
> news
> ORDER BY id DESC";
> 
> 
> The expiry date is entered through a javascript widget and is in the
> format
> dd/mm/yyyy.

Hi Ross,

Is there a real reason for deleting the articles? Why not only display
articles where the current date/time is less than the expiration date/time?

Once the current date/time is greater than the expiration date/time, stop
displaying the article.

Same effect as far as your users are concerned, and you're not faced with
the frustration of, 'I need a copy of that article from 12 months ago!'

Much warmth,

Murray
---
"Lost in thought..."
http://www.planetthoughtful.org

--- End Message ---
--- Begin Message ---
Hello All,

I think documentation is very sparse on PHP LDAPS (LDAP over SSL). I
am in a situation where I need to auth against the LDAP server over
SSL. I have the server's certificate database in the form of a
cert7.db  file containing the appropriate CA certificates and a
key3.db file. How do I make use of these from PHP?

Any clues/links to documentation will be of great help...

Thanks,
Vedanta

--- End Message ---
--- Begin Message ---
Hi,

I am trying to figure out why a script that is set to time out after 30
seconds will run indefinitely.  For example,

set_time_limit(30);
echo ini_get('max_execution_time'), "<hr />";
echo date("H:i:s"), "<hr />";
for ($i = 0; $i < 100; $i++)
{
  sleep(10);
  echo date("H:i:s"),"<hr />";
  flush();
}
echo "Done!";

result:

30
------------------------------------------------------------------------
13:54:09
------------------------------------------------------------------------
....
------------------------------------------------------------------------
14:10:50
------------------------------------------------------------------------
Done!


As you can see, this script ran for over 14 minutes.  I have read that
max_execution_time is bound to CPU time, and I am not sure how this
translates into being able to effectively use this parameter.

Comments / insight extremely appreciated.

Michael

--- End Message ---
--- Begin Message ---
[snip]
I am trying to figure out why a script that is set to time out after 30
seconds will run indefinitely.  For example,
....
As you can see, this script ran for over 14 minutes.  I have read that
max_execution_time is bound to CPU time, and I am not sure how this
translates into being able to effectively use this parameter.

Comments / insight extremely appreciated.
[/snip]

Are you running PHP in safe mode? If so set_time_limit() has no effect.

--- End Message ---
--- Begin Message ---
HI Jay,

Thanks for the reply. No, we are not in safe mode. That was one of the first things I looked at. It's quite a confusing issue. I certainly have had PHP time out on me before, and have juggled max_execution_time to solve this. But with it just running indefinitely regardless of INI values or run time setting... well its a little disturbing!

Thanks,

Michael

Jay Blanchard wrote:

[snip]
I am trying to figure out why a script that is set to time out after 30
seconds will run indefinitely.  For example,
....
As you can see, this script ran for over 14 minutes.  I have read that
max_execution_time is bound to CPU time, and I am not sure how this
translates into being able to effectively use this parameter.

Comments / insight extremely appreciated.
[/snip]

Are you running PHP in safe mode? If so set_time_limit() has no effect.


--- End Message ---
--- Begin Message ---
] set_time_limit behavior
> 
> 
> HI Jay,
> 
> Thanks for the reply.  No, we are not in safe mode.  That was 
> one of the 
> first things I looked at.  It's quite a confusing issue.  I certainly 
> have had PHP time out on me before, and have juggled 
> max_execution_time 
> to solve this.  But with it just running indefinitely 
> regardless of INI 
> values or run time setting...  well its a little disturbing!
> 
> Thanks,
> 
> Michael
> 
> Jay Blanchard wrote:
> 
> >[snip]
> >I am trying to figure out why a script that is set to time 
> out after 30
> >seconds will run indefinitely.  For example,
> >....
> >As you can see, this script ran for over 14 minutes.  I have 
> read that
> >max_execution_time is bound to CPU time, and I am not sure how this
> >translates into being able to effectively use this parameter.
> >
> >Comments / insight extremely appreciated.
> >[/snip]
> >
> >Are you running PHP in safe mode? If so set_time_limit() has 
> no effect.
> >

>From the online manual:

The set_time_limit() function and the configuration directive
max_execution_time only affect the execution time of the script itself. Any
time spent on activity that happens outside the execution of the script such
as system calls using system(), the sleep() function, database queries, etc.
is not included when determining the maximum time that the script has been
running.

JM

--- End Message ---
--- Begin Message ---
Hi Jim,

I certainly did overlook the ramifications of the sleep function. I modified my script so that sleep is not called:

set_time_limit(1);
echo ini_get('max_execution_time'), "<hr />";
echo date("H:i:s"), "<hr />";
while (true)
{
  echo date("H:i:s"),"<hr />";
  flush();
}


This did time out! But, oddly it timed out only after 10 seconds. Any ideas of why the discrepancy?

Thanks,

Michael



Jim Moseby wrote:

] set_time_limit behavior
HI Jay,

Thanks for the reply. No, we are not in safe mode. That was one of the first things I looked at. It's quite a confusing issue. I certainly have had PHP time out on me before, and have juggled max_execution_time to solve this. But with it just running indefinitely regardless of INI values or run time setting... well its a little disturbing!

Thanks,

Michael

Jay Blanchard wrote:

[snip]
I am trying to figure out why a script that is set to time
out after 30
seconds will run indefinitely.  For example,
....
As you can see, this script ran for over 14 minutes. I have
read that
max_execution_time is bound to CPU time, and I am not sure how this
translates into being able to effectively use this parameter.

Comments / insight extremely appreciated.
[/snip]

Are you running PHP in safe mode? If so set_time_limit() has
no effect.

From the online manual:

The set_time_limit() function and the configuration directive
max_execution_time only affect the execution time of the script itself. Any
time spent on activity that happens outside the execution of the script such
as system calls using system(), the sleep() function, database queries, etc.
is not included when determining the maximum time that the script has been
running.

JM


--- End Message ---
--- Begin Message --- If you are going to be accepting data, and you don't care or are not sure if it's going to be a GET or a POST, then use $_REQUEST, which contains both $_GET and $_POST data.



On Sep 9, 2005, at 7:46 PM, bruce wrote:

hi..

quick question.. a basic link <a ref ="foo.php?a=1">blah</a> allows you to process the vars in foo.php using $_GET, easy/basic enough. however, if i have a form from cat.php that does a 'post' of the form information/ input to the foo.php, i'm then going to have to either change the form to do a 'get' or else i'm going to have to do both a $_GET, and a $_POST within foo.php to
access the vars from the pages that are interfacing with foo.php.

is there an easier/cleaner/better approach??

or do i really need/wind up doing something like

if ($_GET['foo'])...

if ($_POST['apple'])...

and just have a mix of both methods within the code...

thanks

-bruce
[EMAIL PROTECTED]

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




--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

--- End Message ---
--- Begin Message ---
Hi,
My client has a dating site and now he wants to mail all his members,
he does not want to use any of the already installed mailing lists but wants
us to make one
for him, he's on a dedicated server.

Presently he does not have too many members, just a few thousand (around 3k
i guess),
I remember reading sometime back on the list that using the mail() may not
be the best
option...not sure if thats still true.

The thing that bothers me the most is if the program times out..., how do I
start again from
the ones that have not been sent?

eg:
(10 members)
mail gets sent to first 4 members then times out
we re-click on the send button and it starts again from one...again times
out
(this happens 5 times)

that means members 1-4 will get the same email 5 times

Doing this the hard way would be to connect to the db after each successful
mail and "mark"
each member with todays date or something...but I would like to avoid so
many calls to the
DB if possible...esp if the site grows.

Ideas/suggestions?

Thanks in advance,
Ryan

--- End Message ---
--- Begin Message ---
""Ryan A"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> My client has a dating site and now he wants to mail all his members,
> he does not want to use any of the already installed mailing lists but
wants
> us to make one
> for him, he's on a dedicated server.
>
> Presently he does not have too many members, just a few thousand (around
3k
> i guess),
> I remember reading sometime back on the list that using the mail() may not
> be the best
> option...not sure if thats still true.
>
> The thing that bothers me the most is if the program times out..., how do
I
> start again from
> the ones that have not been sent?

phplist handles this well

www.phplist.com

Even if you decide not to use it, the code will probably help you out

>
> eg:
> (10 members)
> mail gets sent to first 4 members then times out
> we re-click on the send button and it starts again from one...again times
> out
> (this happens 5 times)
>
> that means members 1-4 will get the same email 5 times
>
> Doing this the hard way would be to connect to the db after each
successful
> mail and "mark"
> each member with todays date or something...but I would like to avoid so
> many calls to the
> DB if possible...esp if the site grows.
>
> Ideas/suggestions?
>
> Thanks in advance,
> Ryan

--- End Message ---
--- Begin Message ---
* "Ryan A" <[EMAIL PROTECTED]>:
> My client has a dating site and now he wants to mail all his members,
> he does not want to use any of the already installed mailing lists but
> wants us to make one for him, he's on a dedicated server.
>
> Presently he does not have too many members, just a few thousand
> (around 3k i guess), I remember reading sometime back on the list that
> using the mail() may not be the best option...not sure if thats still
> true.
>
> The thing that bothers me the most is if the program times out..., how
> do I start again from the ones that have not been sent?
>
> eg:
> (10 members)
> mail gets sent to first 4 members then times out
> we re-click on the send button and it starts again from one...again
> times out (this happens 5 times)
>
> that means members 1-4 will get the same email 5 times
>
> Doing this the hard way would be to connect to the db after each
> successful mail and "mark" each member with todays date or
> something...but I would like to avoid so many calls to the DB if
> possible...esp if the site grows.
>
> Ideas/suggestions?

Build a queueing system, and use cron to actually process and mail the
list.

Longer explanation:

I run a mass-mailer for a non-profit, and the way our works is to store
all mail information in a database. We then have a cronjob that runs
each minute and checks to see if any mailings need to be sent (basically,
the absense of a 'sent' flag), and then processes the mailing.

Mails are then queued to an MTA -- in our case, Postfix. This allows us
to handle bounces (another script is triggered when email bounces back
to the reply-to address). 

So, on your web-based front-end, when you click 'Send', it actually
simply places the information in a database queue, and the cronjob does
the actual sending.

-- 
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

--- End Message ---
--- Begin Message ---
Hello,

on 09/12/2005 10:50 AM Ryan A said the following:
The thing that bothers me the most is if the program times out..., how do I
start again from
the ones that have not been sent?

Use set_time_limit(0); and your script will never timeout. Anyway, long standing scripts should be run off your Web server, maybe started from by cron.

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message ---
At 10:50 AM 9/12/2005, Ryan A wrote:
Hi,
My client has a dating site and now he wants to mail all his members,
he does not want to use any of the already installed mailing lists but wants
us to make one
for him, he's on a dedicated server.

Presently he does not have too many members, just a few thousand (around 3k
i guess),
I remember reading sometime back on the list that using the mail() may not
be the best
option...not sure if thats still true.

The thing that bothers me the most is if the program times out..., how do I
start again from
the ones that have not been sent?

eg:
(10 members)
mail gets sent to first 4 members then times out
we re-click on the send button and it starts again from one...again times
out
(this happens 5 times)

that means members 1-4 will get the same email 5 times

Doing this the hard way would be to connect to the db after each successful
mail and "mark"
each member with todays date or something...but I would like to avoid so
many calls to the
DB if possible...esp if the site grows.

Ideas/suggestions?

Thanks in advance,
Ryan


We send to 1,000 subscribers each night, here's the guts of the code. There's one call to fetch the names and email addresses from the database.

                        while( $row = mysql_fetch_array( $result ) )
                        {
                                $first_name = $row[ first_name ];
                                $last_name      = $row[ last_name ];
                                $email          = $row[ email ];

                                /* recipient */
                                $recipient = $email;

                                /* send it */
$lMailedOK = mail($recipient, $subject, $message, $headers);
                                if ($lMailedOK != 0 )
                                {
                                        $lMailedOK = "OK";
                                }else{
                                        $lMailedOK="<b>FAILED</b>";
                                }
                                echo $recipient . " - " . $lMailedOK ."<br>";
                                // give ourselves more time
                                set_time_limit( 20 );
                        } //$row = mysql_fetch_array( $result )

$message is built higher up in the process - I keep resetting the time out - set_time_limit(20).
After each message is sent, $lMailedOK and the names are echoed to the browser.

When the process completes, we know who it went to and if the call to mail() succeeded.

Hope this is helpful - Miles Thompson
--- End Message ---
--- Begin Message ---
At 10:50 AM 9/12/2005, Ryan A wrote:
Hi,
My client has a dating site and now he wants to mail all his members,
he does not want to use any of the already installed mailing lists but wants
us to make one
for him, he's on a dedicated server.

Presently he does not have too many members, just a few thousand (around 3k
i guess),
I remember reading sometime back on the list that using the mail() may not
be the best
option...not sure if thats still true.

The thing that bothers me the most is if the program times out..., how do I
start again from
the ones that have not been sent?

eg:
(10 members)
mail gets sent to first 4 members then times out
we re-click on the send button and it starts again from one...again times
out
(this happens 5 times)

that means members 1-4 will get the same email 5 times

Doing this the hard way would be to connect to the db after each successful
mail and "mark"
each member with todays date or something...but I would like to avoid so
many calls to the
DB if possible...esp if the site grows.

Ideas/suggestions?

Thanks in advance,
Ryan

Addition to my prev msg ...

We don't have access to cron processes on our ISP's server, so the nightly mailing goes out as a scheduled job from a Windows XP box.

We have maybe three glitches per year:
        1. user forgets and shuts  the box down,
        2. forgets and turns off the script, or
3. the power fails and machine is not set up to automatically reboot and feed itself her password.

This is all "livable-with".

Cheers - Miles
--- End Message ---
--- Begin Message ---
Hello,

I have a strange bug I can't figure out.  I am trying to use a third
party library and it is throwing errors:

Fatal error: Call to undefined function: mysql_pconnect()

This doesn't make sense to me as I have other code on that box that
uses mysql_pconnect() with no problem.  Why would some code be able to
use it while other code can't?


Thank!

--- End Message ---
--- Begin Message ---
Hi 

What would be the best option for PHP and SOAP support.

Many thanks
--
Leon

--- End Message ---
--- Begin Message ---
Hi all,

I have an application where I need to allow the admin of a site to upload PDF files for download by their clients.

I am uploading files to a directory ABOVE the web root, but I have no clue what the best way to have a link on the site to allow for downloading those files by visitors twould be.

Any suggestions?

Thanks,
Charles

--- End Message ---
--- Begin Message ---
hi..

has anybody come across a really good 'open source' chunk of code for
sending/recieving confirmation emails from an app... i'd like to allow the
user to register, and send them an email that they then have to hit the link
to complete the process..

thanks

-bruce
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
> has anybody come across a really good 'open source' chunk of code for
> sending/recieving confirmation emails from an app... i'd like 
> to allow the
> user to register, and send them an email that they then have 
> to hit the link
> to complete the process..

It is strightforward to write this yourself.  In my simple example, I
generate a 32 byte random ID when the user registers and save it along with
his data in the DB. Then, I send him an email with a link like this:

www.example.com/register.php?id=7H7dh869ha320J6GhAs89L0lJ00j09df?action=conf
irm

When he clicks the link, I flip a flag in his DB record that he has
confirmed.

I have cron periodically go and clean up unconfirmed records that have timed
out.

JM

--- End Message ---
--- Begin Message ---
jim...

pretty much what i had thought about... question.. how does one correctly!!!
set up a cron process...

i assume that i can write a quick perl/php app that iterates through the
'emailconfirmTBL' looking at the date, and the confirm status. if the
cleanup app sees any records that are over a certain age, and haven't been
confirmed, it can simply delete the record. but shouldn't the cleanup also
do a rollback/delete of the user registration records as well...

this kind of approach would lend itself to being monitored by an admin who
could then look to see where in the process a given user is/was...

any good/quick guides you can point me to!

thanks

-bruce


-----Original Message-----
From: Jim Moseby [mailto:[EMAIL PROTECTED]
Sent: Monday, September 12, 2005 8:56 AM
To: '[EMAIL PROTECTED]'; [email protected]
Subject: RE: [PHP] confirmation email script/code


> has anybody come across a really good 'open source' chunk of code for
> sending/recieving confirmation emails from an app... i'd like
> to allow the
> user to register, and send them an email that they then have
> to hit the link
> to complete the process..

It is strightforward to write this yourself.  In my simple example, I
generate a 32 byte random ID when the user registers and save it along with
his data in the DB. Then, I send him an email with a link like this:

www.example.com/register.php?id=7H7dh869ha320J6GhAs89L0lJ00j09df?action=conf
irm

When he clicks the link, I flip a flag in his DB record that he has
confirmed.

I have cron periodically go and clean up unconfirmed records that have timed
out.

JM

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

--- End Message ---
--- Begin Message ---
hi...

i have a situation with a server that i have. i have mysql installed with
php..

the mysql is V4.1.12. i'm trying to see/view a database from the command
line and i can't see it when i login to mysql as root. i also can't see it
when i try to login to mysql as the given user.

from the php app, i see that the app makes a valid connection using:
 host    = 192.168.1.foo
 dbname  = cat
 user    = dog
 passwd  = dog

i've tracked the code, it's making the connection, and interfacing with the
database/tables...

however, when i try to access the db as either root/dog, i can't see the
database 'cat'
  mysql -udog -pdog -h192.168.1.foo
  mysql -uroot -p

neither one of these approaches sems to work, ie, i can't see the 'cat'
database in the mysql list of tables...

any idea what's going on...

when i get into mysql as root, i can see/manipulate all the other databases.

thanks for any pointers/thoughts/etc...

searching google hasn't led to any solid solutions..

thanks

-bruce
[EMAIL PROTECTED]

--- End Message ---

Reply via email to