public function init() { $data = $_REQUEST; if (isset($data[Profile::GET_CHANGE_PASSWORD_BUTTON])) { $user = Auth::getInstance()->getUser(); if (strlen(trim($data[Profile::GET_CHANGE_MAIL])) > 0) { if ($user->email != trim($data[Profile::GET_CHANGE_MAIL])) { if (User::validEmail(trim(strip_tags($data[Profile::GET_CHANGE_MAIL])))) { $user->email = trim(strip_tags($data[Profile::GET_CHANGE_MAIL])); $user->password = User::getHashPassword($user->password, strtolower($user->email)); } else { Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=2'); } } } if (strlen(trim($data[Profile::GET_CHANGE_PASSWORD])) > 0) { if (!User::passwordIsValid($data[Profile::GET_CHANGE_PASSWORD])) { Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=0'); } else { $user->password = User::getHashPassword(trim(strip_tags($data[Profile::GET_CHANGE_PASSWORD])), strtolower($user->email)); } } $user->save(); Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=1'); return true; } }
public function init() { $data = $_REQUEST; if (isset($data[Profile::GET_CHANGE_PASSWORD_BUTTON])) { if (strlen($data[Profile::GET_CHANGE_PASSWORD]) > 0) { if (!User::passwordIsValid($data[Profile::GET_CHANGE_PASSWORD])) { Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=0'); } else { $user = Auth::getInstance()->getUser(); $user->password = User::getHashPassword(trim(strip_tags($data[Profile::GET_CHANGE_PASSWORD])), $user->login); $user->save(); Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=1'); return true; } } if (strlen($data[Profile::GET_CHANGE_PHONE]) > 0) { if (!User::validatePhone(trim($data[Profile::GET_CHANGE_PHONE]))) { Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=2'); } else { $user = Auth::getInstance()->getUser(); $user->number = trim($data[Profile::GET_CHANGE_PHONE]); $user->save(); Flight::redirect($_SERVER['REDIRECT_URL'] . '?success=1'); return true; } } } }
<?php // FUNCTIONS BEGIN require_once dirname(__FILE__) . '/inc/includes.php'; /* TODO: penser a ajouter la gestion des utilisateurs et des fichiers sauvegarder via XML: http://php.net/manual/en/function.simplexml-load-string.php */ if (isset($_GET['logout'])) { Session::logout(); header('Location: index.php'); die; } else { if (isset($_POST['login']) && isset($_POST['password'])) { $user = User::getUser('./conf/', $_POST['login']); if ($user && $user->getPassword() != null && Session::login($_POST['login'], User::getHashPassword($_POST['password']), $user->getLogin(), $user->getPassword())) { if (Session::isLogged() && $_SESSION['username'] != null && !is_dir('./' . SAVED_PATH . '/' . $_SESSION['username'])) { mkdir('./' . SAVED_PATH . '/' . $_SESSION['username'], 0705); } header('Location: index.php'); die; } } } raintpl::$tpl_dir = './tpl/'; // template directory raintpl::$cache_dir = "./cache/"; // cache directory raintpl::$base_url = url(); // base URL of blog raintpl::configure('path_replace', false);
public function changeUser() { $data = $_REQUEST; $User = User::find_by_login($data['login']); if ($User instanceof User) { if (strlen($data['change_password']) > 0) { if (!User::passwordIsValid($data['change_password'])) { return 5; } $User->password = User::getHashPassword(trim(strip_tags($data['change_password'])), strtolower($User->login)); } if (isset($data['fio'])) { $User->fio = trim(strip_tags($data['fio'])); } if (isset($data['koncentrat'])) { $User->concetrator = trim(strip_tags($data['koncentrat'])); } if (isset($data['counter'])) { $User->counter = trim(strip_tags($data['counter'])); } if (isset($data['address'])) { $User->address = trim(strip_tags($data['address'])); } if (isset($data['passport'])) { $user->pasport = trim(strip_tags($data['passport'])); } if (isset($data['phone'])) { $User->number = trim(strip_tags($data['phone'])); } if (isset($data['chet_user'])) { $User->n_scet = trim(strip_tags($data['chet_user'])); } $User->save(); Flight::redirect('/admin/users/' . $this->id_tovar . '?success=2'); } else { return 4; } }
</div> </div> </div> </div> <?php if ($content != 'login.php' && $content != 'notWork.php') { ?> <script src="/assets/js/Chart.min.js"></script> <script src="/assets/js/templatemo_script.js"></script> <script src="/assets/lib/bootstrap-notify/notify.js"></script> <script type="text/javascript"> <?php if (Auth::getInstance()->isAuth()) { if (Auth::getInstance()->getUser()->password == User::getHashPassword('0000', Auth::getInstance()->getUser()->login)) { ?> $(document).ready(function() {$.notify("У вас используется старый пароль, мы настоятельно рекомендуем изменить его в профиле",{ autoHideDelay: 5000000, className: 'warn', clickToHide: false, html: "<div>☺☺</div>" } ); }); <?php } } ?> // Line chart