I'm using someone elses class and that person has defined a function with five arguments.
in Sentry.php:
function checkLogin($user = '',$pass = '',$group = 10,$goodRedirect = '',$badRedirect = '')
If all five fields are filled in this leads to a login procedure.
Now on the page where he explains how to use this there is a snippet which, according to php.net, doesn't make sense.
in a page that loads the sentry:
require_once('../system/Sentry.php');
$theSentry = new Sentry();
if(!$theSentry->checkLogin(2)){ header("Location: login.php"); die(); }
which by default should behave as such that it checks if the $group argument is <= 10 (default). In this situation it should be two. If the user checked has a group-variable of <=2 this should enable the person to view the page.
However, this doesn't work and for a very obvious reason: the php manual states:
Note that when using default arguments, any defaults should be on the right side of any non-default arguments; otherwise, things will not work as expected.
So the code, according to phpbuilder.com should have no optional ($variable = default_something
) field to fill in with a call to the function and it definitely shouldn't be defined as the third of five arguments.
How can I use the function like this?:
checkLogin(2)