scope of classes in PHP

From: Date: Sat, 11 Feb 2006 16:30:07 +0000
Subject: scope of classes in PHP
Groups: php.general 
Request: Send a blank email to php-general+get-230253@lists.php.net to get a copy of this message
Hi I'm developing an app to administer LDAP (phpLdapAdmin is too complex for the customer). I have created an LDAP class, in a file class_ldap.php. It include methods for connecting to the server, binding a DN (effectively login), and adding posix groups. I have an index.php with include_once 'class_ldap.php', which allows me to login using the HTTP authentication mechanism. The connect method stores the resulting connection resource in a global variable (included in a config.php file). When I then go to add the posix group (from add_group.php, that also includes class_ldap.php), I find that the global connection variable is not valid. My question is, do I need to connect and authenticate with the LDAP server every time I want to perform an action, or is there a way to establish a connection for the user's session, that is cleared when the user logs out. Many thanks, Stuart. -- --------------------------------------- Stuart Bailey BSc (hons) CEng CITP MBCS LinuSoft (Proprietor) Linux Specialist (01953) 601294 (07778) 383739 http://www.linusoft.co.uk ----------------------------------------

« previous php.general (#230253) next »