Hi, all,

I am new to Squirrel mail and not sure if this is the right place to ask questions. In a research project, I need for some reason to modify the sm code. Specifically, I need to modify the right_main.php, so that each time when I click "inbox" it will not call sqimap_login() again if we already have one imap session remaining. I do not logout from imap explicitly.   Only the first time we need to create a imap connection. My problem is, with the below code(the output followed), I cannot get back the imapConnection when I click inbox or simply refresh the page. 

Any suggestions? Thanks very much.

/* Open a connection on the imap port (143) */
global $imapConnection;
echo "Before: "; var_dump("$imapConnection");echo "<br />";
//echo "Before: $imapConnection <br />";

if(empty($imapConnection)) {
     $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
     sqgetGlobalVar('imap',$imap,SQ_SESSION);//check if I've put imap connection descriptor  to SESSION successfully.
echo "After:"; var_dump("$imapConnection");

 The output is : 

Before: string(1) "0" 
string(15) "Resource id #65" After:string(15) "Resource id #65"