php - regex and $_GET -


I am creating a small site for a friend, non-friendly, so that can make the page easier I think I'll just include everything in index.php. So she can only leave a page in a folder called / page / and it has been done.

index.php

  if (preg_match ('/ [a-zA-Z] /', $ _GET ['page'] )) {$ Page = 'pages /' $ GET ['page'] 'Php'; If ($ page) {$ page included; } Else {exit; }} Other {include ('pages / home.php'); }  

Is it safe enough? I only allow AZ characters. I mean this is not a big site like Google, but I'm just an amateur, so I'm asking people to make sure :)

What do you think is?

You can use

  ctype_alnum ($ _ GET [ "Page"]);  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -