History of SetupMSSQL
Version 9
SetupMSSQL
Instructions on how to setup BitWeaver on Microsoft SQL Server
Created by: Chris Ruggles, Last modification: 02 Aug 2005 (05:15 UTC) by Chris Ruggles
(UNDER DEVELOPMENT)
You should first read How to install Bitweaver under IIS 5 (InstalIIS).
This guide assumes (and has been tested on):
Firstly, create a new database in Enterprise Manager (SQL Server) or another tool (MSDE does not ship with Enterprise Manager). A good, free one is DBA Manager 2k. It can be called anything you like, I called mine 'BitWeaver'.
Create a new login in your database with the same name as the IIS anonymous user (default is 'servername\IUSR_servername'). Give that user the sysadmin server role and db_owner role on the database you just created.
Add 'extension=php_mssql.dll' to the extensions section of php.ini.
I had to set up IIS to use ISAPI - don't remember atm if this was a MSSQL-specific thing or just a Windows / IIS specific thing, see InstalIIS.
Some modifications were made to the following files to get BitWeaver working:
in /util/phpsniff/phpSniff.class.php, change "HTTP_SERVER_VARS" to "_SERVER" on line 188, eg:
{CODE()}$UA = ( $pv0 > 3 && $pv1 > 0 ) ? $_SERVERHTTP_USER_AGENT>'HTTP_USER_AGENT' : $HTTP_SERVER_VARSHTTP_USER_AGENT>'HTTP_USER_AGENT';{CODE}
to
{CODE()}$UA = ( $pv0 > 3 && $pv1 > 0 ) ? $_SERVERHTTP_USER_AGENT>'HTTP_USER_AGENT' : $_SERVERHTTP_USER_AGENT>'HTTP_USER_AGENT';{CODE}
added this below "case "mssql"" in "function convertQuery" (about line 552, /kernel/BitDb.php):
{CODE()}
$pQuery = preg_replace("/`/", "", $pQuery);
$pQuery = str_replace("AS user,", "AS user_login,", $pQuery);
$pQuery = str_replace("=? ASC", " ASC", $pQuery);
$pQuery = str_replace("=? DESC", " DESC", $pQuery);
break;
{CODE}
changed this function in /user/BitUser.php (about line 1003):
{CODE()}function isPasswordDue() {
$ret = FALSE;
if( $this->isRegistered() ) {
// get user_id to avoid NULL and zero confusion
$query = "SELECT `user_id`, `pass_due`
FROM `".BIT_DB_PREFIX."users_users`
WHERE `pass_due` IS NOT NULL AND `login`=? ";
$due = $this->GetAssoc( $query, array( (string) $this->mUserId ) );
if( !empty( $dueuser_id>'user_id' ) ) {
$ret = $duepass_due>'pass_due' <= date("U");
}
}
return $ret;
}{CODE}
You should first read How to install Bitweaver under IIS 5 (InstalIIS).
This guide assumes (and has been tested on):
- Windows 2000 Server
- IIS 5.0
- MSDE (SQL Server 2000 Desktop Edition)
- Bitweaver 1.0.1
- PHP 5.0.4
Firstly, create a new database in Enterprise Manager (SQL Server) or another tool (MSDE does not ship with Enterprise Manager). A good, free one is DBA Manager 2k. It can be called anything you like, I called mine 'BitWeaver'.
Create a new login in your database with the same name as the IIS anonymous user (default is 'servername\IUSR_servername'). Give that user the sysadmin server role and db_owner role on the database you just created.
Add 'extension=php_mssql.dll' to the extensions section of php.ini.
I had to set up IIS to use ISAPI - don't remember atm if this was a MSSQL-specific thing or just a Windows / IIS specific thing, see InstalIIS.
Some modifications were made to the following files to get BitWeaver working:
in /util/phpsniff/phpSniff.class.php, change "HTTP_SERVER_VARS" to "_SERVER" on line 188, eg:
{CODE()}$UA = ( $pv0 > 3 && $pv1 > 0 ) ? $_SERVERHTTP_USER_AGENT>'HTTP_USER_AGENT' : $HTTP_SERVER_VARSHTTP_USER_AGENT>'HTTP_USER_AGENT';{CODE}
to
{CODE()}$UA = ( $pv0 > 3 && $pv1 > 0 ) ? $_SERVERHTTP_USER_AGENT>'HTTP_USER_AGENT' : $_SERVERHTTP_USER_AGENT>'HTTP_USER_AGENT';{CODE}
added this below "case "mssql"" in "function convertQuery" (about line 552, /kernel/BitDb.php):
{CODE()}
$pQuery = preg_replace("/`/", "", $pQuery);
$pQuery = str_replace("AS user,", "AS user_login,", $pQuery);
$pQuery = str_replace("=? ASC", " ASC", $pQuery);
$pQuery = str_replace("=? DESC", " DESC", $pQuery);
break;
{CODE}
changed this function in /user/BitUser.php (about line 1003):
{CODE()}function isPasswordDue() {
$ret = FALSE;
if( $this->isRegistered() ) {
// get user_id to avoid NULL and zero confusion
$query = "SELECT `user_id`, `pass_due`
FROM `".BIT_DB_PREFIX."users_users`
WHERE `pass_due` IS NOT NULL AND `login`=? ";
$due = $this->GetAssoc( $query, array( (string) $this->mUserId ) );
if( !empty( $dueuser_id>'user_id' ) ) {
$ret = $duepass_due>'pass_due' <= date("U");
}
}
return $ret;
}{CODE}