CI_Input::valid_ip()

valid_ip($ip[, $which = '']) Parameters: $ip (string) – IP address $which (string) – IP protocol (‘ipv4’ or ‘ipv6’) Returns: TRUE if the address is valid, FALSE if not Return type: bool Takes an IP address as input and returns TRUE or FALSE (boolean) depending on whether it is valid or not. Note The $this->input->ip_address() method above automatically validates the IP address. if ( ! $this->input->valid_ip($ip)) { echo 'Not Valid'; } else { echo 'Vali

CI_Input::user_agent()

user_agent([$xss_clean = NULL]) Returns: User agent string or NULL if not set Parameters: $xss_clean (bool) – Whether to apply XSS filtering Return type: mixed Returns the user agent string (web browser) being used by the current user, or NULL if it’s not available. echo $this->input->user_agent(); See the User Agent Class for methods which extract information from the user agent string.

CI_Input::set_cookie()

set_cookie($name = ''[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]]) Parameters: $name (mixed) – Cookie name or an array of parameters $value (string) – Cookie value $expire (int) – Cookie expiration time in seconds $domain (string) – Cookie domain $path (string) – Cookie path $prefix (string) – Cookie name prefix $secure (bool) – Whether to only transfer the cookie through HTTPS $httponly (bool) – Whether to on

CI_Input::server()

server($index[, $xss_clean = NULL]) Parameters: $index (mixed) – Value name $xss_clean (bool) – Whether to apply XSS filtering Returns: $_SERVER item value if found, NULL if not Return type: mixed This method is identical to the post(), get() and cookie() methods, only it fetches server data ($_SERVER): $this->input->server('some_data'); To return an array of multiple $_SERVER values, pass all the required keys as an array. $this->input->server(array('SERVER_PROTOCOL',

CI_Input::request_headers()

request_headers([$xss_clean = FALSE]) Parameters: $xss_clean (bool) – Whether to apply XSS filtering Returns: An array of HTTP request headers Return type: array Returns an array of HTTP request headers. Useful if running in a non-Apache environment where apache_request_headers() will not be supported. $headers = $this->input->request_headers();

CI_Input::post_get()

post_get($index[, $xss_clean = NULL]) Parameters: $index (string) – POST/GET parameter name $xss_clean (bool) – Whether to apply XSS filtering Returns: POST/GET value if found, NULL if not Return type: mixed This method works pretty much the same way as post() and get(), only combined. It will search through both POST and GET streams for data, looking in POST first, and then in GET: $this->input->post_get('some_data', TRUE);

CI_Input::post()

post([$index = NULL[, $xss_clean = NULL]]) Parameters: $index (mixed) – POST parameter name $xss_clean (bool) – Whether to apply XSS filtering Returns: $_POST if no parameters supplied, otherwise the POST value if found or NULL if not Return type: mixed The first parameter will contain the name of the POST item you are looking for: $this->input->post('some_data'); The method returns NULL if the item you are attempting to retrieve does not exist. The second optional parameter

CI_Input::method()

method([$upper = FALSE]) Parameters: $upper (bool) – Whether to return the request method name in upper or lower case Returns: HTTP request method Return type: string Returns the $_SERVER['REQUEST_METHOD'], with the option to set it in uppercase or lowercase. echo $this->input->method(TRUE); // Outputs: POST echo $this->input->method(FALSE); // Outputs: post echo $this->input->method(); // Outputs: post

CI_Input::is_cli_request()

is_cli_request() Returns: TRUE if it is a CLI request, FALSE if not Return type: bool Checks to see if the application was run from the command-line interface. Note This method checks both the PHP SAPI name currently in use and if the STDIN constant is defined, which is usually a failsafe way to see if PHP is being run via the command line. $this->input->is_cli_request() Note This method is DEPRECATED and is now just an alias for the is_cli() function.

CI_Input::is_ajax_request()

is_ajax_request() Returns: TRUE if it is an Ajax request, FALSE if not Return type: bool Checks to see if the HTTP_X_REQUESTED_WITH server header has been set, and returns boolean TRUE if it is or FALSE if not.