Hi (sorry for bad English :c) I have a trouble in my code. There are two versions of site in web - dev and main. Both use php 5.4 and have one host provider. But in dev site all work well and on main - not. So about problem I'm use XMLHttpRequest to send ajax requests to php file, that included in start other file (head of ajax controller). Here source of this (last) file :
<?PHP
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__).'/../../../../../' );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
JFactory::getApplication('site')->initialise ();
$user = JFactory::getSession()->get( 'user' );
$___temp_user =& JFactory::getUser();
$user_id = $___temp_user->get('id');
but, how i said, on main $___temp_user return 0; (im loggined in) please, tell me why this happen.
(Joomla 1.5.9)
This code
define('JPATH_BASE', dirname(__FILE__).'/../../../../../' );
Should not be same for both the sites.
Doubly check the path or do a
var_dump(JPATH_BASE); exit;
You can also give hardcoded path of your joomla installation like
define('JPATH_BASE', '/var/www/joomla' );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.