Example #1
0
         break;
     }
     if ($UserManager->Level < 1) {
         $json['error'] = 'lowlevel';
         break;
     }
     $newPass = isset($_POST['password']) ? $_POST['password'] : null;
     if (is_null($newPass)) {
         $json['error'] = 'form';
         break;
     }
     if (strlen($newPass) < PASS_MIN || strlen($newPass) > PASS_MAX) {
         $json['error'] = 'password';
         break;
     }
     if ($UserManager->changePass($newPass)) {
         $json['result'] = true;
     } else {
         $json['error'] = '';
     }
     break;
     // Просмотр загруженных точек
 // Просмотр загруженных точек
 case 'myuploads':
     if (!$UserManager->isLogged()) {
         $json['error'] = 'unauthorized';
         break;
     }
     if ($UserManager->Level < 1) {
         $json['error'] = 'lowlevel';
         break;
Example #2
0
// You can use and redistribute this file under the term of the GNU GPL v2.0
//
// $Id: index.php 551 2007-08-02 05:16:27Z gassla $
require "../inc/main.php";
must_login();
$User = new User();
if ($GLOBALS['_SERVER']['REQUEST_METHOD'] == "POST") {
    extract($_POST);
    if ($action == "changepass") {
        if ($new_pass1 != $new_pass2) {
            $_SESSION['message'] = _("The passwords don't match");
            $_SESSION['error'] = 1;
            header("Location: index.php");
            die;
        }
        $User->changePass($_SESSION['id_user'], $old_password, $new_pass1);
    } else {
        if ($action == "userprefs") {
            $Prefs = new stdClass();
            foreach ($_POST as $n => $v) {
                if (preg_match("/^pref_(.*)\$/", $n, $matches)) {
                    $prefname = $matches[1];
                    $Prefs->{$prefname} = $v;
                }
            }
            $data = base64_encode(serialize($Prefs));
            $User->setPrefs($Prefs);
            header("Location: index.php");
            die;
        }
    }