Skip to Main Content
Secure Development for Mobile Apps
book

Secure Development for Mobile Apps

by J. D. Glaser
October 2014
Intermediate to advanced content levelIntermediate to advanced
472 pages
10h 44m
English
Auerbach Publications
Content preview from Secure Development for Mobile Apps
47
PHP seCurIty AntI-PAtterns
Validation by Type Process
A Complete Validation by Type
//remove possibility of vague and unintended processing
unset($_REQUEST);
//remove GET this script processes POST only
unset($_GET);
if(ctype_alnum($_POST['userName']))
{
$userName = $_POST['userName'];
$passHash = hash('sha256', $_POST['password']);
$pageID = intval($_POST['pageID']);
$email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL));
//immediately delete clear text password
unset($_POST['password']);
//remove possibility of future access to raw data
unset($_POST);
}
else
exit();
//update database with unescaped, unquoted variables
pdo->query('INSERT INTO users (userName, passHash, pageID)'
VALUES ($userName, $passHash, $pageID));
//update database ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Developing with Web Standards

Developing with Web Standards

John Allsopp
Mobile Cloud Computing

Mobile Cloud Computing

Dijiang Huang, Huijun Wu

Publisher Resources

ISBN: 9781482209037