本文整理汇总了PHP中xss_clean函数的典型用法代码示例。如果您正苦于以下问题:PHP xss_clean函数的具体用法?PHP xss_clean怎么用?PHP xss_clean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xss_clean函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$this->load->library('pagination');
$data_table = $this->input->get("data_table");
//$class_table = $this->input->get("class_table");
$page = $this->input->get('page', TRUE);
if (!$page) {
$page = '1';
}
//先取得總共有多少資料
$config['total_rows'] = $this->Message_model->get_classes_count($data_table, $keyword);
//該頁的網址
$config['base_url'] = base_url() . 'message/index';
//幾筆為一頁
$config['per_page'] = 15;
$start = $config['per_page'] * ($page - 1);
//開始撈資料
$query = $this->Message_model->get_classes($table_name, $keyword, $config['per_page'], $start);
$data['classes'] = $query;
$data['table_name'] = xss_clean($table_name);
$data['subject'] = xss_clean($keyword);
$this->pagination->initialize($config);
$this->load->view('public_program/message/message', $data);
// $this->load->view('public_program/ckeditor');
}
示例2: appLogin
function appLogin()
{
$result['success'] = true;
// read request body and decode into array
$requestBody = json_decode(file_get_contents('php://input'), true);
// check that username/password exists in request
if (array_key_exists("username", $requestBody) && array_key_exists("password", $requestBody)) {
// clean data
$this->load->helper('security');
$username = trim(xss_clean($requestBody["username"]));
$password = trim(xss_clean($requestBody["password"]));
// send password reset email
$this->load->model('User');
if ($this->User->login($username, $password)) {
// success, return userID hash
$result['userID'] = "1234";
// TODO: hash UserID
} else {
// failed, return error
$result['success'] = false;
$result['errorMessage'] = "Sorry duder, that seems to be the wrong username or password. Please try again.";
}
} else {
// something has gone very wrong here
$result['success'] = false;
$result['errorMessage'] = "This request doesn't look right.";
}
// return json response
$this->output->set_content_type('application/json')->set_output(json_encode($result));
}
示例3: __construct
public function __construct()
{
parent::__construct();
$this->_service_url = C('service.s');
$this->data['base_url'] = C('config.base_url');
$this->data['img_url'] = C('config.img_url');
$this->data['api_url'] = C('config.api_url');
$this->data['web_url'] = C('config.web_url');
$this->data['css_version'] = C('version.version.css');
$this->data['js_version'] = C('version.version.js');
$this->load->library(array('UserAuth', 'Http'));
$this->data['user_info'] = $this->userauth->current(FALSE);
if (empty($this->data['user_info'])) {
header("location:" . $this->data['base_url'] . '/user');
exit;
}
$this->post = json_decode(file_get_contents("php://input"), TRUE);
// 从post中json字符串中解析出变量并合并到$_POST
if (!empty($this->post)) {
$this->post = xss_clean($this->post);
$_POST = array_merge($_POST, $this->post);
}
$this->data['left_nav'] = $this->create_left_nav();
$this->data['top_nav'] = $this->create_top_nav();
$this->data['city_map'] = $this->create_cities_map();
// 激活分析器以调试程序
// $this->output->enable_profiler(TRUE);
}
示例4: index
public function index()
{
//get the posted values
$username = $this->input->post("username");
$password = $this->input->post("password");
// validate
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'trim|required');
$this->form_validation->set_rules('password', 'Password', 'trim|required');
if ($this->form_validation->run() === FALSE) {
$this->load->view('template/login');
} else {
if ($this->input->post('btnlogin') == 'login') {
$result = $this->login_check->get_user(xss_clean($username), $password);
if (count($result) > 0) {
$sessiondata = array('user' => $result->name, 'power' => $result->power, 'm_id' => $result->m_id);
$this->session->set_userdata($sessiondata);
// $this->load->view(print_r($this->session));
redirect('/index');
} else {
redirect('/login');
}
}
}
}
示例5: login
/**
* login()
*/
public function login()
{
$data['header'] = $this->load->view('system/header', NULL, TRUE);
//Obtener y limpiar los datos
$username = xss_clean($this->input->post('username'));
$password = do_hash(xss_clean($this->input->post('password')), 'md5');
//Validar los datos obtenidos
$this->form_validation->set_rules('username', 'User Name', 'required', array('required' => $this->lang->line('error_required_username')));
$this->form_validation->set_rules('password', 'Password', 'required', array('required' => $this->lang->line('error_required_password')));
if ($this->form_validation->run() == FALSE) {
//Se despliega el login con mensajes de error
$data['content'] = $this->load->view('system/login', NULL, TRUE);
} else {
try {
//Se validan las credenciales de acceso
$this->opx_auth->auth_user($username, $password);
//Se redirecciona al controlador del dashboard
redirect('dashboard');
} catch (Exception $e) {
$data_login['error_login_message'] = $this->lang->line('error_login_message');
$data['content'] = $this->load->view('system/login', $data_login, TRUE);
}
}
$data['footer'] = $this->load->view('system/footer', NULL, TRUE);
$this->load->view('system/layout', $data);
}
示例6: addEditS1
function addEditS1($lPID)
{
$this->load->helper('dl_util/verify_id');
verifyID($this, $lPID, 'people ID');
$displayData = array();
$lPID = (int) $lPID;
$params = array('enumStyle' => 'terse');
$this->load->library('generic_rpt', $params);
$this->load->model('people/mpeople', 'clsPeople');
$this->load->model('admin/madmin_aco', 'clsACO');
// $this->load->helper('dl_util/email_web');
$this->clsPeople->loadPeopleViaPIDs($lPID, false, false);
$displayData['contextSummary'] = $this->clsPeople->peopleHTMLSummary(0);
// validation rules
$this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
$this->form_validation->set_rules('txtSearch', 'SEARCH', 'trim|required');
$bFormValidated = $this->form_validation->run();
$displayData['title'] = CS_PROGNAME . ' | Relationships';
$displayData['pageTitle'] = anchor('main/menu/people', 'People', 'class="breadcrumb"') . ' | ' . anchor('people/people_record/view/' . $lPID, 'Record', 'class="breadcrumb"') . ' | Relationships';
$displayData['nav'] = $this->mnav_brain_jar->navData();
if (!$bFormValidated) {
$displayData['search'] = new stdClass();
$displayData['search']->strButtonLabel = 'Search';
$displayData['search']->strLegendLabel = 'Create a relationship between ' . $this->clsPeople->people[0]->strSafeName . ' and another person';
$displayData['search']->formLink = 'people/relationships/addEditS1/' . $lPID;
$displayData['search']->lSearchTableWidth = 240;
$displayData['search']->bBiz = false;
$displayData['mainTemplate'] = 'util/search_people_biz_view';
$this->load->vars($displayData);
$this->load->view('template');
} else {
$this->searchSelected($displayData, $lPID, 'People Search', xss_clean(trim($_POST['txtSearch'])));
}
}
示例7: add_details
function add_details()
{
$try = $this->m_files->add_details();
$tags = xss_clean(substr($_SESSION['f_tags'], 0, 255));
$this->m_tags->add_tags($tags, 'files', $try);
redirect("files/index", 'refresh');
}
示例8: insert
function insert()
{
$try = $this->m_bookmarks->add_bookmark();
$tags = xss_clean(substr($_SESSION['b_tags'], 0, 255));
$this->m_tags->add_tags($tags, 'bookmarks', $try);
redirect("bookmarks/index", 'refresh');
}
示例9: edit
public function edit()
{
$this->load->helper('form');
$this->load->library('form_validation');
$id = $this->uri->segment(3);
$post = $this->post->get_by_id($id);
$this->form_validation->set_rules('title', 'Title', 'trim|required|max_length[255]');
$this->form_validation->set_rules('body', 'Body', 'trim|required|max_length[500]');
$data['action'] = site_url('blog/edit/' . $id);
$data['post'] = $post;
if ($_POST) {
if ($this->form_validation->run() == FALSE) {
$this->load->view('templates/header');
$this->load->view('blog/edit', $data);
$this->load->view('templates/footer');
} else {
$this->load->helper('security');
$post = new Post_model();
$post->id = xss_clean($this->uri->segment(3));
$post->title = xss_clean($this->input->post('title', TRUE));
$post->body = xss_clean($this->input->post('body', TRUE));
$date = new DateTime();
$post->created = $date->format('Y-m-d H:i:s');
if ($post->save()) {
redirect(base_url('blog/details/' . $post->id), 'location');
}
}
} else {
$this->load->view('templates/header');
$this->load->view('blog/edit', $data);
$this->load->view('templates/footer');
}
}
示例10: prepare_fields
function prepare_fields(&$var)
{
if (!is_array($var)) {
$var = remove_tags(xss_clean(trim($var)));
}
return $var;
}
示例11: insert
function insert()
{
$try = $this->m_posts->add_post();
$tags = xss_clean(substr($_SESSION['p_tags'], 0, 255));
$this->m_tags->add_tags($tags, 'posts', $try);
redirect("blog/index", 'refresh');
}
示例12: left
public function left()
{
$userid = $this->session->user_id;
$query_level_one = $this->Manage_Template_Model->get_menu(1, 0, $userid);
$menu = " <ul class=\"nav navbar-nav side-nav\">";
for ($i = 0; $i < count($query_level_one); $i++) {
$level_one_name = xss_clean($query_level_one[$i]['Name']);
$level_one_id = xss_clean($query_level_one[$i]['Id']);
$level_one_type = xss_clean($query_level_one[$i]['Type']);
$level_one_promgram_url = xss_clean($query_level_one[$i]['Promgram_Url']);
$menu = $menu . "<li>";
$menu = $menu . "<a href=\"javascript:;\" data-toggle=\"collapse\" data-target=\"#demo" . $i . "\"><i class=\"fa fa-fw fa-folder\"></i> " . $level_one_name;
if ($level_one_type == "folder") {
if ($this->Manage_Template_Model->has_node($level_one_id)) {
$menu = $menu . " <i class=\"fa fa-fw fa-caret-down\"></i></a>";
$menu = $menu . "<ul id=\"demo" . $i . "\" class=\"collapse\">";
$query_level_two = $this->Manage_Template_Model->get_menu(2, $level_one_id, $userid);
for ($j = 0; $j < count($query_level_two); $j++) {
$level_two_name = xss_clean($query_level_two[$j]['Name']);
$level_two_id = xss_clean($query_level_two[$j]['Id']);
$level_two_type = xss_clean($query_level_two[$j]['Type']);
$level_two_promgram_url = xss_clean($query_level_two[$j]['Promgram_Url']);
$menu = $menu . "<li>";
if ($level_two_type == "folder") {
$menu = $menu . "<a href=\"javascript:;\" data-toggle=\"collapse\" data-target=\"#demo" . $i . "_" . $j . "\"> <i class=\"fa fa-fw fa-folder\"></i> " . $level_two_name;
if ($this->Manage_Template_Model->has_node($level_two_id)) {
$menu = $menu . " <i class=\"fa fa-fw fa-caret-down\"></i></a>";
$menu = $menu . "<ul id=\"demo" . $i . "_" . $j . "\" class=\"collapse\">";
$query_level_three = $this->Manage_Template_Model->get_menu(3, $level_two_id, $userid);
for ($k = 0; $k < count($query_level_three); $k++) {
$level_three_name = xss_clean($query_level_three[$k]['Name']);
$level_three_promgram_url = xss_clean($query_level_three[$k]['Promgram_Url']);
$menu = $menu . "<a href=\"javascript:change_content('" . base_url($level_three_promgram_url) . "','" . $level_three_name . "')\"><i class=\"fa fa-fw fa-cog\"></i>" . $level_three_name . "</a>";
}
$menu = $menu . "</ul>";
} else {
$menu = $menu . "</a>";
}
} else {
$menu = $menu . "<a href=\"javascript:change_content('" . base_url($level_two_promgram_url) . "','" . $level_two_name . "')\"><i class=\"fa fa-fw fa-cog\"></i>" . $level_two_name . "</a>";
}
$menu = $menu . "</li>";
}
$menu = $menu . "</ul>";
} else {
$menu = $menu . "</a>";
}
} else {
$menu = $menu . "<a href=\"javascript:change_content('" . base_url($level_one_promgram_url) . "','" . $level_one_name . "')\"><i class=\"fa fa-fw fa-cog\"></i>" . $level_one_name . "</a>";
}
$menu = $menu . "</li>";
}
$menu = $menu . " </ul>";
$data["menu"] = $menu;
if ($this->input->post('node_name')) {
$this->session->set_userdata('node_name', $this->input->post('node_name'));
}
$this->load->view('manage_template/template_left', $data);
}
示例13: add_post
function add_post()
{
$userid = $_SESSION['userid'];
$now = date("Y-m-d h:i:s");
$data = array('title' => xss_clean(substr($this->input->post('title'), 0, 255)), 'body' => xss_clean(substr($this->input->post('body'), 0, 5000)), 'user_id' => $userid, 'created' => $now);
$this->db->insert("posts", $data);
$_SESSION['p_tags'] = $this->input->post('tags');
return $this->db->insert_id();
}
示例14: filter_string
function filter_string($string)
{
$result = str_replace("'", "", $string);
$result = str_replace('"', "", $result);
$result = strip_tags($result);
$result = trim($result);
$result = xss_clean($result);
return $result;
}
示例15: add_bookmark
function add_bookmark()
{
$userid = $_SESSION['userid'];
$now = date("Y-m-d h:i:s");
$data = array('url' => xss_clean(substr($this->input->post('url'), 0, 255)), 'description' => xss_clean(substr($this->input->post('description'), 0, 255)), 'user_id' => $userid, 'created' => $now);
$this->db->insert("bookmarks", $data);
$_SESSION['b_tags'] = $this->input->post('tags');
return $this->db->insert_id();
}