$options_array['sortfield'] = $sortfield; $options_array['sortorder'] = $sortorder; setcookie('todo', object_to_cookie($options_array), time() + 60 * 60 * 24 * 365); // Der Benutzer soll ermittelt werden if (!($user = new user())) { // Undefined users cannot use this programm header('HTTP/1.0 500 Internal Server Error'); ob_flush(); } if (isset($_POST['username']) && isset($_POST['password'])) { $autologin = isset($_POST['autologin']) ? true : false; $login = array($_POST['username'], md5($_POST['password']), $autologin); } elseif (!empty($_COOKIE['pep'])) { $login = cookie_to_object($_COOKIE['pep']); } elseif (!empty($_SESSION['pep'])) { $login = cookie_to_object($_SESSION['pep']); } else { $login = array('', '', true); } // Beim Ausloggen wird alles leer gemacht if (!empty($_POST['action']) && $_POST['action'] == 'logout') { if (isset($_COOKIE['pep'])) { setcookie('pep'); unset($_COOKIE['pep']); } unset($_SESSION['pep']); $login = array('', '', true); } // Das Login ist entscheidet für weitere Aktionen if (!$user->login($login)) { $_SESSION['action'] = 'login';
/** * Private function for record adding * * @return Boolean */ function _addRecord() { $values[] = "({$this->cfg_usr_id}, 'starthour', '{$this->starthour}')"; $values[] = "({$this->cfg_usr_id}, 'startmin', '{$this->startmin}')"; $values[] = "({$this->cfg_usr_id}, 'durhour', '{$this->durhour}')"; $values[] = "({$this->cfg_usr_id}, 'durmin', '{$this->durmin}')"; $values[] = "({$this->cfg_usr_id}, 'finishhour', '{$this->finishhour}')"; $values[] = "({$this->cfg_usr_id}, 'finishmin', '{$this->finishmin}')"; $values[] = "({$this->cfg_usr_id}, 'minstep', '{$this->minstep}')"; $values[] = "({$this->cfg_usr_id}, 'language', '{$this->language}')"; $this->query(sprintf('DELETE FROM ' . DBPREFIX . 'usrcfg WHERE cfg_usr_id = %d', (int) $this->cfg_usr_id)); $val = ''; foreach ($values as $value) { if (!empty($val)) { $val .= ','; } $val .= $value; } if (!$this->query('INSERT INTO ' . DBPREFIX . 'usrcfg VALUES ' . $val)) { return false; } else { if (empty($this->employeepassword)) { return true; } if (!$this->query(sprintf('UPDATE ' . DBPREFIX . "employees\n SET empl_pwd = '%s'\n WHERE empl_id = %d", md5($this->employeepassword), (int) $this->cfg_usr_id))) { return false; } else { if (!empty($_COOKIE['pep'])) { $login = cookie_to_object($_COOKIE['pep']); } elseif (!empty($_SESSION['pep'])) { $login = cookie_to_object($_SESSION['pep']); } else { $login = array('', '', false); } $new_login = array($login[0], md5($this->employeepassword), $login[2]); set_pep($new_login); return true; } } }