Hi...

Originally Posted by
Tim_Rogovets
Marcus, that's an interesting point. Can you give more details regarding the way you write your code without having the exact database schema.
There is actually an example going on right now in the advanced forum (the RBAC one). As was pointed out, just write your ideal code.
Say you want to write a protected page...
PHP Code:
<?php
require_once('stubs/authenticator.php');
$authenticator = &new Authenticator();
$login = &$authenticator->login('Me', 'Secret');
if (! $login) {
header('Location: error.php');
}
?><html>
...
</html>
Sorry, but I am a bit of an OO bigot. A procedural version would look similar though.
Now the stub version of the Authenticator...
PHP Code:
<?php
class Authenticator {
function Authenticator() {
}
function login($name, $password) {
if (($name == 'Me') && ($password == 'Secret')) {
return new Login('Me');
}
return false;
}
}
?>
You may want to stub the Login as well. Once the application design has settled down, you can start to replace the stubs with the live versions. It's really just an enabler for top down design. It's crude, but you can achieve a lot with this. Not least you can get a prototype in front of the customer that much faster.
yours, Marcus
Bookmarks