miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Specific miniBB Support Forums / Specific /  
 

Retreaving user name

 
Author LeeuW
Partaker
#1 | Posted: 27 Aug 2006 15:19 
I have miniBB in a subdirecotory of my site.

I use the function below to read out the usernamen from the session.

function getUserName(){
if(isset($_SESSION['minimalistBBSession'])) {
$cookievalue=explode ('|', $_SESSION['minimalistBBSession']);
if(!ini_get('magic_quotes_gpc')) $cookievalue[0]=addslashes($cookievalue[0]);
$cookievalue[1]=str_replace("'",'',$cookievalue[1]);
}
else $cookievalue=array('','','');
return $cookievalue[0];
}

But it only works inside the miniBB dir, how can i make it work outside that dir?

Author Paul
Lead Developer 
#2 | Posted: 28 Aug 2006 08:27 
Probably, your server's configuration allows read the session variables only from the folder, where they've been set up. There is no solution except that you need to change configuration in the server itself.

Author LeeuW
Partaker
#3 | Posted: 30 Aug 2006 12:29 
session.cookie_path = /
I guess that means that is not the problem.

Author Paul
Lead Developer 
#4 | Posted: 30 Aug 2006 17:04 
So, why you are reading $_SESSION variable? By default, miniBB uses cookies (and we recommend to disable sessions, since using cookies is enough). It only will work if you have $useSessions=TRUE; in setup_options.php. Do you have this setting enabled? Or you can try to disable it and try with $_COOKIE... the same way as it is in bb_cookie.php

Author hackersapien
Partaker
#5 | Posted: 4 Sep 2006 08:00 
I'm also having a similar problem as LeeuW, my forum is located in subfolder /forum, when I try and access the cookies set by the forum in the main site folder it comes back blank, I 've tried using:

print_r($_COOKIE);

But still it comes back empty, If I change the cookie path to "/" the login in the forum refuses to work completely.

Any Ideas on how to solve this?

Author hackersapien
Partaker
#6 | Posted: 4 Sep 2006 08:45 
I solved the problem by modifying the setMyCookie() method in the bb_cookie.php file, I added the following code while stil retaining the existing code:

setcookie($GLOBALS['cookiename'], $userName.'|'.$userPass.'|'.$userExpTime, $GLOBALS['cookieexptime'], '/', $GLOBALS['cookiedomain'], $GLOBALS['cookiesecure']);

This sets a cookie that is accessible from the "/" path, I can now access the cookie from whichever directory I chose.

I also had to modify the deleteMyCookie() method to destroy the cookie:

setcookie($GLOBALS['cookiename'], '', (time()-2592000), '/', $GLOBALS['cookiedomain'], $GLOBALS['cookiesecure']);

Author Paul
Lead Developer 
#7 | Posted: 4 Sep 2006 09:26 
Don't know why you needed to edit these functions, if $cookiepath setting is given in setup_options.php ;-)

Specific miniBB Support Forums / Specific /
 Retreaving user name
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Proceed with the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑