Banshee
the secure PHP framework

Forum

Slimstats (_lib/functions.php) uses wrong DB crede

Error
15 june 2011, 01:10
Banshee version: 3.2

In the file: .../public/slimstats/_lib/functions.php there is a mysql_connect that uses 'db_username' and 'db_password'.
I believe it should use 'slimstat_username' and 'slimstat_password'.

Also in that file the line
return in_array($bool, array(true, YES, "1", "yes", "true", "on"), true);
should be: (quotes around the YES)
return in_array($bool, array(true, "YES", "1", "yes", "true", "on"), true);

Also I see this error on the slimstats page, which I'm not yet sure how to fix:
Notice: Use of undefined constant LOG_DB_QUERIES - assumed 'LOG_DB_QUERIES' in C:\wwwroot\banshee\libraries\database\database_connection.php on line 239

Additionally, Slimstats fails a bunch of PHP strict warnings, but I guess that's not your problem.

Thanks!
--E
Hugo Leisink
15 june 2011, 09:00
The db_username and db_password are correct. I've integrated Slimstat in Banshee and these are the required changes.

There should be no quotes around YES. It's a constant defined in libraries/banshee.php

The LOG_DB_QUERIES notice can be fixed by placing the lines starting at line 239 between this:
if (defined("LOG_DB_QUERIES")) {
...
}

The Slimstat PHP strict warnings should indeed be addressed to the Slimstat author.

And thanks for your feedback!
Error
15 june 2011, 17:44
Thanks for the help. That brings up some questions:

1. When is the slimstat_username used vs. the db_username?
2. The 'YES' without the quotes gave me an 'undefined constant' warning when loading the /slimstat/ page. Is there a missing include or did I do something wrong?

--E
Hugo Leisink
15 june 2011, 17:58
1. slimstat_username is not being used. I've changed this so Slimstat uses the Banshee database settings to connect to the database. One configuration for both.
2. add 'define("YES", 1);' to _lib/functions.php to solve this issue.
Error
16 june 2011, 00:08
1. So should we remove these in settings/website.conf?
SLIMSTAT_USERNAME
SLIMSTAT_PASSWORD

Thanks!

--E
Hugo Leisink
16 june 2011, 08:59
No, those are the username and password that can be used at the login page to enter Slimstat without entering the CMS. The db_username in _lib/functions.php are the username and password needed to connect to the database.

We have two username-password combinations here. One for a user to access Slimstat and one for Slimstat to access the database. Don't mix them up!
Message preview

The following BB-codes are available in a message:

  • [b]Bold text[/b]
  • [center]Center text or imagen[/center]
  • [color=color name or #RGB code]Colored text[/color]
  • [i]Italic text[/i]
  • [img]Link to image[/img]
  • [right]Align text or image right[/right]
  • [s]Strike-through text[/s]
  • [size=pixelsize]Big or small text[/size]
  • [u]Underlined text[/u]
  • [url]Link to website[/url]
  • [url=link to website]Link text[/url]