Not exactly sure on what bit is causing the error, as im new to php hence why I was following video, but heres code from main file:
<?php
$core_path = dirname(_FILE_);
if (empty($GET['page']) || in_array("{$GET['page']}.page.inc.php", scandir("{$core_path}/pages")) == false){
header('HTTP/1.1 404 Not Found');
header('Location: index.php?page=inbox');
die();
}
session_start();
mysql_connect('127.0.0.1', 'example_user', 'example_pass');
mysql_select_db('private_message_system');
include("{$core_path}/inc/user.inc.php");
if (isset($_POST['user_name'], $_POST['user_password'])){
if (($user_id = validate_credentials($_POST['user_name'], $_POST['user_password'])) !== false){
$_SESSION['user_id'] = $user_id;
header('Location: index.php?page=inbox');
die();
}
}
if (empty($_SESSION['user_id']) && $_GET['page'] !== 'login'){
header('HTTP/1.1 403 Forbidden');
header('Location: index.php?page=login');
die();
}
$include_file = "{$core_path}/pages/{$_GET['page']}.page.inc.php";
?>