Page 1 of 1

[php] Pass and login check while connectiing to mailserver

Posted: Tue Sep 01, 2009 9:32 am
by Wolfie
Hello


I am building application using mvc pattern. It is mailclient with bayes spam filltering and I have problem checking if the user properly connect to the mailserver.

Here is part of my controller :

Code: Select all

 
    class MailboxController extends MailboxView {
        
        
        function MailboxController (&$model,$postvars=null) {
            MailboxView::__construct($model);
            $this->header();
            //print_r($_POST);
            switch ($postvars) {
                case 'login':
                    $this->inbox();
                    break;
                default:
                    if ( empty ($postvars) ) {
                        $this->login();
                    } else {
                        $this->inbox();
                    }
                    break;
            }
            $this->footer();
        }
    }
?>
 
As u see there in default part of switch statement I am just checking if user send any variables using post from the login form, if there is some variables than the connection with server is made, but this was only to check if class which is responsible for inbox and server connection is working well. Now I want to make the loop to respond to correct and uncorrect login and password but I don't know how cause I cannot check the proper login and pass on the mailserver (my app is connecting to gmail). I cannot also put any constant password and login cause I want to connect also to other accounts on the gmail. Than after correct login in the switch statement the $this->inbox() view should appear other case again $this->login() view should appear.

I hope u understand my post, I did't use english for couples of months so please forgive me any mistakes....

Any ideas how to handle this issue ?