Пример #1
0
 function SMSEntry()
 {
     // check for return from tester, in which case we need to switch back to normal mode to look in the correct actions table
     if (isset($_SESSION[SURVEY_EXECUTION_MODE]) && $_SESSION[SURVEY_EXECUTION_MODE] == SURVEY_EXECUTION_MODE_TEST) {
         $_SESSION[SURVEY_EXECUTION_MODE] = SURVEY_EXECUTION_MODE_NORMAL;
     }
     $logactions = new LogActions();
     $nosessionactions = $logactions->getNumberOfActionsBySession($this->phpid, USCIC_SMS);
     //echo 'ytytytyt';
     //echo ' [[[[' . $this->phpid;
     if ($nosessionactions == 0) {
         //no entry yet: ask for prim_key!
         $logactions->addAction('', '', "loginstart", USCIC_SMS);
         $login = new Login($this->phpid);
         return $login->getSMSLoginScreen();
     } else {
         //echo ']]]]]';
         $loggedin = $logactions->getLoggedInSMSSession($this->phpid);
         if ($loggedin["count"] == 0) {
             //no prim_key (=username in sms) assigned to this sessionid. Assign if given (and check for pwd etc??)!
             $username = loadvar('username');
             $_SESSION['username'] = $username;
             if ($username != '' && loadvar('password') != '') {
                 //check username!!
                 $login = new Login($this->phpid);
                 if ($login->checkSMSAccess()) {
                     $urid = $_SESSION['URID'];
                     $logactions->addAction('', $urid, "loggedin", USCIC_SMS);
                     $sms = new SMS($urid, $this->phpid);
                     return $sms->getPage();
                 } else {
                     // incorrect login..start new session
                     endSession();
                     session_start();
                     session_regenerate_id(true);
                     $logactions->addAction('', '', "loginempty", USCIC_SMS);
                     $login = new Login(session_id());
                     return $login->getSMSLoginScreen(Language::messageCheckUsernamePassword());
                 }
             } else {
                 $logactions->addAction('', '', "loginempty", USCIC_SMS);
                 $login = new Login($this->phpid);
                 return $login->getSMSLoginScreen(Language::messageEnterUsernamePassword());
             }
         } else {
             //continue with the sms! EXTRA CHECK!!!!
             $_SESSION['URID'] = $loggedin["urid"];
             if (isset($_SESSION['URID'])) {
                 $sms = new SMS($_SESSION['URID'], $this->phpid);
                 return $sms->getPage();
             } else {
                 //something went wrong.. no urid..start new session
                 //echo 'ohno';
                 endSession();
                 session_start();
                 session_regenerate_id(true);
                 $logactions->addAction('', '', "loginempty", USCIC_SMS);
                 $login = new Login(session_id());
                 return $login->getSMSLoginScreen(Language::messageCheckUsernamePassword());
             }
         }
     }
 }