<?php
spl_autoload_register('myAutoloader');

function myAutoloader($className){
    $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    if(strpos($url, 'include') !== false){
        $path = '../class/';
    } else {
        $path = "class/";
    }
    $extension = ".class.php";
    $fullPath = $path . $className . $extension;
    if(!file_exists($fullPath)){
        return false;
    }

    include_once $fullPath;
}
