• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP xss_clean函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中xss_clean函数的典型用法代码示例。如果您正苦于以下问题:PHP xss_clean函数的具体用法?PHP xss_clean怎么用?PHP xss_clean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了xss_clean函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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');
 }
开发者ID:RickChaos,项目名称:manage-rick-chaos.huhu.tw,代码行数:25,代码来源:Message.php


示例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));
 }
开发者ID:Clidus,项目名称:dumplog-website,代码行数:30,代码来源:auth.php


示例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);
 }
开发者ID:OranTing,项目名称:gdby_github_repo,代码行数:28,代码来源:MY_Controller.php


示例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');
             }
         }
     }
 }
开发者ID:TuringTW,项目名称:dormsys,代码行数:25,代码来源:Login.php


示例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);
 }
开发者ID:ricardomangore,项目名称:sys-tarifario,代码行数:29,代码来源:Opusx.php


示例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'])));
     }
 }
开发者ID:simple-gifts,项目名称:Delightful-Labor,代码行数:34,代码来源:relationships.php


示例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');
 }
开发者ID:Ahmad-Hilali,项目名称:agilan,代码行数:7,代码来源:files.php


示例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');
 }
开发者ID:Ahmad-Hilali,项目名称:agilan,代码行数:7,代码来源:bookmarks.php


示例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');
     }
 }
开发者ID:KathyLynne,项目名称:miniblog,代码行数:33,代码来源:Blog.php


示例10: prepare_fields

 function prepare_fields(&$var)
 {
     if (!is_array($var)) {
         $var = remove_tags(xss_clean(trim($var)));
     }
     return $var;
 }
开发者ID:sail3,项目名称:PIPLibelula,代码行数:7,代码来源:utils_helper.php


示例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');
 }
开发者ID:Ahmad-Hilali,项目名称:agilan,代码行数:7,代码来源:blog.php


示例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);
 }
开发者ID:RickChaos,项目名称:manage-rick-chaos.huhu.tw,代码行数:59,代码来源:Manage_template.php


示例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();
 }
开发者ID:Ahmad-Hilali,项目名称:agilan,代码行数:9,代码来源:m_posts.php


示例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;
}
开发者ID:edwardshe,项目名称:YUDI,代码行数:9,代码来源:functions.php


示例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();
 }
开发者ID:Ahmad-Hilali,项目名称:agilan,代码行数:9,代码来源:m_bookmarks.php


示例16: update_profile

 function update_profile()
 {
     $id = $_SESSION['userid'];
     $try = $this->m_users->update_user($id);
     $tags = xss_clean(substr($_SESSION['tags'], 0, 255));
     $this->m_tags->add_tags($tags, 'users', $try);
     // Update the session and redirect the user
     $_SESSION['logged_in_user'] = $this->m_users->get_user($id);
     redirect("agilan/index", 'refresh');
 }
开发者ID:Ahmad-Hilali,项目名称:agilan,代码行数:10,代码来源:agilan.php


示例17: fields

 public function fields($fields)
 {
     $this->load->helper('security');
     $data = array();
     if (count($fields)) {
         foreach ($fields as $key => $value) {
             $data[$key] = xss_clean(strip_tags($value));
         }
     }
     return $data;
 }
开发者ID:Nnamso,项目名称:tbox,代码行数:11,代码来源:order_m.php


示例18: verifyUniqueUserID

 function verifyUniqueUserID($strUserName, $id)
 {
     $id = (int) $id;
     $strUserName = xss_clean(trim($strUserName));
     $this->load->model('util/mverify_unique', 'clsUnique');
     if (!$this->clsUnique->bVerifyUniqueText($strUserName, 'us_strUserName', $id, 'us_lKeyID', true, 'us_bInactive', false, null, null, false, null, null, 'admin_users')) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:simple-gifts,项目名称:Delightful-Labor,代码行数:11,代码来源:user_acct.php


示例19: index

 public function index()
 {
     // включаем библиотеку для работы с сессиями
     $this->load->library('session');
     $success_send = false;
     // если был пост запрос
     if ($this->input->server('REQUEST_METHOD') == 'POST') {
         // подключение библиотеки для валидации форм
         $this->load->library('form_validation');
         // подулючение хелпера для обработки элементов форм
         $this->load->helper('security');
         // установка правил валидации
         $this->form_validation->set_rules($this->config->item('contact_validation'));
         $this->form_validation->set_rules('captcha', 'Captcha', 'callback_validate_captcha');
         // проверка каптчи
         // если данные прошли проверку
         if ($this->form_validation->run() === TRUE) {
             // получаем данные из формы
             $email = xss_clean($this->input->post('email'));
             $subject = xss_clean($this->input->post('subject'));
             $message = xss_clean($this->input->post('message'));
             // включаем библиотеку для отправки писем
             $this->load->library('email');
             $this->email->from($this->config->item('from_email'), 'Сайт дизайн студии');
             $this->email->to($this->config->item('to_email'), 'Администратору сайта');
             $this->email->subject($subject);
             $this->email->message($message);
             $this->email->send();
             // в сессию записываем данные о том, что письмо отправлено
             $this->session->set_flashdata('success_send', true);
             redirect('/contacts');
         }
     }
     if ($this->session->flashdata('success_send')) {
         $success_send = $this->session->flashdata('success_send');
     }
     // здесь место для тебя ... передавай каптчу в массив ниже в шаблон
     $this->load->helper('captcha');
     $original_string = array_merge(range(0, 9), range('a', 'z'), range('A', 'Z'));
     $original_string = implode("", $original_string);
     $captcha = substr(str_shuffle($original_string), 0, 6);
     $vals = array('word' => $captcha, 'img_path' => './captcha/', 'img_url' => base_url() . '/captcha/', 'img_width' => 150, 'img_height' => 50, 'expiration' => 7200);
     $cap = create_captcha($vals);
     $data['image'] = $cap['image'];
     if (file_exists(BASEPATH . "../captcha/" . $this->session->userdata['image'])) {
         unlink(BASEPATH . "../captcha/" . $this->session->userdata['image']);
     }
     $this->session->set_userdata(array('captcha' => $captcha, 'image' => $cap['time'] . '.jpg'));
     $form_html = $this->renderHTML('contacts/contact_form', $data, true);
     $this->setToData('title', 'Связаться с нами');
     $this->setToData('form', $form_html);
     $this->setToData('success_send', $success_send);
     $this->display('contacts/index');
 }
开发者ID:paintcast,项目名称:loftphpdz7,代码行数:54,代码来源:Contacts.php


示例20: evote

 function evote()
 {
     parent::Controller();
     $this->load->helper(array('fdcore_framework', 'office_framework', 'rf_framework_helper'));
     $this->load->helper(array('language', 'url', 'file', 'security', 'date', 'form', 'html', 'pay'));
     $this->load->library(array('session', 'table', 'parser', 'ajax', 'cache'));
     $this->lang->load('office', get_lang());
     $this->login = xss_clean($this->session->userdata('login'));
     RunFunc('connectdb|connectmydb|allow_ip|check_offline|check_sql_inject');
     $this->limit = config('vote_limit', 'core');
     $this->output->enable_profiler(config('profiler', 'core'));
 }
开发者ID:SelFish131,项目名称:rf_office,代码行数:12,代码来源:evote.php



注:本文中的xss_clean函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xssafe函数代码示例发布时间:2022-05-23
下一篇:
PHP xsrf_guard函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap