//pass
 if (!empty($tmp_pass1) && (strlen($tmp_pass1) < 6 || strlen($tmp_pass1) > 30)) {
     helper_result('my_update_user_result', 'result', 'error');
     helper_result('my_update_user', 'error', txt('pass_length'));
 } else {
     $new_usr = new phpos_users();
     $new_usr->set_id_user($user_id);
     $new_usr->get_user_by_id();
     $error = 0;
     if (!empty($tmp_pass1)) {
         // check old pass
         if (!empty($tmp_old_pass)) {
             // check pass
             $pass_now_hash = $new_usr->get_user_pass();
             //check new
             $new_usr->set_raw_pass($tmp_old_pass);
             $old_pass_hash = $new_usr->generate_password();
             if ($pass_now_hash == $old_pass_hash) {
                 $new_usr->set_raw_pass($tmp_pass1);
                 $new_pass = $new_usr->generate_password();
                 $new_usr->set_user_pass($new_pass);
             } else {
                 $error = 1;
                 helper_result('my_update_user_result', 'result', 'error');
                 helper_result('my_update_user', 'error', txt('pass_old_wrong'));
             }
         } else {
             $error = 1;
             helper_result('my_update_user_result', 'result', 'error');
             helper_result('my_update_user', 'error', txt('pass_old_need'));
         }
 public function installer_db_set_data()
 {
     $root_time = time();
     include PHPOS_DIR . 'config/security_key.php';
     if (empty($phpos_key) || empty($_SESSION['phpos_install_data']['root_password1'])) {
         return false;
     }
     if ($_SESSION['phpos_install_data']['root_password1'] != $_SESSION['phpos_install_data']['root_password2']) {
         // not match
     }
     global $sql;
     require PHPOS_DIR . 'install/db_schema.php';
     if (is_array($insert)) {
         foreach ($insert as $table => $record) {
             if (!$sql->insert_array($record, $table)) {
                 $_SESSION['mysql_error'] = $sql->get_error('parse');
                 $this->set_sql_error('db_update');
                 return false;
             }
         }
     }
     $usr = new phpos_users();
     $usr->set_id_user(1);
     $usr->get_user_by_id();
     $usr->set_created_at($root_time);
     $usr->set_user_email($_SESSION['phpos_install_data']['cfg_email']);
     $usr->set_raw_pass($_SESSION['phpos_install_data']['root_password1']);
     $root_pwd = $usr->generate_password();
     $usr->set_user_pass($root_pwd);
     if ($usr->update()) {
         //echo 'uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu'.$root_pwd;
         $this->set_ok('db_update');
         // home dir
         if ($usr->create_home_dir()) {
             $this->set_ok('home_dir_ok');
         } else {
             $this->set_warn('home_dir_warn');
         }
         $t = time();
         // Save config
         $cfg = new phpos_config('phpos_config');
         $cfg->update_global('lang', $_SESSION['phpos_install_data']['cfg_lang']);
         $cfg->update_global('wallpaper', $_SESSION['phpos_install_data']['cfg_wallpaper']);
         $cfg->update_global('site_title', $_SESSION['phpos_install_data']['cfg_title']);
         $cfg->update_global('root_email', $_SESSION['phpos_install_data']['cfg_email']);
         $cfg->update_global('version', PHPOS_VERSION);
         $cfg->update_global('versionnumber', PHPOS_VERSIONNUMBER);
         $cfg->update_global('build', PHPOS_BUILD);
         $cfg->update_global('install_time', $t);
         $cfg->update_global('update_time', $t);
         //$cfg->update_global('key_copy', $phpos_key);
         $cfg->set_id_user(1);
         $cfg->update_user('lang', $_SESSION['phpos_install_data']['cfg_lang']);
         $cfg->update_user('wallpaper', $_SESSION['phpos_install_data']['cfg_wallpaper']);
         $cfg->update_user('wallpaper_type', 'global');
         return true;
     } else {
         $_SESSION['mysql_error'] = $sql->get_error('parse');
         $this->set_sql_error('db_update');
     }
 }
Exemple #3
0
require_once PHPOS_DIR . 'classes/class.phpos_filters.php';
require_once PHPOS_DIR . 'classes/class.users.php';
require_once PHPOS_DIR . 'classes/class.phpos_config.php';
$config = new phpos_config();
$config->set_id_user();
require_once PHPOS_DIR . 'classes/class.api_wintask.php';
require_once PHPOS_DIR . 'classes/class.helpers.php';
require_once PHPOS_DIR . 'controllers/helpersController.php';
require_once PHPOS_DIR . 'classes/class.languages.php';
require_once PHPOS_DIR . 'controllers/languageController.php';
require_once PHPOS_DIR . 'classes/class.phpos_wallpapers.php';
$usr = new phpos_users();
if ($_POST['phpos_login_me']) {
    session_regenerate_id();
    $usr->set_user_login(strip_tags($_POST['phpos_login']));
    $usr->set_raw_pass(strip_tags($_POST['phpos_password']));
    if ($usr->login()) {
    } else {
        $error_message = txt('wrong_login') . '<br><b>' . txt('try_again') . '</b>';
    }
    /*
    if($_POST['phpos_login'] == 'demo' && $_POST['phpos_password'] == 'demo')
    {
    	$_SESSION['logged'] = 1;
    	header('Location: '.PHPOS_WEBROOT_URL.'phpos_desktop.php?logged=1&lang='.$_GET['lang']);
    } else {
    	$error_message = txt('wrong_login').'<br><b>'.txt('try_again').'</b>';	
    }		
    */
}
?>