[PHP] Wrong parameter count for imap_open()

2008-01-02 Thread Adam Williams

I'm running PHP 5.2.4 and getting the error:

*Warning*: Wrong parameter count for imap_open() in 
*/var/www/sites/intra-test/contract/login.php* on line *9


*My code is:

$mbox =
imap_open(\{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\,
\.$_POST[username].\, \.$_POST[password].\);   // line 9

but when I echo it out, it looks fine:

echo \{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\,
\.$_POST[username].\, \.$_POST[password].\;

prints:

{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX, awilliam, 
xxx



any ideas?
*
*


Re: [PHP] Wrong parameter count for imap_open()

2008-01-02 Thread Daniel Brown
On Jan 2, 2008 10:00 AM, Adam Williams [EMAIL PROTECTED] wrote:
 I'm running PHP 5.2.4 and getting the error:

 *Warning*: Wrong parameter count for imap_open() in
 */var/www/sites/intra-test/contract/login.php* on line *9

 *My code is:

 $mbox =
 imap_open(\{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\,
 \.$_POST[username].\, \.$_POST[password].\);   // line 9
[snip!]

You just forgot to encapsulate your parameters properly.  You
escape the strings, but don't close the parameter, so PHP reads that
all as one parameter passed to imap_open().

Change it to one of the following:

$mbox = 
imap_open(\{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\,\.$_POST[username].\,\.$_POST[password].\);
  // line 9

 OR 

$mbox = 
imap_open('{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX',''.$_POST['username'].'','.$_POST['password'].'');

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] Wrong parameter count for imap_open()

2008-01-02 Thread Jim Lucas
Adam Williams wrote:
 I'm running PHP 5.2.4 and getting the error:
 
 *Warning*: Wrong parameter count for imap_open() in
 */var/www/sites/intra-test/contract/login.php* on line *9
 
 *My code is:
 
 $mbox =
 imap_open(\{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\,
 \.$_POST[username].\, \.$_POST[password].\);   // line 9

From the documentation, it looks to me like you are makings things much more 
complicated then they
need to be.

imap_open('{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX',
  $_POST[username],
  $_POST[password]);

From what the documentation shows, you do not need to have quotes around the 
username/password fields.

Enjoy.

 
 but when I echo it out, it looks fine:
 
 echo \{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\,
 \.$_POST[username].\, \.$_POST[password].\;
 
 prints:
 
 {mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX, awilliam,
 xxx
 
 
 any ideas?
 *
 *
 

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Wrong parameter count for imap_open()

2008-01-02 Thread Richard Lynch


On Wed, January 2, 2008 9:00 am, Adam Williams wrote:
 I'm running PHP 5.2.4 and getting the error:

 *Warning*: Wrong parameter count for imap_open() in
 */var/www/sites/intra-test/contract/login.php* on line *9

 *My code is:

 $mbox =
 imap_open(\{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\,
 \.$_POST[username].\, \.$_POST[password].\);   // line 9

This creates a single string which LOOKS like what you should have
typed in the first place.

 but when I echo it out, it looks fine:

 echo \{mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX\,
 \.$_POST[username].\, \.$_POST[password].\;

 prints:

 {mail.mdah.state.ms.us/imap/novalidate-cert:143}INBOX, awilliam,
 xxx

You need to END the quote for the Mailbox before you put in a comma to
separate the mailbox arg from the username arg.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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