php - Drupal - using boostrap to check logged in user outside of Drupal not working -


I'm trying to figure it out. I can not get boothrap to work properly when the drupal is out of the dior. It works fine if I run this code in Drupal dir but does not work up a level.

My lookup path is / public_html / drupal / I am running script / public_html.

The $ user logged user is not returning. I've ensured that this is not a cross-domain issue (i.e. www.domain.com vs domain.com).

  chdir ('/ path / to / drupal'); Include_once (include './/bootstrap.inc'); Drupal_bootstrap (DRUPAL_BOOTSTRAP_FULL); Global $ user; If ($ user-> UID) {print "log in"; } Other {print "logout"; }  

If the user is not recognized by Drupal in your separate script, then the possibilities There are more that it does not get the proper session cookie You should check the cookies set by your normal dryup installation and see if they also send it to your script. If not, then check the $ cookie_domain variable in your Drupals settings.php - it is commented appropriately, but you may need to set it explicitly in your case.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -