Use of undefined constant
Posted: Sun Jun 29, 2008 1:14 pm
Hello,
Can anyone please help with my problem in php, well i don't understand why am receiving this error, although
the script is running. but this error is there on the top of my page.. check this..
Use of undefined constant FoundModule - assumed 'FoundModule'
Notice: Use of undefined constant INCLUDE_PATH - assumed 'INCLUDE_PATH'
this is the script..
<?
require_once ("set.config.php");
require_once ("Application.php");
require_once ("Autoexec.php");
$db = mysql_pconnect(DB_HOST, DB_USER, DB_PASS) or trigger_error(mysql_error(),E_USER_ERROR);
# Select Database
mysql_select_db(DB_NAME, $db);
$_SERVER['REQUEST_URI'] = strtolower($_SERVER['REQUEST_URI']);
# Chunk URI
$URI = $_SERVER['REQUEST_URI'];
$QUERYSTRING = explode("?", $URI);
$SEGMENTSTRING = explode("/", $QUERYSTRING[0]);
$SEGMENT = (count($QUERYSTRING) > 1) ? array_merge($SEGMENTSTRING, $QUERYSTRING) : $SEGMENTSTRING;
$FoundModule = false;
$ModFile = MOD_PATH . BASE_PAGE;
# Search Segments
for ($cx = 0; $cx < count($SEGMENT); $cx++) {
$FileSearch = MOD_PATH . $SEGMENT[$cx] . ".php";
if (file_exists($FileSearch) ) {
$Class = $SEGMENT[$cx];
$FoundModule = true;
$ModFile = $FileSearch;
$cx++;
break;
}
}
# Include the module File
require_once ($ModFile);
// If Module has found and has method Try to execute it
if (isset($SEGMENT[$cx]) && FoundModule) {
// If Class Exists
if (class_exists($Class)) {
// If Class Exists Include it.
if (isset($Class)) $obj = new $Class();
# Get The parameters
# If method Exists Call it
if (method_exists($obj, $SEGMENT[$cx])) {
$param = array_splice($SEGMENT, $cx+1);
call_user_method_array($SEGMENT[$cx], $obj, $param);
} else {
# If not Exists Try to call it the Class Method it self
if (method_exists($obj, $Class)) {
$param = array_splice($SEGMENT, $cx);
call_user_method_array($Class, $obj, $param);
}
}
# If Class Does not Exists Try Calling a Direct Function
} else
call_user_func_array($SEGMENT[$cx], array_splice($SEGMENT, $cx+1));
} else {
if (isset($Class))
$obj = new $Class();
else {
$Class = "Index";
$obj = new $Class();
}
}
?>
please help me with this one...
Can anyone please help with my problem in php, well i don't understand why am receiving this error, although
the script is running. but this error is there on the top of my page.. check this..
Use of undefined constant FoundModule - assumed 'FoundModule'
Notice: Use of undefined constant INCLUDE_PATH - assumed 'INCLUDE_PATH'
this is the script..
<?
require_once ("set.config.php");
require_once ("Application.php");
require_once ("Autoexec.php");
$db = mysql_pconnect(DB_HOST, DB_USER, DB_PASS) or trigger_error(mysql_error(),E_USER_ERROR);
# Select Database
mysql_select_db(DB_NAME, $db);
$_SERVER['REQUEST_URI'] = strtolower($_SERVER['REQUEST_URI']);
# Chunk URI
$URI = $_SERVER['REQUEST_URI'];
$QUERYSTRING = explode("?", $URI);
$SEGMENTSTRING = explode("/", $QUERYSTRING[0]);
$SEGMENT = (count($QUERYSTRING) > 1) ? array_merge($SEGMENTSTRING, $QUERYSTRING) : $SEGMENTSTRING;
$FoundModule = false;
$ModFile = MOD_PATH . BASE_PAGE;
# Search Segments
for ($cx = 0; $cx < count($SEGMENT); $cx++) {
$FileSearch = MOD_PATH . $SEGMENT[$cx] . ".php";
if (file_exists($FileSearch) ) {
$Class = $SEGMENT[$cx];
$FoundModule = true;
$ModFile = $FileSearch;
$cx++;
break;
}
}
# Include the module File
require_once ($ModFile);
// If Module has found and has method Try to execute it
if (isset($SEGMENT[$cx]) && FoundModule) {
// If Class Exists
if (class_exists($Class)) {
// If Class Exists Include it.
if (isset($Class)) $obj = new $Class();
# Get The parameters
# If method Exists Call it
if (method_exists($obj, $SEGMENT[$cx])) {
$param = array_splice($SEGMENT, $cx+1);
call_user_method_array($SEGMENT[$cx], $obj, $param);
} else {
# If not Exists Try to call it the Class Method it self
if (method_exists($obj, $Class)) {
$param = array_splice($SEGMENT, $cx);
call_user_method_array($Class, $obj, $param);
}
}
# If Class Does not Exists Try Calling a Direct Function
} else
call_user_func_array($SEGMENT[$cx], array_splice($SEGMENT, $cx+1));
} else {
if (isset($Class))
$obj = new $Class();
else {
$Class = "Index";
$obj = new $Class();
}
}
?>
please help me with this one...