Page 1 of 1

mail server secure

Posted: Sun Oct 27, 2002 1:19 am
by navid
hi ,
I have a problem with a mail server.
This mail server has top secure.
I will connect to this mail server with a username and password to my account.
At first time I connect to mail server successfully.
If I connect to my account again, the mail server will not allow.
But after 3 or 4 seconds the mail server allows me to connect to my account.
I connect to the mail server with imap_open().
this mail server is pop.hotpop.com.
for example address email is "username@hotpop.com".
if you will test it you can create a free account in http://www.hotpop.com

Posted: Sun Oct 27, 2002 1:31 am
by volka
I don not know much about imap, but in the old ages of pop3 ( ;) ) it was quite common to let keep the file lock (or lock-file) even when the user logged out and check the create time at the next login attempt.
This way numerous logins in a short interval could be prevented.
Why do you want to login so often?

Posted: Sun Oct 27, 2002 1:55 am
by Takuma
Use POPS! The data gets sent encrypted not in text format, which means it's more safer. And introduce Firewall.
If I connect to my account again, the mail server will not allow.
Why do you need to connect twice.

Re:Why do you ........?

Posted: Mon Oct 28, 2002 3:04 am
by navid
I use functions in my script.
E.g. I have a function to read only header.
Another function to read only number of emails.
And another function to read only body of email.
Etc.
They need to connect to mail server.
I use for each function an imap_open.
I know this work is wrong but …..
I try to use imap_open() function only for first time and to pass the result of imap_open() to another functions but it does fail.

Posted: Mon Oct 28, 2002 4:57 am
by volka
you can store the connection-id in $GLOABLS, all functions can access this array.

http://www.php.net/manual/en/reserved.v ... es.globals

test new way

Posted: Tue Nov 05, 2002 2:47 am
by navid
hi dear
in this script used global variable.
but i have problem yet.
there is source of progrom in the bottom of this page.
if you connect to mail box, this script show number of message in your mail box.
then if you do refresh your page for more time you will see a Warning.

i think my algorithm is fail. :!: :!: :!:
i need guide
bay


theWarning is:
Warning: Couldn't open stream {pop.hotpop.com:110/pop3} in /..../...../...????.php on line 5


the new script is :

<?php
require('functions.php');
if(!session_is_registered('loggedin'))
{
$pop=imap_open("{ your server:110/pop3}","user name ","your password");
}
//-----------------main part-------------------//
switch ($action)
{
###############################
// show a email //
###############################
case 'get_mail':
if(session_is_registered('loggedin'))
{$num=num();
if(isset($mail) and ($mail>0 and $mail<=$num))
{
/* get a message
.
.
.
.
*/
}
}
break;
###############################
// show all mail //
###############################
default:
$num=num();
switch ($num)
{
case -1:
/*--------//
.
.
.
show "you did fail"...........
.
.
.
//--------*/
break;
case 0:
session_register('loggedin');
$loggedin = 1;
$num_msg = 0;
/*--------//
.
.
.
show "you havent any emil in your inbox"...........
.
.
.
//--------*/
break;
default:
session_register('loggedin');
$loggedin = 1;
$num_msg=$num;
///-------------///
echo $num_msg;
///------------///
break;
}
break;
###############################
// end //
###############################
}
?>


and function source is:

<?php
function num()
{
if ($GLOBALS['pop'] == false)
return (-1);
else
{
if (($num_messages = @imap_num_msg($GLOBALS['pop'])) == 0)
{
return (0);
}
else
{
return($num_messages);
}
}
}

function inbox(........)
{
/*
.
.
.
*/
}

function get_mail(.......)
{
/*
.
.
.
*/
}


?>

again

Posted: Tue Nov 12, 2002 11:03 pm
by navid
hi all & volka & Takuma
i can not find a good way .
i test "$GLOBALS" and "session" for return result the "imap_open()".
but if imap_open() is successful this result is "1".
please help me :cry: