From: Jason Woofenden Date: Mon, 2 Apr 2007 22:46:16 +0000 (-0400) Subject: db_connect.php can now be in code/ X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=commitdiff_plain;h=59c2d4dd864a724f0940405fed4d61bb8aa1864c db_connect.php can now be in code/ --- diff --git a/metaform/template.php b/metaform/template.php index adf4803..5ebf77c 100644 --- a/metaform/template.php +++ b/metaform/template.php @@ -72,8 +72,12 @@ function ~form_name~() { if("you're happy with the POSTed values") { # to enable saving to a database, create a file called 'db_connect.php' # see: code/wfpl/examples/db_connect.php - if(file_exists('db_connect.php')) { - require_once('db_connect.php'); + if(file_exists('db_connect.php') || file_exists('code/db_connect.php')) { + if(file_exists('db_connect.php') { + require_once('db_connect.php'); + } else { + require_once('code/db_connect.php'); + } if($edit_id) { # uploading nothing means leaving it as is. if(!$~name~ && $delete_~name~ != 'Yes') { diff --git a/session.php b/session.php index 07b759a..7f5d52e 100644 --- a/session.php +++ b/session.php @@ -20,7 +20,13 @@ # you'll need this file that calles db_connect() if(!isset($GLOBALS['wfpl_db_handle'])) { - require_once('db_connect.php'); + 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."); + } } # and these database tables: