global $portalInfo;
$_SESSION['isSQLConfigCorrect'] = TRUE;
//require_once(PATH_TO_CORE.'../sql_connect.php');
//require_once(PATH_TO_CORE.'../sql_config.php');
include_once("sql_config.php");
$portalInfo['dbhost'] = "172.24.17.117";
//print_r($portalInfo);
//global $conn;
$conn = mysqli_connect($portalInfo['dbhost'], $portalInfo['dbuser'], $portalInfo['dbpass'], $portalInfo['database']);
mysqli_select_db($conn, $portalInfo['database']);
$portalInfo['connect'] = $conn;
/*
echo "
db selected=" . $portalInfo['database'];
echo "
conn=";
//echo $conn;
if (!$conn) {
echo "
error=";
echo mysqli_connect_error();
} else {
echo "conn is not false";
}
*/
/*
$s_sql = "SELECT * FROM school";
$s_result = mysqli_query($conn, $s_sql);
while ($s_info = mysqli_fetch_assoc($s_result)){
print_r($s_info);
}
*/
if ($conn == FALSE AND function_exists('sqlConnect')) {
$_SESSION['isSQLConfigCorrect'] = FALSE;
if($_SERVER['SERVER_ADDR'] != '127.0.0.1')
echo "
";
echo "conn have failed to connect and going back to old connection method.";
if($_SERVER['SERVER_ADDR'] != '127.0.0.1')
echo "
";
$conn = sqlConnect( $portalInfo['database'] );
}
if ($_SESSION['isSQLConfigCorrect']) {
global $conn;
$_SESSION['connect'] = $conn;
$portalInfo['connect'] = $conn;
//echo "
connected - " . $portalInfo['connect'];
}
/*
if (function_exists('sqlConnect'))
//
else
{
// BITS modification for cascading database servers
$dbhost = 'localhost';
$dbuser = $portalInfo['dbuser'];
$dbpass = $portalInfo['dbpass'];
$dbname = $portalInfo['database'];
//Connect to mysql server
//$conn = mysqli_pconnect($dbhost, $dbuser, $dbpass)
or die ('Error connecting to mysql');
//Select the appropriate database
mysqli_select_db($dbname);
}
*/
if ($_SERVER['SERVER_ADDR'] == "127.0.0.1") {
//echo "This message only shows up in local testing.
\n You are connected through the file elport/include/digiportMachine.inc.
\n There is no need to create a new connection if you are seeing this, unless $conn is closed. ";
}
?>
//some definitions
//PC = Permission Code
define("PC_STUDENT","S");
define("PC_DPSUPPORT","V");
define("PC_TEACHER","T");
define("PC_SCHOOLADMIN","A");
define("PC_DPADMIN", "D");
define("PC_ICONADMIN","I");
define("PC_PARENT","P");
define ('DS','/');
//define('DS','\\');
$rootpath = '../data/';
$rootpath_loc = '../data/';
//if ($portalInfo['datadir'] == 'nhdemo' or $portalInfo['datadir'] == 'hopkinton')
// $rootpath_loc = '../../..'.$rootpath_loc;
if ($portalInfo['database']=='innov_elem'){
$picpath = $rootpath.$portalInfo['datadir'].'/thumbs/';//
}else{
$picpath = $rootpath.$portalInfo['datadir'].'/photos/';//
}
$mediapath = $rootpath.$portalInfo['datadir'].'/media/';
$picpath = $rootpath.$portalInfo['datadir'].'/photos/';
$picpath_loc = $rootpath_loc.$portalInfo['datadir'].'/photos/';
$mediapath_loc = $rootpath_loc.$portalInfo['datadir'].'/media/';
$thumbpath_loc = $rootpath_loc.$portalInfo['datadir'].'/thumbs/';
$rubric_loc = $rootpath_loc.$portalInfo['datadir'].'/rubric_art/';
//echo 'mediapath=' . $mediapath;
//windows fix
//$rootpath_loc = '..\\data\\';
//$picpath_loc = $rootpath_loc.$portalInfo['datadir'].'\\photos\\';
//$mediapath_loc = $rootpath_loc.$portalInfo['datadir'].'\\media\\';
//*/
?>
SELECT * FROM school_constants