public function action_edit() { $id = $this->request->param('id'); if ($id != $this->user) { $this->request->redirect(URL::base()); } $view = View::factory('player_edit'); $view->realname = @real_name_from_id($id); if ($_POST) { $realname = @$_POST['realname']; $current_password = @$_POST['current_password']; $new_password = @$_POST['new_password']; $confirm_password = @$_POST['confirm_password']; if ($new_password) { if (!Auth::check_password($current_password)) { array_push($this->template->errors, "Password did not match password on file."); } if ($new_password != $confirm_password) { array_push($this->template->errors, "New passwords did not match."); } if (empty($this->template->errors)) { password(name_from_id($id)); } } if ($realname) { DB::update('users')->set(array('realname' => $realname))->where('id', '=', $id)->execute(); } $this->request->redirect('/player/view/2'); } $this->template->content = $view; }
function real_name_link_from_id($id) { return '<a href="' . URL::base() . 'player/view/' . $id . '">' . real_name_from_id($id) . '</a>'; }
<h2><?php echo real_name_from_id($id); ?> on Team <?php echo team_link_from_id($team); ?> </h2> <h4>Sports Participated in:</h4> <? //die(debug::vars($sports)); foreach($sports as $sport) { echo sport_link_from_id($sport); } ?> <br /> <br /> <?php echo $edit;