-# You should have received a copy of the GNU General Public License
-# along with wfpl; see the file COPYING. If not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA.
-
-# you'll need this file that calles db_connect()
-require_once('db_connect.php');
+# You should have received a copy of the GNU Lesser General Public License
+# along with wfpl; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# you'll need this file that calls db_connect()
+if(!isset($GLOBALS['wfpl_db_handle'])) {
+ if(file_exists('db_connect.php')) {
+ require_once('db_connect.php');
+ } elseif(file_exists('code/db_connect.php')) {
+ require_once('code/db_connect.php');
+ } else {
+ die("session.php requires a file db_connect.php or that you call db_connect() first. See code/wfpl/db.php for more information.");
+ }
+}