I'm coding for a fairly popular website, that will be used by a large group of people. I have two major concerns, securing the input that gets passed through to a MySQL database, and securing $_GET information. Since I'm coding all the scripts myself, I'm using this simple method to secure $_GET:
I'm fairly confident that this method will work fine, though if you see a flaw, I'd appreciate the criticism.PHP Code:$action = $_GET['action'];
$action_possible = array("register", "login", "logout");
// If the action isn't register,login, or logout, Kill the script.
if (!in_array($action, $action_possible))
{
die();
}
Now for user input, all input inserted into the database is passed through an insert function, all user input is passed through this function:
I appreciate any help or advice you have to offer, thank you.PHP Code:function escape($input){
if(get_magic_quotes_gpc())
{
$input = stripslashes($input);
} else {
$input = addslashes($input);
}
$input = mysql_real_escape_string($input);
return $input;
}





Bookmarks