Investigating PHP
I am currently working my way through MySQL for Dynamic Websites by Larry Ullman (edition 4).
I currently (December 2012) run php 5.3.10-10 and a mysql 5.1.28 database on apache 2.2.22 server on Ubuntu 12.04 in VirtualBox.
Chapter 12: Review and Pursue
login_page.inc.php - array: Dec 2012
The php code in the pdf below is my take on part of the 3rd Pursue exercise in Chapter 12 PHP and MYSQL for Dynamic Web Sites (ed4) by Larry Ullman.
I had to look long and hard at this to 'get' what was required by the question. The pdf below was my initial answer. If you want to run it and try it out, import into your favourite IDE and comment/uncomment the variables. The usual caveats (I am no expert and this is not authoritative) apply.
if (is_array($errors)) {
// foreach loop
} else {
echo $errors;
}
No need to alter check_login().
The point being that you can't assume that the output will be an array and you must program accordingly. That makes the login_page.inc.php as per the next pdf below.
For the discussion on this matter, go to login_page.inc.php