PHP Method User::edit, codiad Code Examples

This page contains top rated real world PHP examples of method User::edit from package codiad extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: CabinetController.php Project: dmitry-politov/e-shopper
0
 /**
  * Action для страницы "Редактирование данных пользователя"
  */
 public function actionEdit()
 {
     // Получаем идентификатор пользователя из сессии
     $userId = User::checkLogged();
     // Получаем ифнормацию о пользователе из БД
     $user = User::getUserById($userId);
     // Заполняем переменные для полей формы
     $name = $user['name'];
     $password = $user['password'];
     // Флаг результата
     $result = false;
     // Обработка формы
     if (isset($_POST['submit'])) {
         // Если форма отправлена
         // Получаем данные из формы редактирования
         $name = $_POST['name'];
         $password = $_POST['password'];
         // Флаг ошибок
         $errors = false;
         // Валидируем значения
         if (!User::checkName($name)) {
             $errors[] = 'Имя д.б. не короче 2-х символов';
         }
         if (!User::checkPassword($password)) {
             $errors[] = 'Пароль короче 6 символов';
         }
         if ($errors === false) {
             // Если ошибок нет, сохраняем изменения профиля
             $result = User::edit($userId, $name, $password);
         }
     }
     // Подключаем вид
     require_once ROOT . '/views/cabinet/edit.php';
     return true;
 }
Example #2
Show file File: CabinetController.php Project: scorpion1986/site
0
 public function actionEdit()
 {
     //primim identificatorul utilizatorului din sesiune
     $userId = User::checkLogged();
     //primim informatii despre utilizator din baza de date
     $user = User::getUserById($userId);
     $name = $user['name'];
     $password = $user['password'];
     $result = false;
     $errors = false;
     if (isset($_POST['submit'])) {
         $name = $_POST['name'];
         $password = $_POST['password'];
         if (!User::checkName($name)) {
             $errors[] = 'Numele nu trebue sa fie mai scurt de doua simboluri';
         }
         if (!User::checkPassword($password)) {
             $errors[] = 'parola nu trebue sa fie mai scurta de 6 simboluri';
         }
         if ($errors == false) {
             $result = User::edit($userId, $name, $password);
         }
     }
     require_once ROOT . '/views/cabinet/edit.php';
     return true;
 }
Example #3
Show file File: CabinetController.php Project: Constantinehub/first_project
0
 public function actionEdit()
 {
     //Получаем идентификатор пользователя из сессиив
     $userId = User::checkLogged();
     //Получаем инфомацию о пользователе из БД
     $user = User::getUserById($userId);
     $name = $user['name'];
     $password = $user['password'];
     $result = false;
     if (isset($_POST['submit'])) {
         $name = $_POST['name'];
         $password = $_POST['password'];
         $errors[] = false;
         if (!User::checkName($name)) {
             $errors[] = 'Имя должно состоять минимум из 2 символов';
         }
         if (!User::checkPassword($password)) {
             $errors[] = 'Пароль должен состоять минимум из 6 символов';
         }
         if ($errors == false) {
             $result = User::edit($userId, $name, $password);
         }
     }
     require_once ROOT . '/views/cabinet/edit.php';
     return true;
 }
Example #4
Show file File: CabinetController.php Project: php-user/shop.com
0
 public function actionEdit()
 {
     $categories = Category::getCategoryList();
     if (!$categories) {
         $categories = array();
     }
     $email = User::isLogged();
     $user = User::getUserByEmail($email);
     $name = $user['name'];
     $password = '';
     $result = '';
     if (isset($_POST['submit'])) {
         $name = FunctionLibrary::clearStr($_POST['name']);
         $password = FunctionLibrary::clearStr($_POST['password']);
         $errors = array();
         if (!User::checkName($name)) {
             $errors[] = 'Имя должно быть больше 1 символа.';
         }
         if (!User::checkPassword($password)) {
             $errors[] = 'Пароль должен быть больше 5 символов.';
         }
         if (empty($errors)) {
             $result = User::edit($user['id'], $name, $password);
         }
     }
     require_once ROOT . '/views/cabinet/edit.php';
     return true;
 }
Example #5
Show file File: userController.php Project: Jay-En/Angular-f3
0
 function update($f3)
 {
     $users = new User();
     $result = $users->edit($f3->get('PARAMS.id'));
     if ($users->error) {
         $this->httpResponse($users->error[code], $users->error);
     } else {
         $this->httpResponse("200", $result);
     }
 }
Example #6
Show file File: UserController.php Project: TomGB/f3-crud
0
 public function update()
 {
     $user = new User($this->db);
     if ($this->f3->exists('POST.update')) {
         $user->edit($this->f3->get('POST.id'));
         $this->f3->reroute('/success/User Updated');
     } else {
         $user->getById($this->f3->get('PARAMS.id'));
         $this->f3->set('user', $user);
         $this->f3->set('page_head', 'Update User');
         $this->f3->set('view', 'user/update.htm');
     }
 }
Example #7
Show file File: UsersController.php Project: jeezybrick/light
0
 public function actionEdit()
 {
     // echo 'User index';
     $uri = trim($_SERVER['REQUEST_URI'], '/');
     $userId = User::checkLogged()['id'];
     $user = User::getUserById($userId);
     $errors = false;
     $result = false;
     $last_name = '';
     $first_name = '';
     $login = '';
     $email = '';
     $date = '';
     $phone = '';
     if (isset($_POST['submit'])) {
         $last_name = $_POST['last_name'];
         $first_name = $_POST['first_name'];
         $password = $_POST['password'];
         $login = $_POST['login'];
         $email = $_POST['email'];
         $date = date("Y-m-d", strtotime($_POST['date']));
         $phone = $_POST['phone'];
         if (RegisterValidator::required(array($_POST))) {
             $errors[] = 'Все поля обязательны к запонению';
         }
         if (RegisterValidator::checkPassword($password)) {
             $errors[] = 'Пароль не должен быть короче 6 символов и длинее 16';
         }
         if (!RegisterValidator::checkEmail($email)) {
             $errors[] = 'Введите правильный email';
         }
         if (!strtotime($_POST['date'])) {
             $errors[] = 'Введите дату в правильном формате(год-месяц-день)';
         }
         if ($errors == false) {
             $password_new = password_hash($password, PASSWORD_DEFAULT);
             $result = User::edit($userId, $last_name, $first_name, $password_new, $login, $email, $date, $phone);
             $userId = User::checkUserData($login, $password);
             User::postLogin($userId);
         }
     }
     require_once ROOT . '/views/user/edit.php';
 }
Example #8
Show file File: CabinetController.php Project: bogwien/first.mystore.loc
0
 public function actionEdit()
 {
     $userId = User::checkLogged();
     $result = false;
     if (isset($_POST['submit'])) {
         $user = new User($_POST['name'], '', $_POST['password']);
         $errors = false;
         if (!$user->checkName()) {
             $errors[] = 'Имя не должно быть короче 2-х символов';
         }
         if (!$user->checkPassword()) {
             $errors[] = 'Пароль не должен быть короче 6-ти символов';
         }
         if ($errors == false) {
             $result = $user->edit($userId);
         }
     }
     require_once ROOT . '/views/cabinet/edit.php';
     return true;
 }
Example #9
Show file File: UserController.php Project: pouystat/fatfree-master
0
 public function update()
 {
     $user = new User($this->db);
     /*
      * check if POST request has create field
      * if yes, add user and return home
      */
     if ($this->f3->exists('POST.update')) {
         $user->edit($this->f3->get('POST.id'));
         $this->f3->reroute('/');
     } else {
         $user->getById($this->f3->get('PARAMS.id'));
         $this->f3->set('user', $user);
         $this->f3->set('page_head', 'Update User');
         $this->f3->set('view', 'user/update.html');
     }
     /*
      * testing
      */
 }
Example #10
Show file File: UserController.php Project: srccn/hy
0
 public function update()
 {
     $user = new User($this->db);
     if ($this->f3->exists('POST.updateUser')) {
         // turn empty enter into null for submi_date
         if (trim($this->f3->get('POST.submit_date')) == '') {
             $this->f3->set('POST.submit_date', null);
         }
         $name = $this->f3->get('POST.username');
         $this->f3->set('POST.name', $name);
         $user->edit($this->f3->get('POST.id'));
         $this->f3->reroute('/useradmin');
     } else {
         $user->getById($this->f3->get('PARAMS.id'));
         $this->f3->set('user', $user);
         $this->f3->set('showMenu', false);
         $this->f3->set('view', "/user/update.html");
         echo Template::instance()->render('layout.htm');
     }
 }
Example #11
Show file File: CabinetController.php Project: Evkazolinium/Eshop_for_example
0
 public function actionEdit()
 {
     $userId = User::validateLogged();
     $user = User::getUserById($userId);
     $result = false;
     $username = $user['name'];
     if (isset($_POST['submit'])) {
         $username = $_POST['username'];
         $password = $_POST['password'];
         $confirm_password = $_POST['confirm-password'];
         $errors = false;
         if (!User::validateUsername($username)) {
             $errors[] = "Имя должно быть больше 5 символов";
         }
         if ($errors == false) {
             $result = User::edit($userId, $username, $password);
         }
     }
     require_once ROOT . '/views/cabinet/edit.php';
     return true;
 }
Example #12
Show file File: CabinetController.php Project: KazakovVS/Store
0
 /**
  * Action для страницы "Редактирование данных пользователя"
  */
 public function actionEdit()
 {
     $userId = User::checkLogged();
     $user = User::getUserById($userId);
     $name = $user['name'];
     $password = $user['password'];
     $result = false;
     if (isset($_POST['submit'])) {
         $name = $_POST['name'];
         $password = $_POST['password'];
         $errors = false;
         if (!User::checkName($name)) {
             $errors[] = 'Имя не должно быть короче 2-х символов';
         }
         if (!User::checkPassword($password)) {
             $errors[] = 'Пароль не должен быть короче 6-ти символов';
         }
         if ($errors == false) {
             $result = User::edit($userId, $name, $password);
         }
     }
     require_once ROOT . '/views/cabinet/edit.php';
     return true;
 }
Example #13
Show file File: CabinetController.php Project: vorobeyDjack/RayBanStore_main_PHP_project
0
 /**
  * @return bool
  * Метод для редактирования данных пользователя(самим пользователем)
  */
 public function actionEdit()
 {
     $userId = User::isLogged();
     //получаем id из сессии
     $user = User::getUserById($userId);
     //получаем инфу по id
     $name = $user['name'];
     $password = $user['password'];
     $res = false;
     $fail = false;
     if (isset($_POST['submit'])) {
         $name = $_POST['name'];
         $password = $_POST['password'];
         if (!User::isValidNamePassword($name, $password)) {
             $fail = 'Имя не должно быть пустым/Пароль больше 5 символов';
         }
         if ($fail == false) {
             $res = User::edit($userId, $name, md5($password));
             //Сохраняем изменения в БД
         }
     }
     $args = array('res' => $res, 'errors' => $fail, 'name' => $name, 'password' => $password);
     return self::render('edit', $args);
 }
Example #14
Show file File: users.php Project: ar-framework-labs/panel
0
 public static function update_users_data()
 {
     if (Auth::check()) {
         $id = $_POST['id'];
         $diplayname = $_POST['diplayname'];
         $email = $_POST['email'];
         $password = $_POST['password'];
         $website = $_POST['website'];
         $statut = $_POST['statut'];
         $ob = new User($id);
         if (!empty($password)) {
             $ob->user_pass = md5($password);
         }
         $ob->user_email = $email;
         $ob->user_url = $website;
         $ob->user_status = $statut;
         $ob->display_name = $diplayname;
         if ($ob->edit()) {
             echo "ok";
         } else {
             echo "Erreur au niveau du modification";
         }
     } else {
         $redirection = Config::get('app.base_url') . Config::get('panel.route');
         header("Location: {$redirection}");
     }
 }
Example #15
Show file File: User.php Project: pratishshr/Aawaaj
0
        $id = $_GET['id'];
        $result = $this->userrepository->delete($id);
        if ($result = true) {
            header("Location: " . BASE_URL . "admin/user/index");
        }
    }
}
//OBJECT OF alluser
$user = new User();
//IF m IS SET, SET IT TO $method, ELSE DEFAULT IT TO index
if (isset($_GET['m'])) {
    $method = $_GET['m'];
} else {
    $method = "index";
}
switch ($method) {
    case "index":
        $user->index();
        break;
    case "add":
        $user->add();
        break;
    case "edit":
        $user->edit();
        break;
    case "delete":
        $user->delete();
        break;
    default:
        $user->index();
}
Example #16
Show file File: UserController.php Project: bigopon/fg
0
 public function update()
 {
     $user = new User($this->db);
     /*
      * check if POST request has created field
      * if yes, add user and return home
      * !! what happens when edit
      *   1. $user load record into memory according to POST.id
      *   2. copy value from POST request to record
      *   3. update back into database
      *
      */
     if ($this->f3->exists('POST.update')) {
         $user->edit($this->f3->get('POST.id'));
         $this->f3->reroute('/');
     } else {
         $user->getById($this->f3->get('PARAMS.id'));
         $this->f3->set('user', $user);
         $this->f3->set('page_head', 'Update User');
         $this->f3->set('view', 'user/update.html');
     }
     /*
      * testing
      */
 }
Example #17
Show file File: ldap.inc.php Project: nicdev007/sitracker
0
/**
 * @author Paul Heaney
 * @todo TODO document this function
*/
function ldap_storeDetails($password, $id = 0, $user = TRUE, $populateOnly = FALSE, &$ldap_conn, $user_attributes)
{
    global $CONFIG;
    $toReturn = false;
    if ($populateOnly) {
        $user_bind = true;
    } else {
        // Authentocate
        $user_bind = @ldap_bind($ldap_conn, $_SESSION['ldap_user_dn'], $password);
    }
    if (!$user_bind) {
        // Auth failed
        debug_log("LDAP Invalid credentials {$_SESSION['ldap_user_dn']}", TRUE);
        $toReturn = false;
    } else {
        // Sucessfull
        debug_log("LDAP Valid Credentials", TRUE);
        $usertype = LDAP_INVALID_USER;
        if ($CONFIG['ldap_grponuser']) {
            if (is_array($user_attributes[$CONFIG['ldap_grpattributeuser']])) {
                // Group stored on user
                foreach ($user_attributes[$CONFIG['ldap_grpattributeuser']] as $group) {
                    if ($user) {
                        // User/Staff
                        // NOTE: we dont have to check about overwriting ADMIN type as we break
                        if (strtolower($group) == strtolower($CONFIG['ldap_admin_group'])) {
                            $usertype = LDAP_USERTYPE_ADMIN;
                            break;
                        } elseif (strtolower($group) == strtolower($CONFIG['ldap_manager_group'])) {
                            $usertype = LDAP_USERTYPE_MANAGER;
                        } elseif (strtolower($group) == strtolower($CONFIG['ldap_user_group'])) {
                            if ($usertype != LDAP_USERTYPE_MANAGER) {
                                $usertype = LDAP_USERTYPE_USER;
                            }
                        }
                    } else {
                        //Customer
                        if (strtolower($group) == strtolower($CONFIG['ldap_customer_group'])) {
                            $usertype = LDAP_USERTYPE_CUSTOMER;
                            break;
                        }
                    }
                }
            }
        } else {
            ldap_close($ldap_conn);
            $ldap_conn = ldapOpen();
            // Need to get an admin thread
            if ($CONFIG['ldap_grpfulldn']) {
                $filter = "(&(objectClass={$CONFIG['ldap_grpobjecttype']})({$CONFIG['ldap_grpattributegrp']}={$_SESSION['ldap_user_dn']}))";
            } else {
                $filter = "(&(objectClass={$CONFIG['ldap_grpobjecttype']})({$CONFIG['ldap_grpattributegrp']}={$user_attributes[$CONFIG['ldap_userattribute']][0]}))";
            }
            if ($user) {
                debug_log("USER: {$filter}", TRUE);
                /*
                 * Locate
                 */
                if (ldap_count_entries($ldap_conn, ldap_search($ldap_conn, $CONFIG['ldap_admin_group'], $filter))) {
                    $usertype = LDAP_USERTYPE_ADMIN;
                    debug_log("ADMIN", TRUE);
                } elseif (ldap_count_entries($ldap_conn, ldap_search($ldap_conn, $CONFIG['ldap_manager_group'], $filter))) {
                    $usertype = LDAP_USERTYPE_MANAGER;
                    debug_log("MANAGER", TRUE);
                } elseif (ldap_count_entries($ldap_conn, ldap_search($ldap_conn, $CONFIG['ldap_user_group'], $filter))) {
                    $usertype = LDAP_USERTYPE_USER;
                    debug_log("USER", TRUE);
                } else {
                    debug_log("INVALID USER", TRUE);
                }
            } else {
                // get back customer group
                $result = ldap_search($ldap_conn, $CONFIG['ldap_customer_group'], $filter);
                if (ldap_count_entries($ldap_conn, $result)) {
                    $usertype = LDAP_USERTYPE_CUSTOMER;
                    debug_log("CUSTOMER", TRUE);
                } else {
                    debug_log("INVALID CUSTOMER", TRUE);
                }
            }
        }
        if ($usertype != LDAP_INVALID_USER and $user) {
            // get attributes
            $user = new User();
            $user->username = $user_attributes[$CONFIG['ldap_userattribute']][0];
            if ($CONFIG['ldap_cache_passwords']) {
                $user->password = $password;
            }
            $user->realname = $user_attributes[$CONFIG['ldap_realname']][0];
            $user->jobtitle = $user_attributes[$CONFIG['ldap_jobtitle']][0];
            $user->email = $user_attributes[$CONFIG['ldap_email']][0];
            $user->phone = $user_attributes[$CONFIG['ldap_telephone']][0];
            $user->mobile = $user_attributes[$CONFIG['ldap_mobile']][0];
            $user->fax = $user_attributes[$CONFIG['ldap_fax']][0];
            $user->message = $user_attributes[$CONFIG['ldap_description']][0];
            $user->holiday_entitlement = $CONFIG['default_entitlement'];
            $user->source = 'ldap';
            // TODO FIXME this doesn't take into account custom roles'
            switch ($usertype) {
                case LDAP_USERTYPE_ADMIN:
                    $user->roleid = 1;
                    break;
                case LDAP_USERTYPE_MANAGER:
                    $user->roleid = 2;
                    break;
                default:
                    $user->roleid = 3;
            }
            if ($id == 0) {
                $user->status = $CONFIG['ldap_default_user_status'];
                $status = $user->add();
            } else {
                // Modify
                $user->id = $id;
                $status = $user->edit();
            }
            if ($status) {
                $toReturn = true;
            } else {
                $toReturn = false;
            }
        } elseif ($usertype == LDAP_USERTYPE_CUSTOMER and !$user) {
            // Contact
            debug_log("Adding contact TYPE {$usertype} USER {$user}", TRUE);
            debug_log("User attributes: " . print_r($user_attributes, TRUE), TRUE);
            $contact = new Contact();
            $contact->username = $user_attributes[$CONFIG['ldap_userattribute']][0];
            if ($CONFIG['ldap_cache_passwords']) {
                $contact->password = $password;
            }
            $contact->surname = $user_attributes[$CONFIG['ldap_surname']][0];
            $contact->forenames = $user_attributes[$CONFIG['ldap_forenames']][0];
            $contact->jobtitle = $user_attributes[$CONFIG['ldap_jobtitle']][0];
            $contact->email = $user_attributes[$CONFIG['ldap_email']][0];
            $contact->phone = $user_attributes[$CONFIG['ldap_telephone']][0];
            $contact->mobile = $user_attributes[$CONFIG['ldap_mobile']][0];
            $contact->fax = $user_attributes[$CONFIG['ldap_fax']][0];
            $contact->siteid = $CONFIG['ldap_default_customer_siteid'];
            $contact->address1 = $user_attributes[$CONFIG['ldap_address1']][0];
            $contact->city = $user_attributes[$CONFIG['ldap_city']][0];
            $contact->county = $user_attributes[$CONFIG['ldap_county']][0];
            $contact->postcode = $user_attributes[$CONFIG['ldap_postcode']][0];
            $contact->courtesytitle = $user_attributes[$CONFIG['ldap_courtesytitle']][0];
            $contact->source = 'ldap';
            if ($id == 0) {
                $status = $contact->add();
            } else {
                debug_log("MODIFY CONTACT {$id}", TRUE);
                $contact->id = $id;
                $status = $contact->edit();
            }
            if ($status) {
                $toReturn = true;
            } else {
                $toReturn = false;
            }
        } else {
            $toReturn = false;
        }
    }
    return $toReturn;
}
Example #18
Show file File: object_inheritance.php Project: harunyasar/object_inheritance_class_abstraction
0
            return sprintf("'%s', '#%s' numarali icerigi duzenledi.", $this->username, $record);
        }
    }
}
$admin = new Admin("Admin", "admin[at]harunyasar[.]com", "13gojira13");
$admin->login();
echo $admin->ban("Moderator");
// 'Admin', 'Moderator' adli kullanicinin erisimini yasakladi.
echo "<br />";
echo $admin->post("Kurallar");
// 'Admin', 'Kurallar' baslikli yeni bir icerik yaratti.
echo "<br />";
$moderator = new Moderator("Moredator", "moderator[at]harunyasar[.]com", "54godzilla54");
$moderator->login();
echo $moderator->edit(1349);
// 'Moredator', '#1349' numarali icerigi duzenledi.
echo "<br />";
echo $moderator->post("Uyari");
// 'Moredator', 'Uyari' baslikli yeni bir icerik yaratti.
echo "<br />";
echo $moderator->logout();
// 'Moredator' adli kullanici cikis yapti.
echo "<br />";
$user = new User("User", "user[at]harunyasar[.]com", "18user81");
$user->login();
echo $user->post("Lorem ipsum dolor sit amet.");
// 'User', 'Lorem ipsum dolor sit amet.' baslikli yeni bir icerik yaratti.
echo $user->edit(54);
// Fatal error
echo $user->ban("Admin");
// Fatal error
Example #19
Show file File: ReferensiController.php Project: beruxganteng/apnthc
0
 public function ubahUser($id)
 {
     $pegawai = new Pegawai($this->registry);
     $this->view->data_peg = $pegawai->get();
     $user = new User($this->registry);
     $data = $user->get($id);
     $this->view->data = array('id' => $data[0]['id'], 'id_pegawai' => $data[0]['id_pegawai'], 'nama' => $data[0]['nama_user'], 'pass' => $data[0]['password'], 'role' => $data[0]['role']);
     if (isset($_POST['submit_e'])) {
         $peg = $_POST['pegawai'];
         $nama = $_POST['nama'];
         $pass = $_POST['pass'];
         $role = $_POST['role'];
         if ($peg == 0) {
             $this->view->add_error('pegawai', 'kolom pegawai harus dipilih!');
         }
         if ($nama == '') {
             $this->view->add_error('nama', 'kolom nama harus diisi!');
         }
         if ($user->is_exist('nama_user', $nama, $id)) {
             $this->view->add_error('nama', 'nama user ini sudah kepake!');
         }
         if ($pass == '') {
             $this->view->add_error('pass', 'kolom password harus diisi!');
         }
         if ($role == 0) {
             $this->view->add_error('role', 'kolom role harus dipilih!');
         }
         if (!$this->view->is_error()) {
             $data = array('id_pegawai' => $peg, 'nama_user' => $nama, 'password' => Hash::create('sha1', $pass, HASH_SALT_KEY), 'role' => $role);
             $user->edit($id, $data);
             $this->view->add_success('success', 'ubah data user berhasil!');
         }
         $this->view->data = array('id' => $id, 'id_pegawai' => $peg, 'nama' => $nama, 'pass' => $pass, 'role' => $role);
     }
     $this->view->aksi = 'update';
     $this->view->render('admin/user');
 }
Example #20
Show file File: CabinetController.php Project: AndreySivaschenko/forteandpiano
0
 public function actionEdit()
 {
     $user = new User();
     //Получаем информацию о пользователе из сессии
     $userId = $user->checkLogged();
     //получаем инф-ию о пользователе из БД
     $userProfile = $user->getUserById($userId);
     $profileData = $user->getProfileByUserId($userId);
     $email = $userProfile['email'];
     $password = $userProfile['password'];
     $name = $profileData['name'];
     $sname = $profileData['sname'];
     $phone = $profileData['phone'];
     $country = $profileData['country'];
     $region = $profileData['region'];
     $city = $profileData['city'];
     $address = $profileData['address'];
     $city_index = $profileData['city_index'];
     $result = false;
     if (isset($_POST['save_edit'])) {
         $email = $_POST['email'];
         $name = $_POST['uname'];
         $sname = $_POST['usname'];
         $phone = $_POST['uphone'];
         $country = $_POST['ucountry'];
         $region = $_POST['uregion'];
         $city = $_POST['ucity'];
         $address = $_POST['uaddress'];
         $city_index = $_POST['uindex'];
         $n_password = $_POST['n_password'];
         $o_password = $_POST['o_password'];
         $errors = false;
         if ($_POST['o_password'] or $_POST['n_password']) {
             if (empty($o_password)) {
                 $errors[] = 'Не указан старый пароль';
             }
             if (empty($n_password)) {
                 $errors[] = 'Не указан новый пароль';
             }
             if (!$user->checkedPassword($password, $o_password)) {
                 $errors[] = 'Старый пароль указан неверно';
             }
             if ($errors == false) {
                 $npassword = $_POST['n_password'];
             }
         }
         if (!User::checkEmail($email)) {
             $errors[] = 'Неправильный Email';
         }
         if (!User::checkName($name)) {
             $errors[] = 'Имя должно быть более 2-х символов';
         }
         if (!User::checkSname($sname)) {
             $errors[] = 'Фамилия должна быть более 2-х символов';
         }
         if (!User::checkPhone($phone)) {
             $errors[] = 'Телефон должен быть более 7-ми символов';
         }
         if (!User::checkCountry($country)) {
             $errors[] = 'Страна должна быть более 2-х символов';
         }
         if (!User::checkRegion($region)) {
             $errors[] = 'Область должна быть более 2-х символов';
         }
         if (!User::checkCity($city)) {
             $errors[] = 'Город должен быть более 2-х символов';
         }
         if (!User::checkAddress($address)) {
             $errors[] = 'Адрес должен быть более 5-ти символов';
         }
         if (!User::checkIndex($city_index)) {
             $errors[] = 'Индекс должен быть более 4-х символов';
         }
         if ($errors == false) {
             $result = $user->edit($userId, $email, $password, $npassword, $name, $sname, $phone, $country, $region, $city, $address, $city_index);
         }
     }
     require_once ROOT . '/views/cabinet/edit.php';
     return true;
 }
Example #21
Show file File: index.php Project: ncloud/bloglounge
0
			} else {
				User::delete(getLoggedId()); 
				logout();
				echo '<script type="text/javascript">alert("'._t('탈퇴했습니다. 안녕히가세요.').'"); document.location.replace("http://'.$_SERVER['HTTP_HOST'].$service['path'].'");</script>';
			}
		}
	} else if (isset($_POSt['leaveout']) && empty($_POST['leaveoutpassword'])) {
		// echo '<script type="text/javascript">alert("'._t('탈퇴 과정을 진행하려면 비밀번호 확인 입력을 해주세요').'");</script>';
	} else {
		if (isset($_POST['name'])) {
			$moArr = array("name"=>$_POST['name'], "email"=>$_POST['email']);
			if (!empty($_POST['password'])) {
				$moArr['password'] = Encrypt::hmac($_POST['loginid'], md5(md5($_POST['password'])));
				$moArr['plainpassword'] = $_POST['password'];
			}
			if (!User::edit($session['id'], $moArr, 'plainpassword')) {
				//echo '<script type="text/javascript">alert("'._t('회원정보를 수정할 수 없습니다').'");</script>';
			} else {
				$userInformation = getUsers();
				//echo '<script type="text/javascript">alert("'._t('회원정보를 수정했습니다').'");</script>';			
				addAppMessage(_t('수정 완료했습니다.'));
			}
		}
	}
	
	include ROOT. '/lib/piece/adminHeader.php';

?>
<link rel="stylesheet" href="<?php echo $service['path'];?>/style/admin_user.css" type="text/css" />
<script type="text/javascript">
</script>
Example #22
Show file File: newpost.php Project: palpalikta/portfolio
0
<?php

if (!isset($_SESSION['userid'])) {
    header('location:index.php?action=login');
}
?>

 <?php 
$id = $_SESSION['userid'];
$user = new User();
$udetail = $user->edit($id);
//var_dump($udetail);die;
?>


 <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <h4 class="com"><?php 
if (isset($_SESSION['success'])) {
    echo $_SESSION['success'];
} else {
    if (isset($_SESSION['error'])) {
        echo $_SESSION['error'];
    }
}
?>
 </h4>


                        <div class="panel-heading">
Example #23
Show file File: c_user.php Project: Harkeynn/Projet-MVC
0
        $ville = $_POST['ville'];
        $mail = $_POST['mail'];
        $naissance = $_POST['naissance'];
        User::add($login, $pwd, $nom, $prenom, $adresse, $cp, $ville, $mail, $naissance);
        header('Location: ./index.php');
        break;
    case 'edit':
        $login = $_POST['identifiant'];
        $pwd = $_POST['pwd'];
        $nom = $_POST['nom'];
        $prenom = $_POST['prenom'];
        $adresse = $_POST['adresse'];
        $cp = $_POST['cp'];
        $ville = $_POST['ville'];
        $mail = $_POST['mail'];
        $naissance = $_POST['naissance'];
        $idUser = $_GET['id'];
        User::edit($idUser, $login, $pwd, $nom, $prenom, $adresse, $cp, $ville, $mail, $naissance);
        header('Location: ./index.php');
        break;
    case 'delete':
        $idUser = $_POST['id'];
        User::delete($idUser);
        session_destroy();
        unset($_SESSION);
        header('Location: ./index.php');
        break;
    default:
        header('Location: ./index.php');
        break;
}
Example #24
Show file File: editprofile.php Project: pekka-m/ClimbingWeb
0
<?php

session_start();
include 'initclasses.php';
$data = [$_POST['nickname'], $_POST['firstname'], $_POST['lastname'], $_POST['phonenumber'], $_POST['address'], $_POST['country'], $_POST['sex'], $_POST['homepage'], $_POST['shoebrand'], $_POST['shoemodel'], $_POST['shoesize'], $_SESSION['logged_user']];
$user = new User($_SESSION['logged_user_email']);
$user->edit($data);
header("Location: profile.php?user={$_SESSION['logged_user_email']}");
Example #25
Show file File: user_profile_edit.php Project: nicdev007/sitracker
0
 // Update user profile
 $errors = 0;
 // check for change of password
 if ($password != '' && $newpassword1 != '' && $newpassword2 != '') {
     // verify password fields
     $passwordMD5 = md5($password);
     if ($newpassword1 == $newpassword2 and strcasecmp($passwordMD5, user_password($edituserid)) == 0) {
         $user->password = $password;
     } else {
         $errors++;
         $error_string .= "<h5 class='error'>{$strPasswordsDoNotMatch}</h5>";
     }
 }
 // update database if no errors
 if ($errors == 0) {
     $result = $user->edit();
     // If this is the current user, update the profile in the users session
     if ($edituserid == $_SESSION['userid']) {
         $_SESSION['style'] = $user->style;
         $_SESSION['realname'] = $user->realname;
         $_SESSION['email'] = $user->email;
         $_SESSION['incident_refresh'] = $user->incident_refresh;
         $_SESSION['update_order'] = $user->update_order;
         $_SESSION['num_update_view'] = $user->num_updates_view;
         $_SESSION['lang'] = $user->i18n;
         $_SESSION['utcoffset'] = $user->utc_offset;
     }
     if ($result === FALSE) {
         include APPLICATION_INCPATH . 'htmlheader.inc.php';
         trigger_error("!Error while updating users table", E_USER_WARNING);
         include APPLICATION_INCPATH . 'htmlfooter.inc.php';
Example #26
Show file File: AdminUserController.php Project: whiterun/bagikasih-v2
0
 /**
  * undocumented function
  *
  * @return void
  * @author 
  **/
 public function updateDo()
 {
     $validator = $this->updateValid();
     if ($validator->passes()) {
         $input = $this->updateInput();
         $save = User::edit($input);
         if ($save) {
             return Redirect::route('admin.user')->withStatuses(['edit' => 'Data Berhasil di edit!']);
         }
         return Redirect::route('admin.user')->withErrors(['edit' => 'Data Gagal di edit!']);
     }
     return Redirect::back()->withErrors($validator)->withInput();
 }
Example #27
Show file File: index.php Project: ncloud/bloglounge
0
					echo '<script type="text/javascript">alert("'._t('관리자 권한을 가지고 있는 회원은 탈퇴처리할 수 없습니다.').'");</script>';
				} else {
					User::delete($_POST['id']); 
				}
			} else {
				if (($readUser['is_admin'] == 'y') && ($isAdmin == 'n')) {
					$countAdmin = User::getAdminCount();
					if ($countAdmin <= 1) {
						echo '<script type="text/javascript">alert("'._t('한 명 이상의 관리자는 존재해야 합니다.').'");</script>';
						$isAdmin = 'y';
					}
				}
				$isAccepted = (isset($_POST['is_accepted'])) ? 'y' : 'n';
				$passw = (!empty($_POST['password'])) ? Encrypt::hmac($readUser['loginid'], md5(md5($_POST['password']))) : '';
				$moArr = array("name"=>$_POST['name'], "email"=>$_POST['email'], "password"=>$passw, "plainpassword"=>$_POST['password'], "is_admin"=>$isAdmin, "is_accepted"=>$isAccepted);
				if (!User::edit($_POST['id'], $moArr, 'plainpassword')) {
					$msg = _t('회원정보 수정 실패');
				} else {
					$msg = _t('회원정보 수정 성공');
				}
			}
		}		
		
		$readUser = User::getAll($read);
	}

	$pageCount = 15; // 페이지갯수
	$page = isset($_GET['page']) ? $_GET['page'] : 1;
	if(!isset($page) || empty($page)) $page = 1;
	
	$memberCount = User::getMemberCount();
Example #28
Show file File: c_user.php Project: Azcatchi/gestion_cv
0
        $photo = $_POST['photo'];
        $identifiant = $_POST['identifiant'];
        $mot_de_passe = $_POST['mot_de_passe'];
        $Add = User::add($nom, $prenom, $adresse_rue, $adresse_cp, $adresse_ville, $email, $date_de_naissance, $photo, $identifiant, $mot_de_passe);
        header('Location: ./index.php');
        break;
    case 'edit':
        $idUser = $_GET['id'];
        $nom = $_POST['nom'];
        $prenom = $_POST['prenom'];
        $adresse_rue = $_POST['adresse_rue'];
        $adresse_cp = $_POST['adresse_cp'];
        $adresse_ville = $_POST['adresse_ville'];
        $email = $_POST['email'];
        $date_de_naissance = $_POST['date_de_naissance'];
        $photo = $_POST['photo'];
        $identifiant = $_POST['identifiant'];
        $mot_de_passe = $_POST['mot_de_passe'];
        User::edit($idUser, $nom, $prenom, $adresse_rue, $adresse_cp, $adresse_ville, $email, $date_de_naissance, $photo, $identifiant, $mot_de_passe);
        $user = User::view($idUser);
        include 'vues/user/v_view.php';
        break;
    case 'delete':
        $idUser = $_POST['id'];
        User::delete($idUser);
        header('Location: ./index.php');
        break;
    default:
        header('Location: ./index.php');
        break;
}