/** * Gets all calls for a user. * @param integer $user_id * @return void */ public function user($user_id) { if (!is_admin() && !correct_user($user_id)) { return; } create_call_table(NULL, FALSE); $data['ajax_source'] = 'call/table_by_user/' . $user_id; $data['sort_column'] = 5; // Sort on timestart $data['page_title'] = lang('calls'); $this->load->view('templates/header', $data); $this->load->view('templates/list_view', $data); $this->load->view('templates/footer'); }
<?php require_once "authenticate.php"; require_once "response_get_by_id.php"; require_once "correct_user.php"; $result = get_info_res($_GET['id']); correct_user($result['user_id']); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Edit Text</title> <link href="/3ch/stylesheets/reset.css" rel="stylesheet"> <link href="/3ch/stylesheets/common.css" rel="stylesheet"> </head> <body> <div class="header"> <button type="button" onclick="location.href='/3ch/logout.php'">Log out</button> </br> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</br> </div> <div class="content"> <form action="response_edit_do.php" method="post"> Currently:<?php echo $result['text']; ?> </br> New :</br>
/** * * Submits the password change of a user * @param $user_id */ public function change_password_submit($user_id) { if (!correct_user($user_id)) { return; } // Validation rules $this->form_validation->set_rules('password_prev', lang('password_prev'), 'required|callback_matches_password[' . $user_id . ']'); $this->form_validation->set_rules('password_new', lang('password_new'), 'required|min_length[8]|max_length[72]|matches[password_conf]'); $this->form_validation->set_rules('password_conf', lang('password_conf'), 'required'); // Run validation if ($this->form_validation->run() == FALSE) { // If not succeeded, show form again with error messages $this->change_password($user_id); } else { // If succeeded, insert data into database (use user model) $user = array('password' => $this->phpass->hash($this->input->post('password_new'))); $this->userModel->update_user($user_id, $user); flashdata(lang('password_updated')); redirect('user', 'refresh'); } }
<?php require_once "authenticate.php"; require_once "thread_get_by_id.php"; require_once "correct_user.php"; $info = get_info($_POST['thread_id']); correct_user($info['user_id']); try { $dbh = new PDO('mysql:host=localhost; dbname=textboard', 'admin', 'CCJYzgrbN0qsIsOa'); } catch (PDOException $e) { var_dump($e->getMessage()); exit; } $stmt = $dbh->prepare("UPDATE threads SET name = :name WHERE id = :id"); $stmt->bindParam(':id', $_POST['thread_id'], PDO::PARAM_INT); $stmt->bindParam(':name', $_POST['name'], PDO::PARAM_STR); $result = $stmt->execute(); if ($result) { $url = "/3ch/board.php?id=" . $_POST['thread_id']; header("Location: " . $url); } else { echo "Error occured"; }
<?php require 'db.php'; $access_token = '2.00vDZNLCN7hJiB566636c706wty4rD'; $users = query("select * from users where type='ngo' and is_checked=1 and weibo != '' and weibo_provider='新浪微博'"); foreach ($users as $user) { $weibo = $user['weibo']; $res = preg_match('/weibo.com\\/u\\/(.+)/', $weibo, $mat); if (isset($mat[1])) { //if hit $uid = $mat[1]; $json = file_get_contents("https://api.weibo.com/2/users/show.json?access_token={$access_token}&uid={$uid}"); $arr = json_decode($json, true); if (isset($arr['id'])) { correct_user($user['id'], $arr['screen_name']); } continue; } $res = preg_match('/weibo.com\\/(.+)/', $weibo, $mat); if (isset($mat[1])) { //if hit correct_user($user['id'], $mat[1]); } } function correct_user($user_id, $screen_name) { query("update users set weibo='{$screen_name}' where id={$user_id}"); echo "{$user_id} => {$screen_name} \n"; }
/** Shows all experiments for a leader TODO: unused? */ public function leader($user_id) { if (!correct_user($user_id)) { return; } $experiments = $this->leaderModel->get_experiments_by_leader($user_id); $data['page_title'] = lang('experiments'); $data['table'] = create_experiment_table($experiments); $this->load->view('templates/header', $data); $this->load->view('templates/list_view', $data); $this->load->view('templates/footer'); }
/** Specifies the content for the caller interface view. */ public function leader_interface($user_id) { if (!correct_user($user_id)) { return; } $user = $this->userModel->get_user_by_id($user_id); $experiments = $this->leaderModel->get_experiments_by_leader($user_id); $nr_experiments = count($experiments); $conf_part = $nr_experiments ? count($this->participationModel->get_confirmed_participations($experiments)) : 0; $conf_url = array('url' => 'participation', 'title' => sprintf(lang('part_action'), $conf_part)); create_experiment_table(); $data['ajax_source'] = 'experiment/table/0/0/' . $user_id; $data['page_title'] = sprintf(lang('welcome'), $user->username); $data['page_info'] = sprintf(lang('info_leader'), $nr_experiments); $data['action_urls'] = array($conf_url); $this->load->view('templates/header', $data); $this->authenticate->authenticate_redirect('templates/list_view', $data, UserRole::Leader); $this->load->view('templates/footer'); }