Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter and $_SERVER

Tags:

codeigniter

What is equalient of $_SERVER in codeigniter ?

like image 927
Simpanoz Avatar asked Mar 17 '11 07:03

Simpanoz


People also ask

Which database does CodeIgniter support?

Currently supported databases are: MySQL (5.1+) via the mysql (deprecated), mysqli and pdo drivers. Oracle via the oci8 and pdo drivers. PostgreSQL via the postgre and pdo drivers.

What is request in CodeIgniter?

The request class is an object-oriented representation of an HTTP request. This is meant to work for both incoming, such as a request to the application from a browser, and outgoing requests, like would be used to send a request from the application to a third-party application.


3 Answers

$this->input->server()

For more information, please refer to the User Guide : Input

like image 88
Réjôme Avatar answered Oct 19 '22 18:10

Réjôme


Réjôme is spot on, but remember that $_SERVER still works fine.

like image 45
Phil Sturgeon Avatar answered Oct 19 '22 17:10

Phil Sturgeon


Use the codigniter "way" for input such as $_POST and $_SERVER. CodeIgniter's input class has built in functionality to prevent XSS attacks. Using the input class will also make your code much more extendable, if for example, you wish to build in some kind of intrusion systems, such as PHP IDS.

http://codeigniter.com/user_guide/libraries/input.html

http://www.phpids.org/

The three functions are:

$this->input->post()
$this->input->cookie()
$this->input->server()
like image 25
jjwdesign Avatar answered Oct 19 '22 18:10

jjwdesign