php-general Digest 22 Apr 2009 16:25:45 -0000 Issue 6081

2009-04-22 Thread php-general-digest-help

php-general Digest 22 Apr 2009 16:25:45 - 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 ATT 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:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
On Tue, Apr 21, 2009 at 9:02 PM, scubak1w1 sk...@spamcop.net wrote:

 scubak1w1 sk...@spamcop.net wrote in message
 news:cf.13.21597.2ee8e...@pb1.pair.com...
 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---
---BeginMessage---
On Tue, Apr 21, 2009 at 11:35 PM, Michael Shadle mike...@gmail.com wrote:
 On Tue, Apr 21, 2009 at 9:02 PM, scubak1w1 sk...@spamcop.net wrote:

 scubak1w1 sk...@spamcop.net wrote in message
 news:cf.13.21597.2ee8e...@pb1.pair.com...
 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 

Re: [PHP] Re: checkboxes

2009-04-22 Thread PJ
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 --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Re: checkboxes

2009-04-22 Thread Ashley Sheridan
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 --- p...@ptahhotep.com
 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


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



[PHP] Regex not working with :

2009-04-22 Thread Merlin Morgenstern

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] Can PHP determine if the STDOUT to a CLI script is being redirected?

2009-04-22 Thread Richard Quadling
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=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP] Can PHP determine if the STDOUT to a CLI script is being redirected?

2009-04-22 Thread Per Jessen
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



Re: [PHP] Can PHP determine if the STDOUT to a CLI script is being redirected?

2009-04-22 Thread Richard Quadling
2009/4/22 Per Jessen p...@computer.org:
 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=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP] Can PHP determine if the STDOUT to a CLI script is being redirected?

2009-04-22 Thread Per Jessen
Richard Quadling wrote:

 2009/4/22 Per Jessen p...@computer.org:
 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)


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



Re: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread Edward Diener

scubak1w1 wrote:
Edward Diener el...@tropicsoft.com wrote in message 
news:d9.64.21597.c829e...@pb1.pair.com...

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 ATT 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 ATT's incoming mail server.


ATT 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



Re: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread Richard Quadling
2009/4/22 Edward Diener el...@tropicsoft.com:
 scubak1w1 wrote:

 Edward Diener el...@tropicsoft.com wrote in message
 news:d9.64.21597.c829e...@pb1.pair.com...

 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 ATT 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 ATT's incoming mail server.

 ATT 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.cominternet address = 209.85.237.25
smtp2.google.cominternet address = 64.233.165.25
smtp3.google.cominternet address = 209.85.137.25
smtp4.google.cominternet 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=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



RE: [PHP] Regex not working with :

2009-04-22 Thread kyle.smith
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:merli...@fastmail.fm] 
Sent: Wednesday, April 22, 2009 4:09 AM
To: php-general@lists.php.net
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



Re: [PHP] Regex not working with :

2009-04-22 Thread Richard Quadling
2009/4/22 kyle.smith kyle.sm...@inforonics.com:
 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:merli...@fastmail.fm]
 Sent: Wednesday, April 22, 2009 4:09 AM
 To: php-general@lists.php.net
 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=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP] Re: Suggestions of some good, simple file upload 'in progress' code?

2009-04-22 Thread haliphax
On Tue, Apr 21, 2009 at 11:35 PM, Michael Shadle mike...@gmail.com wrote:
 On Tue, Apr 21, 2009 at 9:02 PM, scubak1w1 sk...@spamcop.net wrote:

 scubak1w1 sk...@spamcop.net wrote in message
 news:cf.13.21597.2ee8e...@pb1.pair.com...
 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



RE: [PHP] MAIL Error

2009-04-22 Thread tedd

At 10:45 AM +0530 4/22/09, ramesh.marimu...@wipro.com 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

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



Re: [PHP] Re: checkboxes

2009-04-22 Thread kranthi
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

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



Re: [PHP] MySQL, MD5 and SHA1

2009-04-22 Thread Jan G.B.
2009/4/21 Per Jessen p...@computer.org:
 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

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



Re: [PHP] Suggestions of some good, simple file upload 'in progress' code?

2009-04-22 Thread tedd

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

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



RE: [PHP] Re: Suggestions of some good, simple file upload 'in progress' code?

2009-04-22 Thread Andrea Giammarchi

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: halip...@gmail.com
 To: php-general@lists.php.net
 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 mike...@gmail.com wrote:
  On Tue, Apr 21, 2009 at 9:02 PM, scubak1w1 sk...@spamcop.net wrote:
 
  scubak1w1 sk...@spamcop.net wrote in message
  news:cf.13.21597.2ee8e...@pb1.pair.com...
  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/

Re: [PHP] Regex not working with :

2009-04-22 Thread Merlin Morgenstern



Richard Quadling wrote:

2009/4/22 kyle.smith kyle.sm...@inforonics.com:

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:merli...@fastmail.fm]
Sent: Wednesday, April 22, 2009 4:09 AM
To: php-general@lists.php.net
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

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



Re: [PHP] Re: Suggestions of some good, simple file upload 'in progress' code?

2009-04-22 Thread Michael Shadle
On Wed, Apr 22, 2009 at 6:20 AM, haliphax halip...@gmail.com 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.

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



Re: [PHP] MAIL Error

2009-04-22 Thread Jan G.B.
I believe that you all should just overread the huge signature.
You've wasted a lot bandwidth with this discussion about the signature. :-)
It's not interesting.
You could have send your pointless replies to the person, skipping the
mailing list, so that we aren't annoyed by your drivel which is send
to thousnads of mail servers.

2009/4/22 tedd tedd.sperl...@gmail.com:
 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.


Some companies will fire you for using private email at work. = VERY GOOD TIP.

 Just because your company has idiotic practices doesn't mean that you have
 to follow suit.


It's idiotic to speak about that crap!


thanks for your time. time to get back on topic.

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



Re: [PHP] Re: Suggestions of some good, simple file upload 'in

2009-04-22 Thread Bradley Broerman


 If you'd like a simple Java Applet that can do the file upload, and
is scriptable through JavaScript, I have a fairly nice one that uses
FTP to upload the file. It has real-time feedback to the webapp, and
has a PHP webservice that it communicates with for authentication, and
notification. I also have one that will use SFTP if security is an
issue.  
 They're both on my home page http://www.bbroerman.net  just click on
the My Code button on the menu to go to the correct page.   
 I'll also help with any install questions, etc.   
 Cheers,  

 Brad Broerman  

   

Re: [PHP] MAIL Error

2009-04-22 Thread Daniel Brown
On Wed, Apr 22, 2009 at 12:31, Jan G.B. ro0ot.w...@googlemail.com wrote:
 I believe that you all should just overread the huge signature.
 You've wasted a lot bandwidth with this discussion about the signature. :-)
 It's not interesting.
 You could have send your pointless replies to the person, skipping the
 mailing list, so that we aren't annoyed by your drivel which is send
 to thousnads of mail servers.

You still have absolutely no idea of what this community is or was
before you came along and tried to instill your own sanctimonious
attitude and ideals on people.  Trust me on this: nothing you ever,
ever say will change people's minds here, Jan.


 2009/4/22 tedd tedd.sperl...@gmail.com:
 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.


 Some companies will fire you for using private email at work. = VERY GOOD 
 TIP.

Those same companies will probably fire you for chatting about
things unrelated to work via email.  Take it in context.

 Just because your company has idiotic practices doesn't mean that you have
 to follow suit.


 It's idiotic to speak about that crap!


 thanks for your time. time to get back on topic.

   This is the topic, Jan.  And if you can't play nice and adapt to
the community, don't expect them to adapt to you --- or to be very
welcome.  ;-P

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread Edward Diener

Phpster wrote:



On Apr 21, 2009, at 20:32, Edward Diener el...@tropicsoft.com wrote:

I have a PHP script which uses the PHP 'mail' function. When the 
script's 'to' address is an ATT address, such as my own as an ATT 
ISP customer, the mail never gets to me. If the 'to' address is 
anything other than an ATT address, the mail gets to the recipient. 
The PHP code for sending the mail is essentially:


   $headers  = 'MIME-Version: 1.0' . \r\n;
   $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n;
   $headers .= 'From: Some From Name somefromname.com';
   $to = 'mybellsouthaddress.net';
   $subject = 'Some Subject';
   $msg = 'Some Message';
   if(mail($to,$subject,$msg.\r\n\r\n,$headers))
   echo good;
   else
   echo bad;

In the actual PHP script the $to, $subject, and $msg are successfully 
passed to the script from the client side as $_POST, $_POST and 
$_FILES parameters respectively. I have just filled them in above so 
that they can be seen as if they were part of the script. The script 
always returns good, so the mail function must be successful.


In my project, testing has reported that any attempt to use the 'mail' 
function on the server to send to an ATT address fails to reach the 
recipient, while all other addresses used in the testing succeed in 
reaching the recipient. I can assert this to be the case with my own 
ATT address also. I have also checked my ATT mailbox online to make 
sure the mail is not being received as Spam.


Does anybody have an idea why using the 'mail' function succeeds with 
all but ATT $to addresses ? Naturally in the client-server 
application on which I am working, sending mail from the server must 
work for all $to addresses.


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



It might be that the server IP has been blacklisted with att as a 
domain  from which spam is sent.


I have found out that the server adds a from header of
'nob...@myserver.com' where 'myserver' is the name of the server. This 
header gets placed first before the From header I supply in my PHP 
script ( which should have had the form in the example above of 
'somefromn...@myserver.com, my bad ).


Perhaps the ATT mail server, when it sees the 'nob...@myserver.com' 
treats it as spam and does not deliver the mail to even the recipient's 
spam mailbox.


I am not sure if it is normal for outgoing SMTP mail servers to 
automatically add the 'nob...@myserver.com' from address first in the 
header, or even why it does so ? Does anybody know if this is normal for 
mail servers to do this ? Evidently other incoming mail servers do not 
react to the 'nob...@myserver.com' in any way, so maybe ATT is unique 
in this.


Any light anyone can throw on the 'nob...@myserver.com' address would be 
most welcome.


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



Re: [PHP] MAIL Error

2009-04-22 Thread tedd

At 6:31 PM +0200 4/22/09, Jan G.B. wrote:

I believe that you all should just overread the huge signature.
You've wasted a lot bandwidth with this discussion about the signature. :-)
It's not interesting.
You could have send your pointless replies to the person, skipping the
mailing list, so that we aren't annoyed by your drivel which is send
to thousnads of mail servers.

2009/4/22 tedd tedd.sperl...@gmail.com:

 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.



Some companies will fire you for using private email at work. = 
VERY GOOD TIP.



 Just because your company has idiotic practices doesn't mean that you have
 to follow suit.



It's idiotic to speak about that crap!


thanks for your time. time to get back on topic.


Jan:

Thanks for your input and you may be right, but you must also realize 
that this list governs itself, right?


If I get tried of reading the same pointless excessive signature over 
and over again and want to comment about it, I will.


Your opinion as to IF I should say something, or not, carries little 
weight. When you've donated enough time helping others on this list, 
then perhaps that will change. But for the moment, I think it's best 
for the OP to check with his work and see if he can reason with them. 
If not, I certainly have no reason to read the same drivel again 
and again. As such, I can skip questions posted by him -- and who 
does that hurt?


Now if you have a problem with the way we moderate this list, then 
post your objections and we'll all consider them and adapt what 
works. But as I see it, refusing to trim excessive signatures is not 
one that works well on this list. Remember, we all donate our time 
AND we choose who we help.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread Shawn McKenzie
Edward Diener wrote:
 Phpster wrote:


 On Apr 21, 2009, at 20:32, Edward Diener el...@tropicsoft.com wrote:

 I have a PHP script which uses the PHP 'mail' function. When the
 script's 'to' address is an ATT address, such as my own as an ATT
 ISP customer, the mail never gets to me. If the 'to' address is
 anything other than an ATT address, the mail gets to the recipient.
 The PHP code for sending the mail is essentially:

$headers  = 'MIME-Version: 1.0' . \r\n;
$headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n;
$headers .= 'From: Some From Name somefromname.com';
$to = 'mybellsouthaddress.net';
$subject = 'Some Subject';
$msg = 'Some Message';
if(mail($to,$subject,$msg.\r\n\r\n,$headers))
echo good;
else
echo bad;

 In the actual PHP script the $to, $subject, and $msg are successfully
 passed to the script from the client side as $_POST, $_POST and
 $_FILES parameters respectively. I have just filled them in above so
 that they can be seen as if they were part of the script. The script
 always returns good, so the mail function must be successful.

 In my project, testing has reported that any attempt to use the
 'mail' function on the server to send to an ATT address fails to
 reach the recipient, while all other addresses used in the testing
 succeed in reaching the recipient. I can assert this to be the case
 with my own ATT address also. I have also checked my ATT mailbox
 online to make sure the mail is not being received as Spam.

 Does anybody have an idea why using the 'mail' function succeeds with
 all but ATT $to addresses ? Naturally in the client-server
 application on which I am working, sending mail from the server must
 work for all $to addresses.

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


 It might be that the server IP has been blacklisted with att as a
 domain  from which spam is sent.
 
 I have found out that the server adds a from header of
 'nob...@myserver.com' where 'myserver' is the name of the server. This
 header gets placed first before the From header I supply in my PHP
 script ( which should have had the form in the example above of
 'somefromn...@myserver.com, my bad ).
 
 Perhaps the ATT mail server, when it sees the 'nob...@myserver.com'
 treats it as spam and does not deliver the mail to even the recipient's
 spam mailbox.
 
 I am not sure if it is normal for outgoing SMTP mail servers to
 automatically add the 'nob...@myserver.com' from address first in the
 header, or even why it does so ? Does anybody know if this is normal for
 mail servers to do this ? Evidently other incoming mail servers do not
 react to the 'nob...@myserver.com' in any way, so maybe ATT is unique
 in this.
 
 Any light anyone can throw on the 'nob...@myserver.com' address would be
 most welcome.

It is using the apache user @ your host name as the default.  Try this:

ini_set('sendmail_from', 'whate...@wherever.com');


-- 
Thanks!
-Shawn
http://www.spidean.com

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



RE: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread kyle.smith
Edward Diener wrote:
 Phpster wrote:


 On Apr 21, 2009, at 20:32, Edward Diener el...@tropicsoft.com
wrote:

 I have a PHP script which uses the PHP 'mail' function. When the 
 script's 'to' address is an ATT address, such as my own as an ATT 
 ISP customer, the mail never gets to me. If the 'to' address is 
 anything other than an ATT address, the mail gets to the recipient.
 The PHP code for sending the mail is essentially:

$headers  = 'MIME-Version: 1.0' . \r\n;
$headers .= 'Content-type: text/html; charset=iso-8859-1' .
\r\n;
$headers .= 'From: Some From Name somefromname.com';
$to = 'mybellsouthaddress.net';
$subject = 'Some Subject';
$msg = 'Some Message';
if(mail($to,$subject,$msg.\r\n\r\n,$headers))
echo good;
else
echo bad;

 In the actual PHP script the $to, $subject, and $msg are 
 successfully passed to the script from the client side as $_POST, 
 $_POST and $_FILES parameters respectively. I have just filled them 
 in above so that they can be seen as if they were part of the 
 script. The script always returns good, so the mail function must
be successful.

 In my project, testing has reported that any attempt to use the 
 'mail' function on the server to send to an ATT address fails to 
 reach the recipient, while all other addresses used in the testing 
 succeed in reaching the recipient. I can assert this to be the case 
 with my own ATT address also. I have also checked my ATT mailbox 
 online to make sure the mail is not being received as Spam.

 Does anybody have an idea why using the 'mail' function succeeds 
 with all but ATT $to addresses ? Naturally in the client-server 
 application on which I am working, sending mail from the server must

 work for all $to addresses.

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


 It might be that the server IP has been blacklisted with att as a 
 domain  from which spam is sent.
 
 I have found out that the server adds a from header of 
 'nob...@myserver.com' where 'myserver' is the name of the server. This

 header gets placed first before the From header I supply in my PHP 
 script ( which should have had the form in the example above of 
 'somefromn...@myserver.com, my bad ).
 
 Perhaps the ATT mail server, when it sees the 'nob...@myserver.com'
 treats it as spam and does not deliver the mail to even the 
 recipient's spam mailbox.
 
 I am not sure if it is normal for outgoing SMTP mail servers to 
 automatically add the 'nob...@myserver.com' from address first in the 
 header, or even why it does so ? Does anybody know if this is normal 
 for mail servers to do this ? Evidently other incoming mail servers do

 not react to the 'nob...@myserver.com' in any way, so maybe ATT is 
 unique in this.
 
 Any light anyone can throw on the 'nob...@myserver.com' address would 
 be most welcome.

It is using the apache user @ your host name as the default.  Try this:

ini_set('sendmail_from', 'whate...@wherever.com');

You can also add headers to display custom formatted From: with a nice
display name, like this:

$to = j...@user.com;
$subject = Automated Notification;
$body = Joe, you're using too much disk space!;
$headers = From: Automated Disk Notifications
no-re...@website.com\n\rReply-to: no-re...@website.com\n\r;

mail($to, $subject, $body, $headers);

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



RE: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread kyle.smith

 Phpster wrote:


 On Apr 21, 2009, at 20:32, Edward Diener el...@tropicsoft.com
wrote:

 I have a PHP script which uses the PHP 'mail' function. When the 
 script's 'to' address is an ATT address, such as my own as an ATT 
 ISP customer, the mail never gets to me. If the 'to' address is 
 anything other than an ATT address, the mail gets to the recipient.
 The PHP code for sending the mail is essentially:

$headers  = 'MIME-Version: 1.0' . \r\n;
$headers .= 'Content-type: text/html; charset=iso-8859-1' .
\r\n;
$headers .= 'From: Some From Name somefromname.com';
$to = 'mybellsouthaddress.net';
$subject = 'Some Subject';
$msg = 'Some Message';
if(mail($to,$subject,$msg.\r\n\r\n,$headers))
echo good;
else
echo bad;

 In the actual PHP script the $to, $subject, and $msg are 
 successfully passed to the script from the client side as $_POST, 
 $_POST and $_FILES parameters respectively. I have just filled them 
 in above so that they can be seen as if they were part of the 
 script. The script always returns good, so the mail function must
be successful.

 In my project, testing has reported that any attempt to use the 
 'mail' function on the server to send to an ATT address fails to 
 reach the recipient, while all other addresses used in the testing 
 succeed in reaching the recipient. I can assert this to be the case 
 with my own ATT address also. I have also checked my ATT mailbox 
 online to make sure the mail is not being received as Spam.

 Does anybody have an idea why using the 'mail' function succeeds 
 with all but ATT $to addresses ? Naturally in the client-server 
 application on which I am working, sending mail from the server must

 work for all $to addresses.

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


 It might be that the server IP has been blacklisted with att as a 
 domain  from which spam is sent.
 
 I have found out that the server adds a from header of 
 'nob...@myserver.com' where 'myserver' is the name of the server. This

 header gets placed first before the From header I supply in my PHP 
 script ( which should have had the form in the example above of 
 'somefromn...@myserver.com, my bad ).
 
 Perhaps the ATT mail server, when it sees the 'nob...@myserver.com'
 treats it as spam and does not deliver the mail to even the 
 recipient's spam mailbox.
 
 I am not sure if it is normal for outgoing SMTP mail servers to 
 automatically add the 'nob...@myserver.com' from address first in the 
 header, or even why it does so ? Does anybody know if this is normal 
 for mail servers to do this ? Evidently other incoming mail servers do

 not react to the 'nob...@myserver.com' in any way, so maybe ATT is 
 unique in this.
 
 Any light anyone can throw on the 'nob...@myserver.com' address would 
 be most welcome.

It is using the apache user @ your host name as the default.  Try this:

ini_set('sendmail_from', 'whate...@wherever.com');

You can also add headers to display custom formatted From: with a nice
display name, like this:

$to = j...@user.com;
$subject = Automated Notification;
$body = Joe, you're using too much disk space!; $headers = From:
Automated Disk Notifications no-re...@website.com\n\rReply-to:
no-re...@website.com\n\r;

mail($to, $subject, $body, $headers);


EDIT:  Oops, didn't read OP.  Sorry!

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



Re: [PHP] Re: checkboxes

2009-04-22 Thread PJ
Ashley Sheridan wrote:
 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 --- p...@ptahhotep.com
 http://www.ptahhotep.com
 http://www.chiccantine.com/andypantry.php

 
 Just accept all the text inputs from the form,
You mean, submit? to the originating page? I'm trying to use $_POST, so
action=this_file.php?
Then manipulate the results and pass them to a query and then display on
page. Right?
  and use a switch on the
 radio button to determine which of the text inputs you use.
   
But how do you use the above - switch on the radio button ?
 Alternatively, just use one text box for input and use the value of the
 radio button to determine what to do with the text.
Don't understand this either.
I must really be stupid for I have been trying both methods and I just
don't know how to deal with this...

-- 
unheralded genius: A clean desk is the sign of a dull mind. 
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Re: checkboxes

2009-04-22 Thread Ashley Sheridan
On Wed, 2009-04-22 at 14:55 -0400, PJ wrote:
 Ashley Sheridan wrote:
  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 --- p...@ptahhotep.com
  http://www.ptahhotep.com
  http://www.chiccantine.com/andypantry.php
 
  
  Just accept all the text inputs from the form,
 You mean, submit? to the originating page? I'm trying to use $_POST, so
 action=this_file.php?
 Then manipulate the results and pass them to a query and then display on
 page. Right?
   and use a switch on the
  radio button to determine which of the text inputs you use.

 But how do you use the above - switch on the radio button ?
  Alternatively, just use one text box for input and use the value of the
  radio button to determine what to do with the text.
 Don't understand this either.
 I must really be stupid for I have been trying both methods and I just
 don't know how to deal with this...
 
 -- 
 unheralded genius: A clean desk is the sign of a dull mind. 
 -
 Phil Jourdan --- p...@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php
 
 
Say your search form has three radio buttons for the possible search
criteria; date, title and category, and in the form, next to each is a
textbox to accept the input for it. In the PHP code you would do
something like this:

$type = $_POST['type'];
switch($type)
{
  case 'date':
  {
// process date text box here
break;
  }
  case 'title':
  {
// process title text box here
break;
  }
  case 'category':
  {
// process category text box here
break;
  }
}

And you radio buttons would be like this:

input type=radio name=type value=date/
input type=radio name=type value=title/
input type=radio name=type value=category/



Ash
www.ashleysheridan.co.uk


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



Re: [PHP] checkboxes

2009-04-22 Thread Lists

PJ wrote:

How to deactivate checkboxes when one in a series is checked?
input type=checkbox name=choice[1]another input
input type=checkbox name=choice[2]another input1
input type=checkbox name=choice[3]another input2
input type=checkbox name=choice[4]another input3
So that only 1 of the other inputs could be used in a search. Probably
do the rest with switch stuff.
Would be neat if the deactivated checkboxes would go grey.
Is this an HTML question? Use onclick?But I think I need to either use a
php string or function or would this be a CSS thingy?
Thanks for any help.



I think you need to explain more precisely what you are doing.

However, an appropriate use of client-side processing vs.
server-side process is always a factor in a good web app.

You *could* disable stuff via choices that are made with
PHP, but it requires a submission of data. Javascript would
allow you to disable certain things without a submission.

First, I'd like to hear more clearly what end result you
are going for.

Donovan


--
  =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
  D. BROOKE   EUCA Design Center
   WebDNA Software Corp.
  WEB: http://www.euca.us  |   http://www.webdna.us
  =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
  WebDNA: [** Square Bracket Utopia **]


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



Re: [PHP] Suggestions of some good, simple file upload 'in progress' code?

2009-04-22 Thread scubak1w1

tedd tedd.sperl...@gmail.com wrote in message 
news:p0624080ac614d6bf9...@[192.168.1.101]...
 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?


Thanks Tedd,

I am thinking that is where I am at... as you said, the user just needs to 
know that there computer is busy, hang on a second already!  grin

I like those icons - if I may be so bold though, and excuse the broadness of 
the question, are you / can you use some Javascript to display this as the 
file uploads? I am already using AJAX on the page/form so I guess I could 
add an icon to the page before I run the PHO to upload the file, yes?

BUT I do appreciate all of the other suggestions, very muich - some weekend 
reading  experimenting I am thinking...   :-) 



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



Re: [PHP] checkboxes

2009-04-22 Thread PJ
Lists wrote:
 PJ wrote:
 How to deactivate checkboxes when one in a series is checked?
 input type=checkbox name=choice[1]another input
 input type=checkbox name=choice[2]another input1
 input type=checkbox name=choice[3]another input2
 input type=checkbox name=choice[4]another input3
 So that only 1 of the other inputs could be used in a search. Probably
 do the rest with switch stuff.
 Would be neat if the deactivated checkboxes would go grey.
 Is this an HTML question? Use onclick?But I think I need to either use a
 php string or function or would this be a CSS thingy?
 Thanks for any help.


 I think you need to explain more precisely what you are doing.

 However, an appropriate use of client-side processing vs.
 server-side process is always a factor in a good web app.

 You *could* disable stuff via choices that are made with
 PHP, but it requires a submission of data. Javascript would
 allow you to disable certain things without a submission.

 First, I'd like to hear more clearly what end result you
 are going for.
Well, I'm making a page to do limited searching of the database. To keep
it simple I just want to search by title, author,  ISBN or copyright
date. So, I need to input the user's choice, limit it to one of the
options and pass the supplied parameter to the query. I prefer to not
use Javascript. No need to disable stuff as that was merely a
misdirected thought. I think Ashley's suggestion should work. My problem
has been to understand the workings of the form inputs. Now, I'm just
anticipating some acrobatic feats to be able to pass the author
parameters to the query as they are comprised of two fields (first_name
and last_name). But, I think that that can be done, at worst, by doing a
different query just for the author.
TIA.
Phil

-- 
unheralded genius: A clean desk is the sign of a dull mind. 
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Re: Suggestions of some good, simple file upload 'in progress' code?

2009-04-22 Thread haliphax
On Wed, Apr 22, 2009 at 11:25 AM, Michael Shadle mike...@gmail.com wrote:
 On Wed, Apr 22, 2009 at 6:20 AM, haliphax halip...@gmail.com 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.

 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)

Unless you are in a corporate environment where you control what is
installed on your visitors' machines, then just about any server-side
hell you have to put yourself through is cleaner to the client than
them needing to install ANYTHING.

I'm sorry if my opinion seems a little too black and white, but
those are the breaks. I can definitely say that, coming from a higher
education institution standpoint, the site I work on would ALWAYS do
something server-side and exhaust all of those possibilities before
forcing prospective students, applicants, etc. to download additional
software for their web browser.

It depends on the clientele, really.


-- 
// Todd

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



Re: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread Edward Diener

Shawn McKenzie wrote:

Edward Diener wrote:

Phpster wrote:


On Apr 21, 2009, at 20:32, Edward Diener el...@tropicsoft.com wrote:


I have a PHP script which uses the PHP 'mail' function. When the
script's 'to' address is an ATT address, such as my own as an ATT
ISP customer, the mail never gets to me. If the 'to' address is
anything other than an ATT address, the mail gets to the recipient.
The PHP code for sending the mail is essentially:

   $headers  = 'MIME-Version: 1.0' . \r\n;
   $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n;
   $headers .= 'From: Some From Name somefromname.com';
   $to = 'mybellsouthaddress.net';
   $subject = 'Some Subject';
   $msg = 'Some Message';
   if(mail($to,$subject,$msg.\r\n\r\n,$headers))
   echo good;
   else
   echo bad;

In the actual PHP script the $to, $subject, and $msg are successfully
passed to the script from the client side as $_POST, $_POST and
$_FILES parameters respectively. I have just filled them in above so
that they can be seen as if they were part of the script. The script
always returns good, so the mail function must be successful.

In my project, testing has reported that any attempt to use the
'mail' function on the server to send to an ATT address fails to
reach the recipient, while all other addresses used in the testing
succeed in reaching the recipient. I can assert this to be the case
with my own ATT address also. I have also checked my ATT mailbox
online to make sure the mail is not being received as Spam.

Does anybody have an idea why using the 'mail' function succeeds with
all but ATT $to addresses ? Naturally in the client-server
application on which I am working, sending mail from the server must
work for all $to addresses.

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


It might be that the server IP has been blacklisted with att as a
domain  from which spam is sent.

I have found out that the server adds a from header of
'nob...@myserver.com' where 'myserver' is the name of the server. This
header gets placed first before the From header I supply in my PHP
script ( which should have had the form in the example above of
'somefromn...@myserver.com, my bad ).

Perhaps the ATT mail server, when it sees the 'nob...@myserver.com'
treats it as spam and does not deliver the mail to even the recipient's
spam mailbox.

I am not sure if it is normal for outgoing SMTP mail servers to
automatically add the 'nob...@myserver.com' from address first in the
header, or even why it does so ? Does anybody know if this is normal for
mail servers to do this ? Evidently other incoming mail servers do not
react to the 'nob...@myserver.com' in any way, so maybe ATT is unique
in this.

Any light anyone can throw on the 'nob...@myserver.com' address would be
most welcome.


It is using the apache user @ your host name as the default.  Try this:

ini_set('sendmail_from', 'whate...@wherever.com');


I will try this but I do not understand why it should work. I have a 
'From:...' entry in my headers. Why is this not being used as the 
primary from address and why is 'nob...@myserver.com' being added 
instead as the first from address ? In other words, I can understand if 
I supply no 'From:...' header entry that a default 'nob...@myserver.com' 
would be used but I do not understand why it is used even when I supply 
a 'From:...' header entry.


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



[PHP] @$_POST[...]

2009-04-22 Thread PJ
Could somebody explain to me the meaning of @ in $var = @$_POST['title'] ;
where could I find a cheat sheet for those kinds of symbols or what are
they called?
Sorry for my ignorance, but maybe this will take the fog filter our of
my neurons. :-\

-- 
unheralded genius: A clean desk is the sign of a dull mind. 
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] @$_POST[...]

2009-04-22 Thread Luke
2009/4/22 PJ af.gour...@videotron.ca

 Could somebody explain to me the meaning of @ in $var = @$_POST['title'] ;
 where could I find a cheat sheet for those kinds of symbols or what are
 they called?
 Sorry for my ignorance, but maybe this will take the fog filter our of
 my neurons. :-\

 --
 unheralded genius: A clean desk is the sign of a dull mind. 
 -
 Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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


I believe placing an @ in front of a statement suppresses any error messages
it generates.

-- 
Luke Slater
:O)


Re: [PHP] @$_POST[...]

2009-04-22 Thread 9el
Rather than looking for cheatsheets you should read the ZCE
preparation guide book and PHP manual.

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



[PHP] ! and !=

2009-04-22 Thread George Langley
Hi all. Maybe I'm just getting confused by all the languages I'm trying 
to work with! But, isn't:

if(!$var1 == $var2){

the same thing as

if($var1 != $var2){

#1 doesn't work, #2 does.
Thanks!


George Langley    Multimedia Developer    Audio/Video Editor    Musician, 
Arranger, Composer www.georgelangley.ca

Too many choices, too little sleep.


Re: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread Chris



Any light anyone can throw on the 'nob...@myserver.com' address would be
most welcome.


It is using the apache user @ your host name as the default.  Try this:

ini_set('sendmail_from', 'whate...@wherever.com');


I will try this but I do not understand why it should work. I have a 
'From:...' entry in my headers. Why is this not being used as the 
primary from address and why is 'nob...@myserver.com' being added 
instead as the first from address ? In other words, I can understand if 
I supply no 'From:...' header entry that a default 'nob...@myserver.com' 
would be used but I do not understand why it is used even when I supply 
a 'From:...' header entry.




From:  is used by your mail client to show who it's from.

the ini_set (or you can set the 5th param to the mail() function) is a 
return-path. If the message bounces (recipient's mailbox full, server 
down, whatever the reason) it gets delivered to that address. They serve 
different purposes.


--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] ! and !=

2009-04-22 Thread 9el
On Thu, Apr 23, 2009 at 4:30 AM, George Langley george.lang...@shaw.ca wrote:
        Hi all. Maybe I'm just getting confused by all the languages I'm 
 trying to work with! But, isn't:

 if(!$var1 == $var2){

Means  if (NOT($var1) == $var2)

 the same thing as

 if($var1 != $var2){

means $var1 NOTEQUALS $var2


        #1 doesn't work, #2 does.
:)

Lenin

www.twitter.com/nine_L

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



Re: [PHP] Re: Suggestions of some good, simple file upload 'in progress' code?

2009-04-22 Thread Michael Shadle
On Wed, Apr 22, 2009 at 2:41 PM, haliphax halip...@gmail.com wrote:
 On Wed, Apr 22, 2009 at 11:25 AM, Michael Shadle mike...@gmail.com wrote:
 On Wed, Apr 22, 2009 at 6:20 AM, haliphax halip...@gmail.com 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.

 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)

 Unless you are in a corporate environment where you control what is
 installed on your visitors' machines, then just about any server-side
 hell you have to put yourself through is cleaner to the client than
 them needing to install ANYTHING.

 I'm sorry if my opinion seems a little too black and white, but
 those are the breaks. I can definitely say that, coming from a higher
 education institution standpoint, the site I work on would ALWAYS do
 something server-side and exhaust all of those possibilities before
 forcing prospective students, applicants, etc. to download additional
 software for their web browser.

 It depends on the clientele, really.

It also depends on the servers.

If you're behind load balanced webservers, the APC solution is out.
If you're on a shared hosting solution, it most likely is out (due to
some config tweaking)
You're limited to the POST size limits and other file upload
limitations inside of php.ini on the server

etc.

If your clientele find it useful enough, they will download it. People
are stupid enough to click on viruses, why would they not click on
something that comes from a reputable source as well, and promises
them large file uploads, looks like it is part of the website (and not
some hokey looking UI from an applet) and is SSL-friendly,
proxy-friendly, etc, etc...

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



Re: [PHP] ! and !=

2009-04-22 Thread Chris

George Langley wrote:

Hi all. Maybe I'm just getting confused by all the languages I'm trying 
to work with! But, isn't:

if(!$var1 == $var2){

the same thing as

if($var1 != $var2){

#1 doesn't work, #2 does.
Thanks!


No.

The second is seeing if $var1 is not equal to $var2.

The first one is doing a not $var1 is equal to $var2 - which will 
change it from whatever it is into false. (It's currently set - so 
that's true, you're switching that - so it becomes false).


$ cat test.php
?php

$a = 5;
var_dump($a);
$b = !$a;
var_dump($b);


$ php test.php
int(5)
bool(false)


So the not $var1 becomes false.

--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread Edward Diener

Chris wrote:


Any light anyone can throw on the 'nob...@myserver.com' address 
would be

most welcome.


It is using the apache user @ your host name as the default.  Try this:

ini_set('sendmail_from', 'whate...@wherever.com');


I will try this but I do not understand why it should work. I have a 
'From:...' entry in my headers. Why is this not being used as the 
primary from address and why is 'nob...@myserver.com' being added 
instead as the first from address ? In other words, I can understand 
if I supply no 'From:...' header entry that a default 
'nob...@myserver.com' would be used but I do not understand why it is 
used even when I supply a 'From:...' header entry.




From:  is used by your mail client to show who it's from.

the ini_set (or you can set the 5th param to the mail() function) is a 
return-path. If the message bounces (recipient's mailbox full, server 
down, whatever the reason) it gets delivered to that address. They serve 
different purposes.


Does ini_set actually change the php.ini file in any way ? The reason I 
ask is that after putting in:


ini_set('sendmail_from', 'myem...@myserver.com');

into a new script which I tested out against, the 'mail' function now 
continues to work but no e-mail is received no matter what the recipient 
e-mail is. Even is I go back to using my old script which does not have 
the 'ini_set' in it, no e-mail actually gets receoved even though 'mail' 
succeeds when called. So I have gone from bad to worse and the ini_set 
seems to have affected all calls to 'mail' in this way for PHP scripts 
on the server.


Can I correct but somehow stopping PHP ( or may Apache ) and restarting 
it again to bring back the original php.ini setting ?


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



Re: [PHP] ! and !=

2009-04-22 Thread Tom Rogers
Hi,

Thursday, April 23, 2009, 8:30:34 AM, you wrote:
GL Hi all. Maybe I'm just getting confused by all the
GL languages I'm trying to work with! But, isn't:

GL if(!$var1 == $var2){

GL the same thing as

GL if($var1 != $var2){

GL #1 doesn't work, #2 does.
GL Thanks!


GL George Langley    Multimedia Developer    Audio/Video Editor   
GL Musician, Arranger, Composer www.georgelangley.ca

GL Too many choices, too little sleep.

Use brackets to make them the same:

if(!($var1 == $var2)) {

-- 
regards,
Tom


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



Re: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread Chris

Edward Diener wrote:

Chris wrote:


Any light anyone can throw on the 'nob...@myserver.com' address 
would be

most welcome.


It is using the apache user @ your host name as the default.  Try this:

ini_set('sendmail_from', 'whate...@wherever.com');


I will try this but I do not understand why it should work. I have a 
'From:...' entry in my headers. Why is this not being used as the 
primary from address and why is 'nob...@myserver.com' being added 
instead as the first from address ? In other words, I can understand 
if I supply no 'From:...' header entry that a default 
'nob...@myserver.com' would be used but I do not understand why it is 
used even when I supply a 'From:...' header entry.




From:  is used by your mail client to show who it's from.

the ini_set (or you can set the 5th param to the mail() function) is a 
return-path. If the message bounces (recipient's mailbox full, server 
down, whatever the reason) it gets delivered to that address. They 
serve different purposes.


Does ini_set actually change the php.ini file in any way ?


No, it only affects the script it's running in. Comment it out.

Check your mail server logs and/or apache/php logs to see if anything is 
going there.


--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread 9el
 Does ini_set actually change the php.ini file in any way ? The reason I ask
 is that after putting in:

Yes it does. :)you should have refered to the manual before using the line.

Did you write your  own myem...@myserver.com? or you kept that exactly
like in code?


 ini_set('sendmail_from', 'myem...@myserver.com');

 into a new script which I tested out against, the 'mail' function now
 continues to work but no e-mail is received no matter what the recipient
 e-mail is. Even is I go back to using my old script which does not have the
 'ini_set' in it, no e-mail actually gets receoved even though 'mail'
 succeeds when called. So I have gone from bad to worse and the ini_set seems
 to have affected all calls to 'mail' in this way for PHP scripts on the
 server.

 Can I correct but somehow stopping PHP ( or may Apache ) and restarting it
 again to bring back the original php.ini setting ?

For now you can go back to set the php.ini to default with the
ini_set function.

You can use ini_get to retrieve data from the php.ini configs

a phpinfo() will show you all the current settings.

Regards

Lenin

www.twitter.com/nine_L

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



Re: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread Chris

9el wrote:

Does ini_set actually change the php.ini file in any way ? The reason I ask
is that after putting in:


Yes it does. :)you should have refered to the manual before using the line.


It does not.

It changes a setting for the script only. It does not change the 
physical php.ini file.


--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] @$_POST[...]

2009-04-22 Thread PJ
9el wrote:
 Rather than looking for cheatsheets you should read the ZCE
 preparation guide book and PHP manual.

   
That's a lame duck response. I'm not stupid enough to not search and try
to find answers on G and in the manuals  tutorials. They are not always
obvious so I often rely on the great guys on this list to clear things
up. And I have no ide what ZCE is nor do I really care.

-- 
unheralded genius: A clean desk is the sign of a dull mind. 
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] @$_POST[...]

2009-04-22 Thread Chris

Luke wrote:

2009/4/22 PJ af.gour...@videotron.ca


Could somebody explain to me the meaning of @ in $var = @$_POST['title'] ;
where could I find a cheat sheet for those kinds of symbols or what are
they called?
Sorry for my ignorance, but maybe this will take the fog filter our of
my neurons. :-\

I believe placing an @ in front of a statement suppresses any error messages
it generates.



It does - in this case if 'title' is not posted as part of the form, it 
would have generated a warning or notice (can't remember which).


A longer path is:

$var = '';
if (isset($_POST['title'])) {
  $var = $_POST['title'];
}

The shortcut works but it makes it extremely difficult to find problems 
with your scripts (think of 50 @'s being used in one script.. eek).


--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] Suggestions of some good, simple file upload 'in progress' code?

2009-04-22 Thread scubak1w1

scubak1w1 sk...@spamcop.net wrote in message 
news:44.c6.33545.6747f...@pb1.pair.com...

 tedd tedd.sperl...@gmail.com wrote in message 
 news:p0624080ac614d6bf9...@[192.168.1.101]...
 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.


[snip]

How dumb am I?

As you  stated, 'we' just wanted the user to know the computer is up to 
something...

So I just changed the cursor icon with some JS:

 document.body.style.cursor = 'wait';

and then when the file had uploaded

 document.body.style.cursor = 'auto';

rolls eyes at self 



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



Re: [PHP] @$_POST[...]

2009-04-22 Thread 9el
On Thu, Apr 23, 2009 at 5:26 AM, PJ af.gour...@videotron.ca wrote:
 9el wrote:
 Rather than looking for cheatsheets you should read the ZCE
 preparation guide book and PHP manual.


 That's a lame duck response. I'm not stupid enough to not search and try
 to find answers on G and in the manuals  tutorials. They are not always
 obvious so I often rely on the great guys on this list to clear things
 up. And I have no ide what ZCE is nor do I really care.

I'd call you a lame duck just for now.
Cause, you could have asked Google what ZCE is. And if you should like
programming in PHP you should care about the ZCE as well.

ZCE means Zend Certified Engineer. And I refered to that book because
that book helped me preparing for that exam. Which covers really
important best practices PHP Developers should be aware of. I am not
giving you more info as you said you can use Google.

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



Re: [PHP] ! and !=

2009-04-22 Thread George Langley
Doh, of course! Just not thinking about the scope of the operator. If 
$var1 = 1, then !$var1 = 0
Thanks everyone!

George

- Original Message -
From: Tom Rogers trog...@kwikin.com
Date: Wednesday, April 22, 2009 17:01
Subject: Re: [PHP] ! and !=
To: George Langley george.lang...@shaw.ca
Cc: php-general@lists.php.net

 Hi,
 
 Thursday, April 23, 2009, 8:30:34 AM, you wrote:
 GL Hi 
 all. Maybe I'm just getting confused by all the
 GL languages I'm trying to work with! But, isn't:
 
 GL if(!$var1 == $var2){
 
 GL the same thing as
 
 GL if($var1 != $var2){
 
 GL #1 doesn't 
 work, #2 does.
 GL Thanks!
 
 
 GL George Langley    Multimedia Developer    Audio/Video Editor   
 GL Musician, Arranger, Composer www.georgelangley.ca
 
 GL Too many choices, too little sleep.
 
 Use brackets to make them the same:
 
 if(!($var1 == $var2)) {
 
 -- 
 regards,
 Tom
 
 

George Langley    Multimedia Developer    Audio/Video Editor    Musician, 
Arranger, Composer www.georgelangley.ca




[PHP] Re: Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread Al



Edward Diener wrote:
I have a PHP script which uses the PHP 'mail' function. When the 
script's 'to' address is an ATT address, such as my own as an ATT ISP 
customer, the mail never gets to me. If the 'to' address is anything 
other than an ATT address, the mail gets to the recipient. The PHP code 
for sending the mail is essentially:


$headers  = 'MIME-Version: 1.0' . \r\n;
$headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n;
$headers .= 'From: Some From Name somefromname.com';
$to = 'mybellsouthaddress.net';
$subject = 'Some Subject';
$msg = 'Some Message';
if(mail($to,$subject,$msg.\r\n\r\n,$headers))
echo good;
else
echo bad;

In the actual PHP script the $to, $subject, and $msg are successfully 
passed to the script from the client side as $_POST, $_POST and $_FILES 
parameters respectively. I have just filled them in above so that they 
can be seen as if they were part of the script. The script always 
returns good, so the mail function must be successful.


In my project, testing has reported that any attempt to use the 'mail' 
function on the server to send to an ATT address fails to reach the 
recipient, while all other addresses used in the testing succeed in 
reaching the recipient. I can assert this to be the case with my own 
ATT address also. I have also checked my ATT mailbox online to make 
sure the mail is not being received as Spam.


Does anybody have an idea why using the 'mail' function succeeds with 
all but ATT $to addresses ? Naturally in the client-server application 
on which I am working, sending mail from the server must work for all 
$to addresses.


Try using SMTP as your mail server. Increasingly, incoming mail servers are requiring secure email. 
This means logging into your outgoing server.  Also, I've starting using Domain Keys and SPF on all 
my emails, including text to cellphones.


Here is my code function, it works with ATT just fine. Note the use of Pear 
mail

function pearEmailSend($recipient, $emailSubj, $emailText, $applicEmailAddr)
{
$emailTo = $recipient;
$headers['From'] = $applicEmailAddr;
$headers['To'] = $emailTo;
if(!empty($emailCC)) $headers['Cc'] = $emailCC;
$headers['Return-Path'] = $applicEmailAddr; //or can use SMTP_USER; bounces are sent to applic 
address

$headers['Reply-To'] = $applicEmailAddr;
$headers['X-miniReg'] = APPLIC_NAME;
$headers['Date'] = date('r');
$headers['Subject'] = $emailSubj;
$params['debug'] = SMTP_DEBUG; //Careful, do not leave on, creates a nasty 
message for admins
$params['host'] = $_SERVER['SERVER_NAME'];
$params['auth'] = SMTP_AUTH; //binary, set in config; some servers require 
auth
$params[username] = SMTP_USER; //If auth true, must have value
$params[password] = SMTP_PW; //If auth true, must have value
$params[localhost] = $_SERVER['SERVER_NAME'];
$params['persist'] = true; //Default true
$mail_object = Mail::factory('smtp', $params);
if(!ENABLE_SEND)
{
echo(br /pearEmailSend; sending is inhibited. This is the stuff. br 
/Recipient=$recipientbr /Text=$emailText);

echo printArray($headers) . 'br /';
return;
}
$result = $mail_object-send($recipient, $headers, $emailText);
if (PEAR::isError($result))
{
throw new Exception(The email SMTP login does not work, check the config settings. br 
/Tech support required. Error found in pearEmailSend() . $result-getMessage());

}
return true;
}





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



Re: [PHP] Unable to send mail from PHP to ATT e-mail address

2009-04-22 Thread Edward Diener

Chris wrote:

Edward Diener wrote:

Chris wrote:


Any light anyone can throw on the 'nob...@myserver.com' address 
would be

most welcome.


It is using the apache user @ your host name as the default.  Try 
this:


ini_set('sendmail_from', 'whate...@wherever.com');


I will try this but I do not understand why it should work. I have a 
'From:...' entry in my headers. Why is this not being used as the 
primary from address and why is 'nob...@myserver.com' being added 
instead as the first from address ? In other words, I can understand 
if I supply no 'From:...' header entry that a default 
'nob...@myserver.com' would be used but I do not understand why it 
is used even when I supply a 'From:...' header entry.




From:  is used by your mail client to show who it's from.

the ini_set (or you can set the 5th param to the mail() function) is 
a return-path. If the message bounces (recipient's mailbox full, 
server down, whatever the reason) it gets delivered to that address. 
They serve different purposes.


Does ini_set actually change the php.ini file in any way ?


No, it only affects the script it's running in. Comment it out.

Check your mail server logs and/or apache/php logs to see if anything is 
going there.


You are correct. The mail server logs showed that a number of outgoing 
e-mails had been blocked because of an error. Once the outgoing e-mails 
were released I received my e-mail.


It also turns out that the nob...@myserver.com was added to the header 
as the Reply-To address, not as a primary From address. I should have 
looked at this myself rather than taken the comment of someone else.


I am still trying to investigate why ATT e-mails are not being received 
but it may have to do with the outgoing mail server and is being 
investigated by my employer. I will wait on any further script changes 
until he tells me what is happening with the outgoing mail server.


Thanks very much for your help.

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



Re: [PHP] Suggestions of some good, simple file upload 'in progress' code?

2009-04-22 Thread Manuel Lemos
Hello,

on 04/22/2009 04:46 PM scubak1w1 said the following:
 I am thinking that is where I am at... as you said, the user just needs to 
 know that there computer is busy, hang on a second already!  grin
 
 I like those icons - if I may be so bold though, and excuse the broadness of 
 the question, are you / can you use some Javascript to display this as the 
 file uploads? I am already using AJAX on the page/form so I guess I could 
 add an icon to the page before I run the PHO to upload the file, yes?

You may want to take a look at this forms class that comes with an
upload progress plug-in.

http://www.phpclasses.org/formsgeneration


That plug-in sends an AJAX/COMET request when the form upload starts and
the files are long enough, it shows a progress bar with some statistics
like upload speed, transferred data, remaining time, etc.. Here you can
see it working live:

http://www.meta-language.net/forms-examples.html?example=test_upload_progress

You may also want to watch this tutorial video:

http://www.phpclasses.org/browse/video/1/package/1/section/plugin-upload-meter.html


-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

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

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