I'm learning php on my own now and I'm developing some simple sites using php include to ease the page creation process. I've searched this website for ways to make it secure but, as a noob, I'm always afraid of messing up.
<?php
$siteArticles = array('instalacoes','galeria','regiao-e-historia','precos','contactos');
if( isset($_GET['page']) ){
if( in_array($_GET['page'], $siteArticles, true) && file_exists('pt/'.'rbs-article-'.$_GET['page'].'.php') ){
include('pt/'.'rbs-article-'.$_GET['page'].'.php');
}
}else{
include('pt/rbs-article-home.php');
}
?>
As you can see, it first checks if the page's allowed through the array and then add a prefix to the name file.
My question is, how secure is this?
Thank you for your time.