php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12031 Problems running IMAP and MYSLQ
Submitted: 2001-07-10 23:44 UTC Modified: 2001-12-13 06:26 UTC
From: simon at klashma dot no-ip dot com Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0.6 OS: Linux RedHat 7.1
Private report: No CVE-ID: None
 [2001-07-10 23:44 UTC] simon at klashma dot no-ip dot com
<?
$usager = 'klashma'; // Username to log on the SQL server
$pwd = 'xx00xx'; // the password
$server = '{192.168.36.2:143}'; // the IMAP server string
$web_courriel = 'klashma.no-ip.com'; // the email for the IMAP logon (virtual host)
$sql_server_ip = '192.168.36.2'; // the IP of the SQL server.

function openSQL()
{
  global $sql_server_ip, $usager, $pwd;
  $sqllink = mysql_connect($sql_server_ip,$usager,$pwd);
  if (!$sqllink)
	{ 
	print 'Access denied';
	die();
	}
}

function nbTEL()
{
/* the table is only a one colums table (ID) with integers. */

	global $usager;
	$result = mysql_db_query ($usager,"select id from prop");
	$result = mysql_num_rows($result);
	return $result;
}

function openIMAP($folder='INBOX')
{
	global $usager,$pwd,$server,$web_courriel,$mbox;
	$mbox = imap_open ($server . $folder, $usager.'@'.$web_courriel, $pwd) || die("Snif...: ".imap_last_error());
}

function nbEmail()
{
	global $mbox;
	if (($num_msg = imap_num_msg($mbox)) == 0)
	{
		return(0);
	} else {
		return $num_msg;
	}
}


print 'Opening the IMAP first:<br>';
openIMAP('INBOX');
openSQL();

print nbTel() . '<br>';
print nbEmail() . '<br>';

mysql_close;
imap_close($mbox);

print 'Works great...<br>Now with SQL first:<br>';
openSQL();
openIMAP('INBOX');

print nbTel() . '<br>';
print nbEmail() . '<br>';

print 'Blah, pointer not found :(';
?>

-=-=-= http://klashma.no-ip.com/test.php =-=-=-=- for the script
-=-=-= http://klashma.no-ip.com/php.php =-=-=-=- a good old phpinfo();

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-20 19:17 UTC] mfischer@php.net
What is the exact problem here?

The url mentioned gives me:
Opening the IMAP first:

Warning: Couldn't open stream {192.168.36.2:143}INBOX in /www/htdocs/test.php on line 32
Snif...: Too many login failures

But this could be anything (including the error which it gives me back ;)

If still have a problem, please more detail.

Also, first try if this still happens with latest RC

http://www.php.net/~zeev/php-4.1.0RC3.tar.gz

Feedback.


 [2001-12-13 06:26 UTC] sander@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 06:01:29 2024 UTC