I'm trying to build a registration/login system from this video tutorial series: http://www.youtube.com/watch?v=S6vDgLwJ7n8
I'm early in on this and if I don't get the answer I'm looking for will either 1. Give up or 2. Restart everything. Anyway, here's the error it's giving me:
Notice: Undefined index: CONFIG in C:\xampp\htdocs\php_login\classes\config.php
on line 5
My code:
Config.php :
<?php
class Config {
public static function get($path = null) {
if($path) {
$config = $GLOBALS['CONFIG'];
$path = explode('/', $path);
foreach($path as $bit) {
if(isset($config[$bit])) {
$config = $config[$bit];
}
}
}
return $config;
}
}
index.php:
<?php
require_once 'core/init.php';
echo Config::get('mysql/host'); //'127.0.0.1'
init.php:
$GLOBALS['config'] = array(
'mysql' => array(
'host' => '127.0.0.1',
'username' => 'root',
'password' => '',
'db' => 'login'
),
'remember' => array(
'cookie_name' => 'hash',
'cookie_expiry' => 604800
),
'session' => array(
'session_name' => 'user'
)
);
function autoload($class) {
require_once 'classes/' . $class . '.php';
}
spl_autoload_register('autoload');
#JUST PUTTING THIS SHIT HERE:
//spl_autoload_register(function($class) {
// require_once 'classes/' . $class . '.php';
//});
//Un comment next line!
//require_once 'functions/sanitize.php';