Used basename() instead of using open_basedir
Removed usage of global
Improved security with (int)