Is it still secure to have urls like:
http://www.website.eu/product.php?id_product=916
If not, what are security cons? Can someone please point me a link on updated information about this practice regarding security.
Thank you
Is it still secure to have urls like:
http://www.website.eu/product.php?id_product=916
If not, what are security cons? Can someone please point me a link on updated information about this practice regarding security.
Thank you
There's no security cons as far as I know. As long as your code sanitises all user input and you don't leak sensitive info like file paths or queries when an error occurs, you should be fine. Just be sure to block all access to directories where users should not be, such as your libraries or configuration directories.
The most basic thing that you can do here is convert this to lofical URL instead of a physical URL which it is right now.
physical URL - http://www.website.eu/product.php?id_product=916
Logical URL - http://www.website.eu/product/916
This would expose only the needed things and not the complete implementation style of the code.
To do this you will have to make some minor changes to the .htaccess file of the folder where product.php is present.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^product/$ product.php?product_id=$1 [NC]
$_GET parameter is 'id_product' because it's automatically set in the script. With or without URL rewriting you've the same script. $product_id = $_GET['product_id']; in both cases.