Jump to content

Security on $_GET variables?


JJohnsenDK

Recommended Posts

It depends what your using it to do?? i mean the standard is using stuff like mysql_real_escape_string() for inserting just data but if your using GET for like yoursite.com/index.php?page=links then you will also want to check that file exists and use absolute paths so that no-one can include system files and view them.

 

Just my 2 pence

 

Regards

Liam

I mena in the way of using

 

 

 

if (file_exists('/home/webroot/includes/'.$_GET['page']) {

include('/home/webroot/includes/'.$_GET['page']);

}

 

because if you just use

 

if (file_exists($_GET['page']) {

include($_GET['page']);

}

 

Then if i type in your site www.yoursite.com/index.php?page=/home/webroot/.htaccess

 

Then in theory if thast existed then it would display it on your page and same goes for any other location (Just an example)

 

 

Liam

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.