php-general Digest 22 Apr 2009 16:25:45 -0000 Issue 6081
Topics (messages 291793 through 291817):
Re: Suggestions of some good, simple file upload 'in progress' code?
291793 by: Michael Shadle
291810 by: haliphax
291814 by: tedd
291815 by: Andrea Giammarchi
291817 by: Michael Shadle
Re: checkboxes
291794 by: Ashley Sheridan
291798 by: PJ
291799 by: PJ
291800 by: Ashley Sheridan
291812 by: kranthi
Re: MAIL Error
291795 by: ramesh.marimuthu.wipro.com
291796 by: kranthi
291797 by: ramesh.marimuthu.wipro.com
291811 by: tedd
Regex not working with ":"
291801 by: Merlin Morgenstern
291808 by: kyle.smith
291809 by: Richard Quadling
291816 by: Merlin Morgenstern
Can PHP determine if the STDOUT to a CLI script is being redirected?
291802 by: Richard Quadling
291803 by: Per Jessen
291804 by: Richard Quadling
291805 by: Per Jessen
Re: Unable to send mail from PHP to AT&T e-mail address
291806 by: Edward Diener
291807 by: Richard Quadling
Re: MySQL, MD5 and SHA1
291813 by: Jan G.B.
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 ---
On Tue, Apr 21, 2009 at 9:02 PM, scubak1w1 <[email protected]> wrote:
>
> ""scubak1w1"" <[email protected]> wrote in message
> news:[email protected]...
>> Hello,
>>
>> Can someone pass on some suggestions of some good, simple file upload 'in
>> progress' code?
>>
>> Maybe as simple as changing the cursor icon for the duration?
>
> [self snip!]
>
> http://www.johnboy.com/about-us/news/a-useful-php-file-upload-progress-meter
> seems to be the "cleanest" example I can find - would this be fair to say?
Google Gears makes it very easy and can make it very simple (no
webserver configuration required) to basically slice the file up and
send chunks via POST - I need to publish all the code and a howto, and
Valery has written some code for nginx that might make it alleviate
the need for PHP to be involved at all - I have still not tested that
though, but the PHP code required is only like 10 lines or so, the
Gears stuff is pretty basic Javascript and since it's Javascript you
can make it match your UI perfectly by filling in div tags or whatever
else you want (works great with jQuery)
Actually I have a demo, not the cleanest code if you view the source
but you get the idea. It also works over NFS with multiple webservers
writing to the same file (I have 3 webservers behind LVS so
technically your request could be going to any of them)
http://mikehost.com/~mike/tmp/u/ <- frontend and view source to see gears + js
http://mikehost.com/~mike/tmp/u/temp.php.txt <- server side piece
I can't find the latest/cleanest code, but it gives you an idea.
--- End Message ---
--- Begin Message ---
On Tue, Apr 21, 2009 at 11:35 PM, Michael Shadle <[email protected]> wrote:
> On Tue, Apr 21, 2009 at 9:02 PM, scubak1w1 <[email protected]> wrote:
>>
>> ""scubak1w1"" <[email protected]> wrote in message
>> news:[email protected]...
>>> Hello,
>>>
>>> Can someone pass on some suggestions of some good, simple file upload 'in
>>> progress' code?
>>>
>>> Maybe as simple as changing the cursor icon for the duration?
>>
>> [self snip!]
>>
>> http://www.johnboy.com/about-us/news/a-useful-php-file-upload-progress-meter
>> seems to be the "cleanest" example I can find - would this be fair to say?
>
> Google Gears makes it very easy and can make it very simple (no
> webserver configuration required) to basically slice the file up and
> send chunks via POST - I need to publish all the code and a howto, and
> Valery has written some code for nginx that might make it alleviate
> the need for PHP to be involved at all - I have still not tested that
> though, but the PHP code required is only like 10 lines or so, the
> Gears stuff is pretty basic Javascript and since it's Javascript you
> can make it match your UI perfectly by filling in div tags or whatever
> else you want (works great with jQuery)
>
> Actually I have a demo, not the cleanest code if you view the source
> but you get the idea. It also works over NFS with multiple webservers
> writing to the same file (I have 3 webservers behind LVS so
> technically your request could be going to any of them)
>
> http://mikehost.com/~mike/tmp/u/ <- frontend and view source to see gears + js
> http://mikehost.com/~mike/tmp/u/temp.php.txt <- server side piece
>
> I can't find the latest/cleanest code, but it gives you an idea.
Michael,
Given the fact that Gears requires a client-side installation, has an
awful penetration percentage, and his original solution is all
server-side (though it does require APC and YUI-JS), I wouldn't say
this is a very good suggestion. Compared to what he has already found,
the Gears solution is not "clean" by any stretch of the imagination.
Greg,
I believe the link you posted is a very elegant solution that does not
(at first glance) involve Flash objects or Java applets. I'm a little
disappointed that a particular JS framework is necessary, but that's
just the nature of the beast with this sort of thing. If I were you,
I'd run with the "native" PHP solution you've already found. Maybe you
can even crack open the JS and find a way to do it with your favorite
framework as opposed to YUI...
My 2c,
--
// Todd
--- End Message ---
--- Begin Message ---
At 9:28 PM -0600 4/21/09, scubak1w1 wrote:
Hello,
Can someone pass on some suggestions of some good, simple file upload 'in
progress' code?
After all is said, you can pick anything you want from here:
http://webbytedd.com/bb/wait/
This is as simple as it gets for there is no simple solution.
If you want a real-time upload progress bar, then you may find it too
much effort for the small return it provides. Yoyu might want to take
the easy way out like I did.
Besides, what does a user expect anyway? They just want to know that
something is happening and an animated gif works as well as anything
else. Is it really important (or do they care) for them to know when
50% is uploaded?
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
nobody knows my last creation?
http://code.google.com/p/noswfupload/
full example with PHP back end in the zip.
P.S. ... just in case ... the first upload progress for PHP with Ajax and NO
APC ( ages ago, still me: http://www.devpro.it/upload_progress/ )
Flash FileReference porting ... still me, before SWFUpload solution or others
Flash based: http://www.devpro.it/FileReference/
Finally, last attemp before noswfupload, jQuery plus APC for uplaod progress
meter:
http://webreflection.blogspot.com/2007/10/upload-progress-bar-with-php5-apc-and.html
I kinda worked with "uploaders" since I used bottle I guess :D
Regards
> Date: Wed, 22 Apr 2009 08:20:28 -0500
> From: [email protected]
> To: [email protected]
> Subject: Re: [PHP] Re: Suggestions of some good, simple file upload 'in
> progress' code?
>
> On Tue, Apr 21, 2009 at 11:35 PM, Michael Shadle <[email protected]> wrote:
> > On Tue, Apr 21, 2009 at 9:02 PM, scubak1w1 <[email protected]> wrote:
> >>
> >> ""scubak1w1"" <[email protected]> wrote in message
> >> news:[email protected]...
> >>> Hello,
> >>>
> >>> Can someone pass on some suggestions of some good, simple file upload 'in
> >>> progress' code?
> >>>
> >>> Maybe as simple as changing the cursor icon for the duration?
> >>
> >> [self snip!]
> >>
> >> http://www.johnboy.com/about-us/news/a-useful-php-file-upload-progress-meter
> >> seems to be the "cleanest" example I can find - would this be fair to say?
> >
> > Google Gears makes it very easy and can make it very simple (no
> > webserver configuration required) to basically slice the file up and
> > send chunks via POST - I need to publish all the code and a howto, and
> > Valery has written some code for nginx that might make it alleviate
> > the need for PHP to be involved at all - I have still not tested that
> > though, but the PHP code required is only like 10 lines or so, the
> > Gears stuff is pretty basic Javascript and since it's Javascript you
> > can make it match your UI perfectly by filling in div tags or whatever
> > else you want (works great with jQuery)
> >
> > Actually I have a demo, not the cleanest code if you view the source
> > but you get the idea. It also works over NFS with multiple webservers
> > writing to the same file (I have 3 webservers behind LVS so
> > technically your request could be going to any of them)
> >
> > http://mikehost.com/~mike/tmp/u/ <- frontend and view source to see gears +
> > js
> > http://mikehost.com/~mike/tmp/u/temp.php.txt <- server side piece
> >
> > I can't find the latest/cleanest code, but it gives you an idea.
>
> Michael,
>
> Given the fact that Gears requires a client-side installation, has an
> awful penetration percentage, and his original solution is all
> server-side (though it does require APC and YUI-JS), I wouldn't say
> this is a very good suggestion. Compared to what he has already found,
> the Gears solution is not "clean" by any stretch of the imagination.
>
>
> Greg,
>
> I believe the link you posted is a very elegant solution that does not
> (at first glance) involve Flash objects or Java applets. I'm a little
> disappointed that a particular JS framework is necessary, but that's
> just the nature of the beast with this sort of thing. If I were you,
> I'd run with the "native" PHP solution you've already found. Maybe you
> can even crack open the JS and find a way to do it with your favorite
> framework as opposed to YUI...
>
>
> My 2c,
>
>
> --
> // Todd
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/
--- End Message ---
--- Begin Message ---
On Wed, Apr 22, 2009 at 6:20 AM, haliphax <[email protected]> wrote:
> Michael,
>
> Given the fact that Gears requires a client-side installation, has an
> awful penetration percentage, and his original solution is all
> server-side (though it does require APC and YUI-JS), I wouldn't say
> this is a very good suggestion. Compared to what he has already found,
> the Gears solution is not "clean" by any stretch of the imagination.
a) the native solution that requires APC is not multi-webserver capable
b) i was just sharing a different approach to an idea. who knows. it
might be something to explore. gears is pretty lightweight, and for
the ease of this and the functionality it brings (not to mention
cross-browser+platform) i see a compelling reason to give it a shot.
c) the APC method -still- requires webserver tweaks and post max size
etc. this is sending small chunks of data, is proxy-safe, and requires
nothing on the server; all that is required is gears, which is a
library to extend your browser's capabilities and i have not heard any
issues with it or security holes thus far. penetration is an issue but
when more sites push it and say "hey, you should install it" the
penetration will grow. not to mention youtube for example is using
roughly the same method and picking up a lot of browser installs off
that.
flash started out as a baby too. even java did (inside of browsers) ...
i completely disagree it is not "clean" - it is literally one browser
addon that a lot of people do have, comes from a reputable company,
and creates basically limitless upload capabilities - i can do 300 meg
files without blinking - it's not one long single POST that can fail
anytime, it's lots of small POST requests; it takes basic PHP on the
server and then some javascript for the UI (all the pieces to get a
basic functional install i sent links to)
how is that not "cleaner" than requiring the right version of apc,
hoping that one single long POST doesn't fail, etc?
our next version will include re-transmission on any chunk failure and
some other stuff, too. we're talking about literally any file size,
and even multiple file support, with the capability to retry on
failure so you -know- your file will get there, no matter if you're on
fast broadband or third world connectivity. we've dealt with issues
for years with people in geos having to send us links to files and
have us upload them for them... not anymore.
--- End Message ---
--- Begin Message ---
On Wed, 2009-04-22 at 07:17 +0530, kranthi wrote:
> yeh an onclick event handler is required to achieve this. but as Shawn
> has suggested radio buttons are better in this case.
>
> but then again if u want to disable/greyout the other input(like
> textboxes, other than the radio button itself) u'll hav to use onclick
> event handler for the radio buttons
>
Not necessarily, you could use CSS to change the background colour:
input[checked=checked]
{
set styles here
}
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
> On Wed, 2009-04-22 at 07:17 +0530, kranthi wrote:
>> yeh an onclick event handler is required to achieve this. but as Shawn
>> has suggested radio buttons are better in this case.
>>
>> but then again if u want to disable/greyout the other input(like
>> textboxes, other than the radio button itself) u'll hav to use onclick
>> event handler for the radio buttons
>>
> Not necessarily, you could use CSS to change the background colour:
>
> input[checked=checked]
> {
> set styles here
> }
I see that Shawn's suggested radio buttons will do just fine. I hadn't
thought about that. Dummy me.
But the real problem I have is to pass a form input value to a variable.
For example:
<input type="text" name="titleIN" size="52" />
<input type="radio" name="choice" value="$titleIN" />
How can I pass the "text" input to a variable that could be used by the
"radio" button?
The idea is to have several inputs for a search page with the inputs
limited by the radio button to one choice of several inputs. If I can
get the input to a variable, I can then manipulate it to do a query for
the search. :-\
Hope this is understandable?
--
unheralded genius: "A clean desk is the sign of a dull mind. "
-------------------------------------------------------------
Phil Jourdan --- [email protected]
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php
--- End Message ---
--- Begin Message ---
PJ wrote:
> Ashley Sheridan wrote:
>
>> On Wed, 2009-04-22 at 07:17 +0530, kranthi wrote:
>>
>>> yeh an onclick event handler is required to achieve this. but as Shawn
>>> has suggested radio buttons are better in this case.
>>>
>>> but then again if u want to disable/greyout the other input(like
>>> textboxes, other than the radio button itself) u'll hav to use onclick
>>> event handler for the radio buttons
>>>
>>>
>> Not necessarily, you could use CSS to change the background colour:
>>
>> input[checked=checked]
>> {
>> set styles here
>> }
>>
> I see that Shawn's suggested radio buttons will do just fine. I hadn't
> thought about that. Dummy me.
> But the real problem I have is to pass a form input value to a variable.
> For example:
> <input type="text" name="titleIN" size="52" />
> <input type="radio" name="choice" value="$titleIN" />
> How can I pass the "text" input to a variable that could be used by the
> "radio" button?
> The idea is to have several inputs for a search page with the inputs
> limited by the radio button to one choice of several inputs. If I can
> get the input to a variable, I can then manipulate it to do a query for
> the search. :-\
> Hope this is understandable?
Here's something I found but don't understand if or how it could be
used: (from php.net manual)
|quote... snip...
to reliably allow form data to be fed back into a form (for editing a
record, for instance) is like this:
echo "<input type='text' name='varname' ";
if(isset($existingvalue))
echo "value=\"".htmlspecialchars(stripslashes($existingvalue))."\" ";
echo "/>";
This assumes that variables have been escaped (such as addslashes) after
being retrieved from the database or after being received from a
(probably this) form. endquote
>From this form??? How would you get the $existingvalue? from the form? How?
I'm trying, I'm trying...
Phil
|
--
unheralded genius: "A clean desk is the sign of a dull mind. "
-------------------------------------------------------------
Phil Jourdan --- [email protected]
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php
--- End Message ---
--- Begin Message ---
On Wed, 2009-04-22 at 01:38 -0400, PJ wrote:
> Ashley Sheridan wrote:
> > On Wed, 2009-04-22 at 07:17 +0530, kranthi wrote:
> >> yeh an onclick event handler is required to achieve this. but as Shawn
> >> has suggested radio buttons are better in this case.
> >>
> >> but then again if u want to disable/greyout the other input(like
> >> textboxes, other than the radio button itself) u'll hav to use onclick
> >> event handler for the radio buttons
> >>
> > Not necessarily, you could use CSS to change the background colour:
> >
> > input[checked=checked]
> > {
> > set styles here
> > }
> I see that Shawn's suggested radio buttons will do just fine. I hadn't
> thought about that. Dummy me.
> But the real problem I have is to pass a form input value to a variable.
> For example:
> <input type="text" name="titleIN" size="52" />
> <input type="radio" name="choice" value="$titleIN" />
> How can I pass the "text" input to a variable that could be used by the
> "radio" button?
> The idea is to have several inputs for a search page with the inputs
> limited by the radio button to one choice of several inputs. If I can
> get the input to a variable, I can then manipulate it to do a query for
> the search. :-\
> Hope this is understandable?
>
> --
> unheralded genius: "A clean desk is the sign of a dull mind. "
> -------------------------------------------------------------
> Phil Jourdan --- [email protected]
> http://www.ptahhotep.com
> http://www.chiccantine.com/andypantry.php
>
Just accept all the text inputs from the form, and use a switch on the
radio button to determine which of the text inputs you use.
Alternatively, just use one text box for input and use the value of the
radio button to determine what to do with the text.
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
i find var_dump, trigger_error really useful in situations like these.
just do
var_dump($_POST); var_dump($_GET);
in the action{.php} script
and u'll find a good deal of useful information
--- End Message ---
--- Begin Message ---
Yeah its all garbage. But its from the company. I don't know how to trim
it. Can anyone suggest?
-----Original Message-----
From: tedd [mailto:[email protected]]
Sent: Tuesday, April 21, 2009 7:29 PM
To: Ramesh Marimuthu (WT01 - Telecom Equipment);
[email protected]
Subject: Re: [PHP] MAIL Error
At 12:58 PM +0530 4/21/09, <[email protected]> wrote:
>P Save a tree...please don't print this e-mail unless you really need
>to
>
>
>Please do not print this email unless it is absolutely necessary.
>
>The information contained in this electronic message and any
>attachments to this message are intended for the exclusive use of the
>addressee(s) and may contain proprietary, confidential or privileged
>information. If you are not the intended recipient, you should not
>disseminate, distribute or copy this e-mail. Please notify the sender
>immediately and destroy all copies of this message and any attachments.
>
>WARNING: Computer viruses can be transmitted via email. The recipient
>should check this email and any attachments for the presence of
>viruses. The company accepts no liability for any damage caused by any
>virus transmitted by this email.
>
>www.wipro.com
ramesh:
Could you trim your signature a bit?
What's this "Save a tree" nonsense??? The paper industry plants more
trees than it uses but this is not a topic for the PHP list.
How about saving bandwidth or saving us the time to review the same
long-ass signature over and over that tells us nothing but what everyone
already knows AND does absolutely nothing to protect the company you
work for. It's just a excessive length of garbage and misinformation
that tells everyone your company is totally clueless about list
etiquette.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
Please do not print this email unless it is absolutely necessary.
The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain proprietary, confidential or privileged information. If you are not the
intended recipient, you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately and destroy all copies of this message and
any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted by this
email.
www.wipro.com
--- End Message ---
--- Begin Message ---
seems u r company mail server is adding this to all outgoing mails. if
that is the case only option is to change configuration settings in
the mail server. you can ask the anchorites to do that (i m not
optimistic bout that, though).
dont use this mail server to send mails to mailing lists
Kranthi.
--- End Message ---
--- Begin Message ---
Thanks kranthi
-----Original Message-----
From: kranthi [mailto:[email protected]]
Sent: Wednesday, April 22, 2009 11:02 AM
To: Ramesh Marimuthu (WT01 - Telecom Equipment)
Cc: [email protected]; [email protected]
Subject: Re: [PHP] MAIL Error
seems u r company mail server is adding this to all outgoing mails. if
that is the case only option is to change configuration settings in the
mail server. you can ask the anchorites to do that (i m not optimistic
bout that, though).
dont use this mail server to send mails to mailing lists
Kranthi.
Please do not print this email unless it is absolutely necessary.
The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain proprietary, confidential or privileged information. If you are not the
intended recipient, you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately and destroy all copies of this message and
any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted by this
email.
www.wipro.com
--- End Message ---
--- Begin Message ---
At 10:45 AM +0530 4/22/09, <[email protected]> wrote:
Yeah its all garbage. But its from the company. I don't know how to trim
it. Can anyone suggest?
First, tell your company that they are making a fool of themselves on
the net and do they want to continue the practice? After all, their
practice is hindering you in your work for them. For example, when
you post a question to this list, there are people who will pass on
offering you advice because your signature makes you look like an
idiot.
Second, if they insist on continuing this idiotic practice, then get
a different email account for yourself. There are many places where
you can get an email account (i.e., gmail, yahoo, etc.) and it's
pretty simple to set one up so that you can use it from work.
Just because your company has idiotic practices doesn't mean that you
have to follow suit.
Cheers,
tedd
PS: You might also mention to the powers that be, they should clean
up their web site. While they may want to project the "we know it
all" image, their web site speaks volumes as to what they don't know.
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Hi there,
I am trying to remove a text which does contain a : inside. Somehow the
regex does not match, no matter what I do:
$contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$', '',
$contents ,'UTF-8');
Looks like this is a result of the :.
Does anybody have an idea how to do this?
Thank you for any help.
Merlin
--- End Message ---
--- Begin Message ---
Have you tried escaping the : with a \?
Like:
mb_ereg_replace('^(.*)this is the test\: replace(.*)$', '', $contents
,'UTF-8');
Also, have you tried removing the : and adjusting the input string to
verify your belief that it's the :?
HTH,
Kyle
-----Original Message-----
From: Merlin Morgenstern [mailto:[email protected]]
Sent: Wednesday, April 22, 2009 4:09 AM
To: [email protected]
Subject: [PHP] Regex not working with ":"
Hi there,
I am trying to remove a text which does contain a : inside. Somehow the
regex does not match, no matter what I do:
$contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$', '',
$contents ,'UTF-8');
Looks like this is a result of the :.
Does anybody have an idea how to do this?
Thank you for any help.
Merlin
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
2009/4/22 kyle.smith <[email protected]>:
> Have you tried escaping the : with a \?
>
> Like:
> mb_ereg_replace('^(.*)this is the test\: replace(.*)$', '', $contents
> ,'UTF-8');
>
> Also, have you tried removing the : and adjusting the input string to
> verify your belief that it's the :?
>
> HTH,
> Kyle
>
> -----Original Message-----
> From: Merlin Morgenstern [mailto:[email protected]]
> Sent: Wednesday, April 22, 2009 4:09 AM
> To: [email protected]
> Subject: [PHP] Regex not working with ":"
>
> Hi there,
>
> I am trying to remove a text which does contain a : inside. Somehow the
> regex does not match, no matter what I do:
>
> $contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$', '',
> $contents ,'UTF-8');
>
> Looks like this is a result of the :.
>
> Does anybody have an idea how to do this?
>
> Thank you for any help.
>
> Merlin
>
> --
> 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
>
>
Can you try ..
# Your regular expression could not be converted to the flavor
required by this language:
# A POSIX Extended RE cannot match the start and the end of a line with ^ and $
# A POSIX Extended RE cannot match the start and the end of a line with ^ and $
# Because of this, the code snippet below will not work as you
intended, if at all.
$contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$',
'\1\2', $contents, 'UTF-8');
The warnings above come from RegexBuddy. Considering the PHP examples,
I'm not sure how accurate they are.
--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
--- End Message ---
--- Begin Message ---
Richard Quadling wrote:
2009/4/22 kyle.smith <[email protected]>:
Have you tried escaping the : with a \?
Like:
mb_ereg_replace('^(.*)this is the test\: replace(.*)$', '', $contents
,'UTF-8');
Also, have you tried removing the : and adjusting the input string to
verify your belief that it's the :?
HTH,
Kyle
-----Original Message-----
From: Merlin Morgenstern [mailto:[email protected]]
Sent: Wednesday, April 22, 2009 4:09 AM
To: [email protected]
Subject: [PHP] Regex not working with ":"
Hi there,
I am trying to remove a text which does contain a : inside. Somehow the
regex does not match, no matter what I do:
$contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$', '',
$contents ,'UTF-8');
Looks like this is a result of the :.
Does anybody have an idea how to do this?
Thank you for any help.
Merlin
--
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
Can you try ..
# Your regular expression could not be converted to the flavor
required by this language:
# A POSIX Extended RE cannot match the start and the end of a line with ^ and $
# A POSIX Extended RE cannot match the start and the end of a line with ^ and $
# Because of this, the code snippet below will not work as you
intended, if at all.
$contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$',
'\1\2', $contents, 'UTF-8');
The warnings above come from RegexBuddy. Considering the PHP examples,
I'm not sure how accurate they are.
Hi there,
thank you for the help. Actually it was due to case sensitivity. Use
str_ireplace to fix it.
Regards, Merlin
--- End Message ---
--- Begin Message ---
Hi.
Is there a simple way for a CLI based PHP script to determine if its
output is being redirected to a file or piped through a filter (find,
sort, etc.)
I'm using ANSI escape sequences to colour the output (all working very
nicely), but I want to suppress the codes if the output is being
filtered or redirected to a file.
Regards,
Richard Quadling.
--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
--- End Message ---
--- Begin Message ---
Richard Quadling wrote:
> Hi.
>
> Is there a simple way for a CLI based PHP script to determine if its
> output is being redirected to a file or piped through a filter (find,
> sort, etc.)
>
> I'm using ANSI escape sequences to colour the output (all working very
> nicely), but I want to suppress the codes if the output is being
> filtered or redirected to a file.
Check out posix_isatty()
/Per
--
Per Jessen, Zürich (16.4°C)
--- End Message ---
--- Begin Message ---
2009/4/22 Per Jessen <[email protected]>:
> Richard Quadling wrote:
>
>> Hi.
>>
>> Is there a simple way for a CLI based PHP script to determine if its
>> output is being redirected to a file or piped through a filter (find,
>> sort, etc.)
>>
>> I'm using ANSI escape sequences to colour the output (all working very
>> nicely), but I want to suppress the codes if the output is being
>> filtered or redirected to a file.
>
> Check out posix_isatty()
>
>
> /Per
>
> --
> Per Jessen, Zürich (16.4°C)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
For windows?
--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
--- End Message ---
--- Begin Message ---
Richard Quadling wrote:
> 2009/4/22 Per Jessen <[email protected]>:
>> Richard Quadling wrote:
>>
>>> Hi.
>>>
>>> Is there a simple way for a CLI based PHP script to determine if its
>>> output is being redirected to a file or piped through a filter
>>> (find, sort, etc.)
>>>
>>> I'm using ANSI escape sequences to colour the output (all working
>>> very nicely), but I want to suppress the codes if the output is
>>> being filtered or redirected to a file.
>>
>> Check out posix_isatty()
>>
>> /Per
>>
>
> For windows?
Sorry, I have no idea.
/Per
--
Per Jessen, Zürich (16.1°C)
--- End Message ---
--- Begin Message ---
scubak1w1 wrote:
"Edward Diener" <[email protected]> wrote in message
news:[email protected]...
Chris wrote:
kranthi wrote:
of u are sure that the mail was not received as spam...
check the log files of the mail server on the server to be sure that
the mail actually reached the mail server from the http server
Somehow I doubt AT&T gives out that sort of access ;)
Exactly.
The idea is right if you have access to both servers though.
As you suggested, I can check my own server but I doubt I can get access
to AT&T's incoming mail server.
AT&T is potentially using one of the BLs such as SCBLs...
Try going to, say, http://www.senderbase.org/, enter the IP and then on the
listings page try the DNS-based blocklists [Show/Hide all] links
I pinged the domain part of the 'from' email for the sending server and
got back an IP address. I entered that IP address at
http://www.senderbase.org/ and received a 'Neutral' reputation score
with 'no information' found from whois and 'unknown' found for
information about the network.
I am not sure what final IP address the mail server is using to send out
e-mail but 7 addresses starting with the first 3 parts of the IP were
listed as addresses and all showed 0 DNSBL listings and 'Neutral' SBRS.
Needless to say no spam is being sent from the mail addresses, since it
is used by the server as part of a legitimate client-server program.
Also bl.spamcop.net shows nothing for the IP address.
--- End Message ---
--- Begin Message ---
2009/4/22 Edward Diener <[email protected]>:
> scubak1w1 wrote:
>>
>> "Edward Diener" <[email protected]> wrote in message
>> news:[email protected]...
>>>
>>> Chris wrote:
>>>>
>>>> kranthi wrote:
>>>>>
>>>>> of u are sure that the mail was not received as spam...
>>>>>
>>>>> check the log files of the mail server on the server to be sure that
>>>>> the mail actually reached the mail server from the http server
>>>>
>>>> Somehow I doubt AT&T gives out that sort of access ;)
>>>
>>> Exactly.
>>>
>>>> The idea is right if you have access to both servers though.
>>>
>>> As you suggested, I can check my own server but I doubt I can get access
>>> to AT&T's incoming mail server.
>>
>> AT&T is potentially using one of the BLs such as SCBLs...
>>
>> Try going to, say, http://www.senderbase.org/, enter the IP and then on
>> the listings page try the DNS-based blocklists [Show/Hide all] links
>
> I pinged the domain part of the 'from' email for the sending server and got
> back an IP address. I entered that IP address at http://www.senderbase.org/
> and received a 'Neutral' reputation score with 'no information' found from
> whois and 'unknown' found for information about the network.
>
> I am not sure what final IP address the mail server is using to send out
> e-mail but 7 addresses starting with the first 3 parts of the IP were listed
> as addresses and all showed 0 DNSBL listings and 'Neutral' SBRS. Needless to
> say no spam is being sent from the mail addresses, since it is used by the
> server as part of a legitimate client-server program.
>
> Also bl.spamcop.net shows nothing for the IP address.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
What output do you get from ...
nslookup -q=mx put_the_domain_here.com
e.g.
nslookup -q=mx google.com
Server: bv-vm-svr-1.[srcubbed].local
Address: 10.0.30.1
google.com MX preference = 10, mail exchanger = smtp3.google.com
google.com MX preference = 10, mail exchanger = smtp4.google.com
google.com MX preference = 10, mail exchanger = smtp1.google.com
google.com MX preference = 10, mail exchanger = smtp2.google.com
google.com nameserver = ns3.google.com
google.com nameserver = ns1.google.com
google.com nameserver = ns4.google.com
google.com nameserver = ns2.google.com
smtp1.google.com internet address = 209.85.237.25
smtp2.google.com internet address = 64.233.165.25
smtp3.google.com internet address = 209.85.137.25
smtp4.google.com internet address = 72.14.221.25
ns1.google.com internet address = 216.239.32.10
ns2.google.com internet address = 216.239.34.10
ns3.google.com internet address = 216.239.36.10
ns4.google.com internet address = 216.239.38.10
As you can see there are MANY servers set up to receive SMTP mail for google.com
None of them are the same as the IP you see when you ...
ping google.com
Pinging google.com [74.125.45.100] with 32 bytes of data:
Reply from 74.125.45.100: bytes=32 time=104ms TTL=239
Reply from 74.125.45.100: bytes=32 time=103ms TTL=239
Reply from 74.125.45.100: bytes=32 time=105ms TTL=239
Reply from 74.125.45.100: bytes=32 time=104ms TTL=239
Ping statistics for 74.125.45.100:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 103ms, Maximum = 105ms, Average = 104ms
--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
--- End Message ---
--- Begin Message ---
2009/4/21 Per Jessen <[email protected]>:
> Jan G.B. wrote:
>
>> A web application that uses an external db server would be quite ...
>> uhm... slow! Anyone did this, yet? ;)
>
> Certainly, and it's not slow. It depends entirely on your connection to
> the public internet.
>
>
As we're speaking of the internet, it also depends on the route and so
it depends on servers which are not underlying your administration (in
most cases at least).
Having several servers with gigabit internet access also might be more
expensive than a cat6 patch cable and a gigabit nic. So this setup
would be just mad.
Regards
--- End Message ---