We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

koorb on 04/23/08


Tagged

get php textmate String query codeigniter


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

j0han


Allow $_GET in Codeigniter


Published in: PHP 


  1. <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. /*
  4. Function: allow_query_string
  5. Overrides CIs default behaviour of destroying $_GET
  6.  
  7. Install:
  8. Put this function in hooks/allow_query_string.php
  9.  
  10. Enable hooks in config/config.php
  11. > $config['enable_hooks'] = TRUE;
  12.  
  13. Define the hook in config/hooks.php
  14. > $hook['post_controller_constructor'] = array(
  15. > 'function' => 'allow_query_string',
  16. > 'filename' => 'allow_query_string.php',
  17. > 'filepath' => 'hooks'
  18. > );
  19. */
  20. function allow_query_string() {
  21. parse_str($_SERVER['QUERY_STRING'], $_GET);
  22. $_CI =& get_instance();
  23. foreach ($_GET as $key=>$val) {
  24. $_GET[$key] = $_CI->input->xss_clean($val);
  25. }
  26. }

Report this snippet 

You need to login to post a comment.