function do_processing()
 {
     $values = $this->exportValues();
     $pw_salt = sha1(rand());
     DBfunctions::getInstance()->doSingleCall("INSERT INTO t_persons(bogen_id, password_hash, password_salt) VALUES (?, SHA1(CONCAT(?, ?)), ?)", "ssss", $_SESSION['bogen_id'], $values['pw1'], $pw_salt, $pw_salt);
     $_SESSION['person_id'] = DBfunctions::getInstance()->last_insert_id();
     $this->resetToken();
 }
Exemplo n.º 2
0
 public function query_password()
 {
     $tmvc = tmvc::instance();
     $form = new QueryPasswordForm();
     if ($form->validate()) {
         $_SESSION['person_id'] = DBfunctions::getInstance()->querySingleValue("SELECT id FROM t_persons WHERE bogen_id=?", "s", $_SESSION['bogen_id']);
         header("Location: " . APP_BASE_URL . "fragen/seite/1");
     } else {
         $form->addReloadLock();
         $form->assignToSmarty($tmvc->smarty);
         $tmvc->smarty->assign('content', $tmvc->smarty->fetch('query_password.tpl'));
         $tmvc->smarty->display();
     }
 }
Exemplo n.º 3
0
 function do_processing()
 {
     $values = $this->exportValues();
     $_SESSION['bogen_id'] = $values['bogen_id'];
     $_SESSION['pages_filled'] = array();
     $_SESSION['properties'] = array();
     // testen, ob Benutzer schon mal Daten eingetragen hat oder nicht
     // falls nein, Umleiten zur Passwort-Setzen seite, falls ja, Umleiten
     // zur Passwort-Eingabe-Seite
     $dbf = DBfunctions::getInstance();
     $id = $dbf->querySingleValue("SELECT id FROM t_persons WHERE bogen_id=?", "s", $values['bogen_id']);
     $this->resetToken();
     if ($id > 0) {
         // Person existiert => umleiten zur Passwort-Seite
         header('Location: ' . APP_BASE_URL . "begin/query_password");
     } else {
         // Person existiert nicht => Passwort setzen lassen
         header('Location: ' . APP_BASE_URL . "begin/set_password");
     }
 }
Exemplo n.º 4
0
 public function abschliessen()
 {
     for ($i = 0; $i < count($this->questionCollection->questionPages); $i++) {
         if (!$_SESSION['pages_filled'][$i + 1]) {
             header("Location: " . APP_BASE_URL . "fragen/seite/" . ($i + 1));
         }
     }
     $tmvc = tmvc::instance();
     $form = new MyQuickForm('form_finish', 'post', APP_BASE_URL . 'fragen/abschliessen', '', '', true);
     if ($form->validate()) {
         DBfunctions::getInstance()->doSingleCall("DELETE FROM t_person_properties WHERE person_id=?", "i", $_SESSION['person_id']);
         foreach ($_SESSION['properties'] as $prop => $val) {
             DBfunctions::getInstance()->doSingleCall("INSERT INTO t_person_properties(person_id, property, value) VALUES (?, ?, ?)", "iss", $_SESSION['person_id'], $prop, $val);
         }
         DBfunctions::getInstance()->doSingleCall("UPDATE t_persons SET submitted_at=NOW() WHERE id=?", "i", $_SESSION['person_id']);
         $form->resetToken();
         header("Location: " . APP_BASE_URL . "ende");
     } else {
         $form->addReloadLock();
         $form->assignToSmarty($tmvc->smarty);
         $tmvc->smarty->assign('content', $this->questionCollection->buildOutput($tmvc->smarty));
         $tmvc->smarty->display();
     }
 }
Exemplo n.º 5
0
 /**
  * schließt letzte Verbindung und baut eine neue auf
  * nur im Notfall verwenden bei Massiven SYK Problemen wenn keine sync mehr  
  */
 public function reconnect()
 {
     self::$mysqli->close();
     $ini_inst = ini::getInstance();
     self::$mysqli = new mysqli($ini_inst->getURL(), $ini_inst->getUSER(), $ini_inst->getPASSWORD(), $ini_inst->getDatabasename());
     syso_Model::myecho($mysqli->error);
     return self::$mysqli;
 }
 function cbPasswordMustMatch($passwd)
 {
     $count = DBfunctions::getInstance()->querySingleValue("SELECT COUNT(*) FROM t_persons WHERE bogen_id=? AND SHA1(CONCAT(?, password_salt))=password_hash", "ss", $_SESSION['bogen_id'], $passwd);
     return $count > 0;
 }