X-Git-Url: http://git.pjr.cc/?p=ga4php.git;a=blobdiff_plain;f=authserver%2Flib%2Flib.php;h=52f09cafb19b52965ab846c951ac1156483cd92e;hp=02be05934f550accd89dd7ce6a56a09784e4a3aa;hb=fd26ac6447a5c17ea654dcaa0a80a2a727ea4fe5;hpb=d4590a3f34021216c9da29786922fddaf804d113 diff --git a/authserver/lib/lib.php b/authserver/lib/lib.php index 02be059..52f09ca 100644 --- a/authserver/lib/lib.php +++ b/authserver/lib/lib.php @@ -17,6 +17,10 @@ define("MSG_GET_OTK_PNG", 10); define("MSG_GET_OTK_ID", 11); define("MSG_DELETE_USER_TOKEN", 12); +// BASE_DIR = +$BASE_DIR = realpath(dirname(__FILE__)."/../../"); +global $BASE_DIR; + // messy require_once(dirname(__FILE__)."/../../lib/ga4php.php"); @@ -35,15 +39,16 @@ function generateRandomString() function getDatabase() { $dbobject = false; - if(file_exists("gaasdata.sqlite")) { + global $BASE_DIR; + if(file_exists("$BASE_DIR/authserver/authd/gaasdata.sqlite")) { try { - $dbobject = new PDO("sqlite:gaasdata.sqlite"); + $dbobject = new PDO("sqlite:$BASE_DIR/authserver/authd/gaasdata.sqlite"); } catch(PDOException $exep) { error_log("execpt on db open"); } } else { try { - $dbobject = new PDO("sqlite:gaasdata.sqlite"); + $dbobject = new PDO("sqlite:$BASE_DIR/authserver/authd/gaasdata.sqlite"); } catch(PDOException $exep) { error_log("execpt on db open"); }