Hi maybe somebody can help me and tell me what i'm doing wrong.
I have 3 classes and one normal script that connects to the classes.
ldap.class (for ldap queries)
auth.class (for authentication)
access.class (for adding access to radius)
script.php that invokes all.
auth.class and access.class have both the ldap.class included within their functions.
Now i'm including auth.class and access.class in to the script.php.
If i then run script.php it showes me the error: Cannot redeclare class ldap.class.
Since the ldap.class is included in a function, why is the include command treated globaly?
I'm really stuck with these include restrictions. Can somebody maybe tell me a common way how to get around these problems when working object orientated?
Here very short example just to see what i mean (of course this wouldn't work):
auth.class does following:
<?
function auth_check (user,pass)
{
include "ldap.class";
$ldap->search(uid=$user);
}
?>
access.class does following:
<?
function add (user,pass)
{
include "ldap.class";
$ldap->add(uid=$user,pass=$pass);
}
?>
script.php does following:
<?
include "auth.class";
include "access.class";
$auth = new auth.class;
$auth->auth_check(user,pass);
$acc = new access.class;
$acc->add(user,pass);
?>