Tha basic sheme is
Code:
require_once ... ; // your custom includes and requres here
.... // your custom code which is not using x-cart libraries (can be omited)
chdir( realpath('../shop/').'/'); //changing current directory to x-cart directory (shop in your case)
require_once('auth.php'); // including x-cart core libraries
x_load('lib1');
x_load('lib2');
...
x_load('lib3'); //loading custom x-cart libraries from include/func directory (if required)
.... // your custom code which is using x-cart libraries
http://forum.x-cart.com/showpost.php?p=255489&postcount=3