php-general Digest 22 Dec 2002 15:05:13 -0000 Issue 1778
Topics (messages 129089 through 129114):
Re: Forms and PHP variables
129089 by: Philip Olson
129097 by: Beauford.2002
129106 by: Jason Wong
assignment by reference bug?
129090 by: reynardmh.netscape.net
Re: Loading modules not compiled in php
129091 by: Philip Olson
129098 by: John Nichel
Function returning a reference - how ?!?
129092 by: Tim Molendijk
129093 by: reynardmh.netscape.net
129094 by: Tim Molendijk
129096 by: Tom Rogers
129099 by: Kyle Gibson
Re: assignment by reference bug? (update)
129095 by: reynardmh.netscape.net
fwrite() blank-line Quirk?
129100 by: Noel Wade
uploading flat text to MySQL
129101 by: James Brennan
129108 by: Jason Wong
fgets() question?
129102 by: Noel Wade
129107 by: Jason Wong
129109 by: Steve Yates
129110 by: Noel Wade
Re: solved - uploading flat text to MySQL -
129103 by: James Brennan
Re: un-solved - uploading flat text to MySQL -
129104 by: James Brennan
Re: Mass Mailing
129105 by: Manuel Lemos
Re: \Z characters
129111 by: Mattia
129113 by: Dave J. Hala Jr.
Email problems.
129112 by: Steve Jackson
Is __FILE__ still current or is there something newer?
129114 by: z z
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 ---
Use is_numeric()
http://www.php.net/is_numeric
See also the ctype functions which can
be read about here:
http://www.php.net/ctype
And yes, regular expressions are another
option but aren't needed here.
Regards,
Philip Olson
On Sat, 21 Dec 2002, Beauford.2002 wrote:
> Hi,
>
> First off, thanks to all those that helped out with my other questions. Not
> all my problems were solved, but I'm certainly closer. Still working on the
> same project I need to do the following.
>
> I have a form where users input numbers only, is there a way I can have php
> check to make sure a letter or other character didn't get put in by
> accident. I was looking at ereg, but not to familiar with this or if it
> would work in this case.
>
> TIA
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Thanks for the info, but ..... is_numeric does not appear to accept
variables i.e. is_numeric($num) and ctype gives me the following.
Fatal error: Call to undefined function: ctype_digit() in
/usr/local/apache/htdocs/.............. on line 6
----- Original Message -----
From: "Philip Olson" <[EMAIL PROTECTED]>
To: "Beauford.2002" <[EMAIL PROTECTED]>
Cc: "PHP General" <[EMAIL PROTECTED]>
Sent: Saturday, December 21, 2002 9:50 PM
Subject: Re: [PHP] Forms and PHP variables
>
> Use is_numeric()
>
> http://www.php.net/is_numeric
>
> See also the ctype functions which can
> be read about here:
>
> http://www.php.net/ctype
>
> And yes, regular expressions are another
> option but aren't needed here.
>
> Regards,
> Philip Olson
>
>
> On Sat, 21 Dec 2002, Beauford.2002 wrote:
>
> > Hi,
> >
> > First off, thanks to all those that helped out with my other questions.
Not
> > all my problems were solved, but I'm certainly closer. Still working on
the
> > same project I need to do the following.
> >
> > I have a form where users input numbers only, is there a way I can have
php
> > check to make sure a letter or other character didn't get put in by
> > accident. I was looking at ereg, but not to familiar with this or if it
> > would work in this case.
> >
> > TIA
> >
> >
> >
> > --
> > 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
>
>
--- End Message ---
--- Begin Message ---
On Sunday 22 December 2002 10:29, Beauford.2002 wrote:
> Hi,
>
> First off, thanks to all those that helped out with my other questions. Not
> all my problems were solved, but I'm certainly closer. Still working on the
> same project I need to do the following.
>
> I have a form where users input numbers only, is there a way I can have php
> check to make sure a letter or other character didn't get put in by
> accident. I was looking at ereg, but not to familiar with this or if it
> would work in this case.
Try this:
http://www.phpclasses.org/browse.html/package/914.html
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
So this is what it feels like to be potato salad
*/
--- End Message ---
--- Begin Message ---
hi,
I just found this behavior when trying to implement a linked list with php.
In linked list it's common to say:
$a =& $a->next;
when traversing the list. but this doesn't work (it gives segmentation fault when
trying to access the $head->next object (after the above assignment).
but this work:
$tmp =& $a;
$a =& $tmp->next;
I don't know if this can be considered a bug or if it's designed to work that way. But
I think it would be nice to be able to do it without creating temporary variable.
here is the full code. I'm using php 4.2.2 and I'm running the code from comand line.
(if I execute it from the web it gives something like 'document contains no data'
instead of segmentation fault)
<?php
class test {
var $name, $next;
function test($n = '') {
$this->name = $n;
$this->next = null;
}
function toString() {
return $this->name;
}
}
$a = new test('a');
$a->next = new test('b');
$a->next->next = new test('c');
echo 'a '. $a->toString() ."\n";
echo 'a next '. $a->next->toString() ."\n";
echo 'a next next '. $a->next->next->toString() ."\n";
$tmp =& $a; $a =& $tmp->next; // this is fine
//$a =& $a->next; // this will result in Segmentation fault
echo 'a '. $a->toString() ."\n";
echo 'a next '. $a->next->toString() ."\n";
?>
I would be glad to hear other people's opinion on this.
thanks,
- reynard
__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now!
http://channels.netscape.com/ns/browsers/download.jsp
Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
--- End Message ---
--- Begin Message ---
Aspell is deprecated in favor of Pspell in PHP so
using it is a bad idea. But you can do this to
get Pspell going:
a) On either the JTL box or on some other one
with the same operating system, get the php
source and get ready to compile.
http://www.php.net/downloads
b) Be sure the appropriate libraries are available
as per the instructions found here:
http://www.php.net/pspell
c) Configure PHP like so:
./configure --with-apxs --with-pspell=shared
d) Then build it:
make
e) This will then create the module which will
exist in:
yourphpsourcedir/modules/pspell.so
f) Copy this file somewhere on your web server and
in the php script load it with dl() like so:
dl('pspell.so');
Easier said then done I know but the above is a
possibility ;) You may want to ask them if they
could create this .so so that clients can load
it dynamically, that would be ideal.
Regards,
Philip Olson
On Sun, 22 Dec 2002, Tony Earnshaw wrote:
> > I have a site hosted at JTL Networks, and I'm looking into setting up
> > a spell checker for my message boards. The problem is, JTL doesn't have
> > pspell compiled in with their php build, and it may be some time before
> > they do (if they ever do). Does anyone know of a way to include
> > something like pspell support in php dynamically? Like by using a
> > .htaccess file to call it or something?
>
> At the last count (Apache 1.3.27/PHP4.2.3), aspell doesn't get compiled into
> PHP. It just sits in /usr/bin on RH Linux, at least..
>
> The bad news is, that your code will have to be written for it. The good news
> is, that you can cheese the code off Horde's Imp.
>
> Best,
>
> Tony
>
> --
>
> When all's said and done, there's nothing left to say or do ...
> http://www.billy.demon.nl
>
> -------------------------------------------------
> This mail sent through IMP: http://horde.org/imp/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
This is what I'm looking for....do you know if you can load it in a
.htaccess file? I have a couple of files that are included in on every
page, so I could do it in my config file, but there's no reason for me
to load the module on the whole site, when I need it just in the forum
section. I'm trying to work around my laziness here. :)
Philip Olson wrote:
Aspell is deprecated in favor of Pspell in PHP so
using it is a bad idea. But you can do this to
get Pspell going:
a) On either the JTL box or on some other one
with the same operating system, get the php
source and get ready to compile.
http://www.php.net/downloads
b) Be sure the appropriate libraries are available
as per the instructions found here:
http://www.php.net/pspell
c) Configure PHP like so:
./configure --with-apxs --with-pspell=shared
d) Then build it:
make
e) This will then create the module which will
exist in:
yourphpsourcedir/modules/pspell.so
f) Copy this file somewhere on your web server and
in the php script load it with dl() like so:
dl('pspell.so');
Easier said then done I know but the above is a
possibility ;) You may want to ask them if they
could create this .so so that clients can load
it dynamically, that would be ideal.
Regards,
Philip Olson
On Sun, 22 Dec 2002, Tony Earnshaw wrote:
I have a site hosted at JTL Networks, and I'm looking into setting up
a spell checker for my message boards. The problem is, JTL doesn't have
pspell compiled in with their php build, and it may be some time before
they do (if they ever do). Does anyone know of a way to include
something like pspell support in php dynamically? Like by using a
.htaccess file to call it or something?
At the last count (Apache 1.3.27/PHP4.2.3), aspell doesn't get compiled into
PHP. It just sits in /usr/bin on RH Linux, at least..
The bad news is, that your code will have to be written for it. The good news
is, that you can cheese the code off Horde's Imp.
Best,
Tony
--
When all's said and done, there's nothing left to say or do ...
http://www.billy.demon.nl
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--- End Message ---
--- Begin Message ---
Hi all,
I came across the following weird situation. I don't get it, I hope some of
you can explain the logic of it all.
[begin code]-------------------------------
<?php
/* Define class Parent. Its constructor sets an instance of Child in
property $child and passes itself to Child's constructor. */
class Parent
{
var $child;
var $property = 'one';
function Parent()
{
$this->child = &new Child($this);
}
}
/* Define class Child. Its constructor assigns a reference of the Parent
object that contains this Child object to property $parent. */
class Child
{
var $parent;
function Child(&$p)
{
$this->parent = &$p;
}
}
/* This function instantiates and returns a new Parent class. */
function createParent()
{
return new Parent;
}
/* $p is a reference of the Parent object created by createParent(). */
$p = &createParent();
/* The $property property of the Parent object is changed. */
$p->property = 'two';
/* Since $p should be the same object as $p->child->parent, the following
should print twice the same. */
print $p->property . '<BR>';
print $p->child->parent->property . '<BR>';
?>
[end code]-----------------------------------
Now the problem is: IT DOES NOT PRINT TWICE THE SAME!!!
Instead it prints 'two' and then 'one', which indicates that
$p->child->parent is another object than $p. The problem is that the object
*returned* by createParent() is not the same object as the object that is
*created* by createParent(). Just replace the line $p = &createParent(); by
$p = &new Parent(); -- this works perfectly fine! Conclusion: createParent()
does not return the object it creates!
Someone knows why this ain't working and how to solve it?!? Hope so, can't
wait to hear from you guys.
Thanks in advance,
Tim Molendijk
--- End Message ---
--- Begin Message ---
change your createParent function to return by reference:
function &createParent()
{
return new Parent;
}
it returns 'two' and 'two' for me
Regards,
- reynard
>Hi all,
>
>I came across the following weird situation. I don't get it, I hope some of
>you can explain the logic of it all.
>
>[begin code]-------------------------------
><?php
>
>/* Define class Parent. Its constructor sets an instance of Child in
>property $child and passes itself to Child's constructor. */
>class Parent
>{
> var $child;
> var $property = 'one';
>
> function Parent()
> {
> $this->child = &new Child($this);
> }
>}
>
>/* Define class Child. Its constructor assigns a reference of the Parent
>object that contains this Child object to property $parent. */
>class Child
>{
> var $parent;
>
> function Child(&$p)
> {
> $this->parent = &$p;
> }
>}
>
>/* This function instantiates and returns a new Parent class. */
>function createParent()
>{
> return new Parent;
>}
>
>/* $p is a reference of the Parent object created by createParent(). */
>$p = &createParent();
>
>/* The $property property of the Parent object is changed. */
>$p->property = 'two';
>
>/* Since $p should be the same object as $p->child->parent, the following
>should print twice the same. */
>print $p->property . '<BR>';
>print $p->child->parent->property . '<BR>';
>
>?>
>[end code]-----------------------------------
>
>Now the problem is: IT DOES NOT PRINT TWICE THE SAME!!!
>Instead it prints 'two' and then 'one', which indicates that
>$p->child->parent is another object than $p. The problem is that the object
>*returned* by createParent() is not the same object as the object that is
>*created* by createParent(). Just replace the line $p = &createParent(); by
>$p = &new Parent(); -- this works perfectly fine! Conclusion: createParent()
>does not return the object it creates!
>
>Someone knows why this ain't working and how to solve it?!? Hope so, can't
>wait to hear from you guys.
>
>Thanks in advance,
>
>Tim Molendijk
__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now!
http://channels.netscape.com/ns/browsers/download.jsp
Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
--- End Message ---
--- Begin Message ---
Wow!! You're my king! Thanks, that syntax is completely new to me!
Great, another thing learned today! :)
Cheers mate!
<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> change your createParent function to return by reference:
>
> function &createParent()
> {
> return new Parent;
> }
>
> it returns 'two' and 'two' for me
>
> Regards,
> - reynard
>
> >Hi all,
> >
> >I came across the following weird situation. I don't get it, I hope some
of
> >you can explain the logic of it all.
> >
> >[begin code]-------------------------------
> ><?php
> >
> >/* Define class Parent. Its constructor sets an instance of Child in
> >property $child and passes itself to Child's constructor. */
> >class Parent
> >{
> > var $child;
> > var $property = 'one';
> >
> > function Parent()
> > {
> > $this->child = &new Child($this);
> > }
> >}
> >
> >/* Define class Child. Its constructor assigns a reference of the Parent
> >object that contains this Child object to property $parent. */
> >class Child
> >{
> > var $parent;
> >
> > function Child(&$p)
> > {
> > $this->parent = &$p;
> > }
> >}
> >
> >/* This function instantiates and returns a new Parent class. */
> >function createParent()
> >{
> > return new Parent;
> >}
> >
> >/* $p is a reference of the Parent object created by createParent(). */
> >$p = &createParent();
> >
> >/* The $property property of the Parent object is changed. */
> >$p->property = 'two';
> >
> >/* Since $p should be the same object as $p->child->parent, the following
> >should print twice the same. */
> >print $p->property . '<BR>';
> >print $p->child->parent->property . '<BR>';
> >
> >?>
> >[end code]-----------------------------------
> >
> >Now the problem is: IT DOES NOT PRINT TWICE THE SAME!!!
> >Instead it prints 'two' and then 'one', which indicates that
> >$p->child->parent is another object than $p. The problem is that the
object
> >*returned* by createParent() is not the same object as the object that is
> >*created* by createParent(). Just replace the line $p = &createParent();
by
> >$p = &new Parent(); -- this works perfectly fine! Conclusion:
createParent()
> >does not return the object it creates!
> >
> >Someone knows why this ain't working and how to solve it?!? Hope so,
can't
> >wait to hear from you guys.
> >
> >Thanks in advance,
> >
> >Tim Molendijk
>
>
> __________________________________________________________________
> The NEW Netscape 7.0 browser is now available. Upgrade now!
http://channels.netscape.com/ns/browsers/download.jsp
>
> Get your own FREE, personal Netscape Mail account today at
http://webmail.netscape.com/
--- End Message ---
--- Begin Message ---
Hi,
Sunday, December 22, 2002, 1:43:27 PM, you wrote:
TM> Wow!! You're my king! Thanks, that syntax is completely new to me!
TM> Great, another thing learned today! :)
TM> Cheers mate!
You have setup a recursive reference there with child, I don't know if this
causes bad things to happen in php?
I guess time will tell :)
--
regards,
Tom
--- End Message ---
--- Begin Message ---
I'll try.
/* This function instantiates and returns a new Parent class. */
function createParent()
{
return new Parent;
}
/* $p is a reference of the Parent object created by createParent(). */
$p = &createParent();
I believe the problem occurs here. $p becomes a reference to the
createParent() function whose return value is the Parent object.
This *should* work:
function createParent()
{
//the lack of the '()' might have caused other problems
return &new Parent();
}
$p = createParent();
That way $p equals the value that is returned by the function
createParent, which is a reference to the Parent object.
Then again, I haven't tested any of this, just going on some instinct here.
--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/
--- End Message ---
--- Begin Message ---
just a little update after playing arround with this stuffs,
I think this behavior happens when there is nothing else pointing to variable $a.
so for example, this works also:
$tmp =& $a;
$a =& $a->next;
I'm wondering how php does garbage collection? does it immediately delete variables
that have nothing pointing to it?
- reynard
>hi,
>
>I just found this behavior when trying to implement a linked list with php.
>In linked list it's common to say:
>$a =& $a->next;
>when traversing the list. but this doesn't work (it gives segmentation fault when
>trying to access the $head->next object (after the above assignment).
>but this work:
>
>$tmp =& $a;
>$a =& $tmp->next;
>
>I don't know if this can be considered a bug or if it's designed to work that way.
>But I think it would be nice to be able to do it without creating temporary variable.
>
>
>here is the full code. I'm using php 4.2.2 and I'm running the code from comand line.
>(if I execute it from the web it gives something like 'document contains no data'
>instead of segmentation fault)
>
__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now!
http://channels.netscape.com/ns/browsers/download.jsp
Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
--- End Message ---
--- Begin Message ---
Hi All,
Relatively new PHP coder (was in an MS / ASP shop before)... I'm doing some
flat-file manipulation (please, spare me the database comments, I'm working
on it!), and I'm having to read strings out of one file and copy them into
another until a while() condition is satisfied.
The problem is, I seem to always end up with a blank line at the end of my
files (which then screws up later file-processing) - I'm assuming because of
the \n that fwrite() appends to the end of each string...
Is there a simple way to get rid of this blank line or somehow get fwrite()
to NOT put a newline on the end of a string?
Thanks in Advance,
--Noel Wade
--- End Message ---
--- Begin Message ---
I'm using a HTML form to submit flat text files to a MySQL database. When I
upload the text file by FTP the script that loads it's contents into the
database works as expected. When I upload using the HTML form it seems to
ignore the new line in the text file. As a result it only creates one row in
the table with some overflow in the last cell. Does anyone know how to deal
with this?
thanks,
loop
Relevant code (This executes without error)---
-- from .html ------
<form action="db_upload.php" method="post" ENCTYPE="multipart/form-data">
<input type="file" size=40 name="file"><br>
<input type="hidden" name="MAX_FILE_SIZE" value="10000">
<input type="submit" value="upload">
</form>
---end from .html ----
--- from ,php ----
$file = $_FILES['file']['tmp_name'];
$file_name = $_FILES['file']['name'];
$path = "userfile/" . $file_name;
$size = filesize($file);
$type = $_FILES['file']['type'];
if($type != 'text/plain') {
echo "You may only upload text files.";
exit;
}
if($size > 10000) {
echo "The file is to large.";
exit;
}
copy($file, "userfile/$file_name");
unlink($file);
--- everything efter this working as expected ----
_________________________________________________________________
MSN 8 with e-mail virus protection service: 3 months FREE*.
http://join.msn.com/?page=features/virus&xAPID=42&PS=47575&PI=7324&DI=7474&SU=
http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_eliminateviruses_3mf
--- End Message ---
--- Begin Message ---
On Sunday 22 December 2002 14:04, James Brennan wrote:
> I'm using a HTML form to submit flat text files to a MySQL database. When I
> upload the text file by FTP the script that loads it's contents into the
> database works as expected. When I upload using the HTML form it seems to
> ignore the new line in the text file. As a result it only creates one row
> in the table with some overflow in the last cell. Does anyone know how to
> deal with this?
When transferring text files, the ftp client usually transparently handles the
"newline" issues when going from eg DOS -> Unix, and vice-versa.
If you're uploading the file via an HTML form then you're getting the file
unchanged.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Reputation, adj.:
What others are not thinking about you.
*/
--- End Message ---
--- Begin Message ---
Okay, attacking my flat-file issues from the other end:
When you use $foo = fgets($fp_file); it appears that a blank line ends up
looking exactly like a FALSE ("failed to read") return value... Is there
any way to differentiate between an empty-string read (a blank line in a
flat-file) and a FALSE return from fgets() ??
Thanks a bunch,
--Noel
--- End Message ---
--- Begin Message ---
On Sunday 22 December 2002 14:18, Noel Wade wrote:
> Okay, attacking my flat-file issues from the other end:
>
> When you use $foo = fgets($fp_file); it appears that a blank line ends up
> looking exactly like a FALSE ("failed to read") return value... Is there
> any way to differentiate between an empty-string read (a blank line in a
> flat-file) and a FALSE return from fgets() ??
Your code is probably incorrect. Does the example for fgets() in the manual
work for you?
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
I'm proud to be paying taxes in the United States. The only thing is
-- I could be just as proud for half the money.
-- Arthur Godfrey
*/
--- End Message ---
--- Begin Message ---
"Noel Wade" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> When you use $foo = fgets($fp_file); it appears that a blank line ends up
> looking exactly like a FALSE ("failed to read") return value...
A blank line should return the newline (\n or \r\n), according to
http://www.php.net/manual/en/function.fgets.php. Also try using '===' (3 =
signs) as the operator, which enforces type checking on a comparison).
- Steve Yates
- If you only have a nail every tool looks like a hammer.
~ Taglines by Taglinator - www.srtware.com ~
--- End Message ---
--- Begin Message ---
> A blank line should return the newline (\n or \r\n), according to
> http://www.php.net/manual/en/function.fgets.php. Also try using '===' (3 =
> signs) as the operator, which enforces type checking on a comparison).
Yes or no:
$foo == FALSE === 0;
???
Right now I'm just doing
if($foo)
And "\n" seems to equate to FALSE with this sort of conditional /
comparison...
Thanks, take care,
--Noel
--- End Message ---
--- Begin Message ---
Changing ENCTYPE to "text/plain" from "multipart/form-data" solved the
problem.
:)
loop
From: "James Brennan" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP] uploading flat text to MySQL
Date: Sun, 22 Dec 2002 01:04:14 -0500
I'm using a HTML form to submit flat text files to a MySQL database. When I
upload the text file by FTP the script that loads it's contents into the
database works as expected. When I upload using the HTML form it seems to
ignore the new line in the text file. As a result it only creates one row
in the table with some overflow in the last cell. Does anyone know how to
deal with this?
thanks,
loop
Relevant code (This executes without error)---
-- from .html ------
<form action="db_upload.php" method="post" ENCTYPE="multipart/form-data">
_________________________________________________________________
MSN 8: advanced junk mail protection and 3 months FREE*.
http://join.msn.com/?page=features/junkmail&xAPID=42&PS=47575&PI=7324&DI=7474&SU=
http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_advancedjmf_3mf
--- End Message ---
--- Begin Message ---
Nevermind. I'm a retard. That didn't actualy work. I was executing an old
script.
I'm going to get away from my computer now before I do something realy
stupid :P
g'night,
loop
.... sorry for the multiple posts
Changing ENCTYPE to "text/plain" from "multipart/form-data" solved the
problem.
:)
loop
From: "James Brennan" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP] uploading flat text to MySQL
Date: Sun, 22 Dec 2002 01:04:14 -0500
I'm using a HTML form to submit flat text files to a MySQL database. When
I upload the text file by FTP the script that loads it's contents into the
database works as expected. When I upload using the HTML form it seems to
ignore the new line in the text file. As a result it only creates one row
in the table with some overflow in the last cell. Does anyone know how to
deal with this?
thanks,
loop
Relevant code (This executes without error)---
-- from .html ------
<form action="db_upload.php" method="post" ENCTYPE="multipart/form-data">
_________________________________________________________________
MSN 8: advanced junk mail protection and 3 months FREE*.
http://join.msn.com/?page=features/junkmail&xAPID=42&PS=47575&PI=7324&DI=7474&SU=
http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_advancedjmf_3mf
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
The new MSN 8: smart spam protection and 3 months FREE*.
http://join.msn.com/?page=features/junkmail&xAPID=42&PS=47575&PI=7324&DI=7474&SU=
http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_smartspamprotection_3mf
--- End Message ---
--- Begin Message ---
Hello,
On 12/21/2002 08:10 PM, Jonathan Chum wrote:
An upcoming project I'm working and spec'ing out is a mass mailing
application. Initially, I was looking at Mailman which was written in Python
since it looks like it handles delivering emails efficiently without killing
the server. We have 1 client able to send 110,000 emails at 6.5K avg per
week on PIII 800 with 128 MB RAM using Mailman. The inteface however is very
bad and we'd like to develop other features like text ads, tracking,
templates, etc. This would require writing a wrapper around Mailman in PHP.
I was considering of writing the mass mailing application in PHP instead
though.
If anyone has eperience writing such applications with this amount of
emails, I'd like to know what you've done.
If you do not need to send personalized messages (messages that differ
for each recipient), just put all recipients in a BCc: header and send a
single message to the local mailer queue (not via SMTP).
If you do not care for the users that bounce messages, just make the
return path be black hole email address. OTOH, if you care about bounces
(you should if you mailing list is large or is not clean), consider
using ezmlm, which is a mailing list manager than among other things
takes care of bounce messages thanks to qmail VERP. I was told that is
the one that eGroups hacked to use in the now known YahooGroups site.
Once I built a small Web interface for ezmlm. It was meant just to
create and edit several mailing lists meant to be used as newsletter for
a portal with many sites. Is simple but it already comes with a SOAP
interface to manage the mailing list subscribers remotely.
http://www.phpclasses.org/ezmlmmanager
I'm thinking of coding the front end in PHP that will put the email into a
queue table that will force a command line PHP script listening on a
particular port to scan the database for this new task in queue. Once it
picks up the task, the timeout for this application to run will be set to
infinite. It'll establish a SMTP socket either to a really beefed up mailing
list server or the localhost SMTP server to begin blasting out these emails.
From what I understand, it's better to blast emails via an open socket
connection to SMTP rather than looping through Sendmail. Is this the right
thing todo?
No, queuing via SMTP is the slowest way to send messages. Your script
should not bother to deliver the messages to the recipients SMTP
servers. Delivery can take hours or days to finish due to network
congestions and hard to conect SMTP servers. Just queue the messages in
the local mailer and let it take care the actual delivery.
I would recommend a qmail based system anytime, with or without ezmlm on
top. In a production system that I manage, it just takes 3 seconds to
queue a alert message to be sent to 50,000 via a local qmail server.
You can also use sendmail almost as fast using the queue only mode. Some
people think that sendmail is slow and many forks processes because they
are not aware of how to configure it to queue the messages the fastest
way that is possible.
You may want to look into this class that has a sub-classes for
delivering with sendmail program directly instead of using the mail().
It lets you configure the sendmail delivery mode. There is also a
sub-class for delivering with qmail.
http://www.phpclasses.org/mimemessage
I've also heard that PHP is not good for writing mailing lists application,
but Mailman is written in Python and it's able to send thousands of email
just fine. Any thoughts on this?
When people do not know how to do it properly, they blame it on the
software. Note down: *smart software always beats fast software*. Sure
you can use a faster language like C (not Python), but if you develop
smart software in PHP it can be almost as fast as a similar solution in
C and does not take an etternity to develop and debug.
--
Regards,
Manuel Lemos
--- End Message ---
--- Begin Message ---
"Dave J. Hala Jr." <[EMAIL PROTECTED]> ha scritto nel messaggio
1040500684.942.130.camel@badboy">news:1040500684.942.130.camel@badboy...
> I've got a bunch of fields in a mysql database that have a \Z character
> in them. I want to search a field for \Z and if it contains that
> character, make the field blank.
>
> In running php 4.x on RH 8.0
>
> Here is the code:
>
> $connection = db_connect("Could not connect DB");
> $SQL="SELECT id,PVLN from lhpl_side WHERE PVLN =\"\\Z\" ";
> $result= mysql_query($SQL,$connection) or die (mysql_error());
> $num = mysql_numrows($result);
You are looking for a field that is a string and consist of a \Z character!
not more not less. I don't understand if this is what you want or you want
to find all fields that CONTAIN a \Z in any position. In this case the
correct query would be
select id,PVLN from lhpl_side WHERE PVLN LIKE \"%\\Z\%"
mATTIA cAZZOLA
--- End Message ---
--- Begin Message ---
This field contains ONLY the \Z. Thanks for the suggestion but it
generates the following error message:
Parse error: parse error, unexpected '\"' in
On Sun, 2002-12-22 at 04:49, Mattia wrote:
>
> "Dave J. Hala Jr." <[EMAIL PROTECTED]> ha scritto nel messaggio
> 1040500684.942.130.camel@badboy">news:1040500684.942.130.camel@badboy...
> > I've got a bunch of fields in a mysql database that have a \Z character
> > in them. I want to search a field for \Z and if it contains that
> > character, make the field blank.
> >
> > In running php 4.x on RH 8.0
> >
> > Here is the code:
> >
> > $connection = db_connect("Could not connect DB");
> > $SQL="SELECT id,PVLN from lhpl_side WHERE PVLN =\"\\Z\" ";
> > $result= mysql_query($SQL,$connection) or die (mysql_error());
> > $num = mysql_numrows($result);
>
> You are looking for a field that is a string and consist of a \Z character!
> not more not less. I don't understand if this is what you want or you want
> to find all fields that CONTAIN a \Z in any position. In this case the
> correct query would be
>
> select id,PVLN from lhpl_side WHERE PVLN LIKE \"%\\Z\%"
>
> mATTIA cAZZOLA
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
"...Unix, MS-DOS and Windows NT (also known as the Good, the Bad, and
the Ugly)"
OSIS
Dave J. Hala Jr.
641.485.1606
--- End Message ---
--- Begin Message ---
I have generated a page on our server using PHP (from within a CMS system)
which I renamed the output .html to use in an html email.
My problem is when I cut and paste the HTML into the email (Outlook) it
either:
displays the code,
displays the html email and then when it's sent, sends it as an attachment
or sends it as a bunch of html links and badly formatted text.
I assumed (badly) that Outlook would simply send HTML emails if you
formatted the program to send html emails but this seems almost impossible.
Anyone have any suggestions?
This is the page I want to send:
http://www.violasystems.com/e-news/template.html
--- End Message ---
--- Begin Message ---
Hi all
I'm reviewing a few things before starting a new project. I often need to
include() a file relative to the current script which itself is included.
__FILE__ is useful to know the current script's path but it seems to be
totally undocumented at php.net except for a few indirect references and
user comments. Is it still current? I don't want to use something that might
disappear soon but I haven't found any of the newer variables that do the
same thing.
Unfortunately __FILE__ is difficult to search for on php.net because you end
up seeing the result simply for 'file' which is not very helpful.
Perhaps my real question should be:
What is the cleanest and self-contained way to do a relative include from an
included file which might not be in the same directory as its parent? A
change in PHP 4.1 almost solved this but not quite. If it doesn't find the
file in the include_path then it looks in the same directory as the current
script. IMHO, its doing it in the wrong order. It would make more sense to
check the currect directory first before trying the include_path. Putting a
dot as the first element of the include_path doesn't fix it because the dot
means the current directory of the top parent.
Cheers
Ross
_________________________________________________________________
MSN 8 with e-mail virus protection service: 3 months FREE*.
http://join.msn.com/?page=features/virus&xAPID=42&PS=47575&PI=7324&DI=7474&SU=
http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_eliminateviruses_3mf
--- End Message ---