I would like to know what I should do to make sure I'm writing good code that is secure. I have error_reporting set to E_ALL so none of my scripts have any errors pertaining to E_ALL. I also declare all my variables using the settype() function. I know that variable declaration and setting a variable data type are not needed or really necessary in PHP but I've read in places that it's good practice (especially with E_ALL). Also, when using global variables such as $_POST, $_GET, and $_SESSION I get errors that say:
Does anyone know a good way of getting around this. Right now I have my scripts set to turn all !isset data to null, like this:Undefined index: [form object name] in ...
Code: Select all
if(!isset($_POST['username'])) {
$_POST['username'] = null;
}I also get this error:
I really don't know what to do about that one. Here's the line of code it's throwing this out at:Undefined offset:1 in ...
Code: Select all
list($user, $host) = split("@", $_POST['email']);Thanks in advance to anyone with tips and help. Also, I'm not new to PHP programming so please don't treat me like I'm some stupid beginner. I'm self taught and haven't really had anybody set me in any real direction. What I know is from what I've read in forums and a few books, and I try the best I can.