TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-03-2009, 07:07 PM   #1 (permalink)
The Visitor
 
Join Date: Nov 2009
Posts: 3
Thanks: 0
FrozenGod is on a distinguished road
Help Question | There is a way to make merged login config.php?? (MSSQL+MySQL)

Like i asked in the title, there is a way to make 1 config thad will connect to both MySQL and MSSQL2000??
Like:
PHP Code:
    //    ****** DATABASE TYPE ******
    //    This is the type of the database server on which your vBulletin database will be located.
    //    Valid options are mysql and mysqli, for slave support add _slave.  Try to use mysqli if you are using PHP 5 and MySQL 4.1+
    // for slave options just append _slave to your preferred database type.
$config['Database']['dbtype'] = 'mysql';

    
//    ****** DATABASE NAME ******
    //    This is the name of the database where your vBulletin will be located.
    //    This must be created by your webhost.
$config['Database']['dbname'] = 'dbname';

    
//    ****** TABLE PREFIX ******
    //    Prefix that your vBulletin tables have in the database.
$config['Database']['tableprefix'] = 'main';

    
//    ****** TECHNICAL EMAIL ADDRESS ******
    //    If any database errors occur, they will be emailed to the address specified here.
    //    Leave this blank to not send any emails when there is a database error.
$config['Database']['technicalemail'] = 'email';

    
//    ****** FORCE EMPTY SQL MODE ******
    // New versions of MySQL (4.1+) have introduced some behaviors that are
    // incompatible with vBulletin. Setting this value to "true" disables those
    // behaviors. You only need to modify this value if vBulletin recommends it.
$config['Database']['force_sql_mode'] = false;



    
//    ****** MASTER DATABASE SERVER NAME AND PORT ******
    //    This is the hostname or IP address and port of the database server.
    //    If you are unsure of what to put here, leave the default values.
$config['MasterServer']['servername'] = 'localhost';
$config['MasterServer']['port'] = 3306;

    
//    ****** MASTER DATABASE USERNAME & PASSWORD ******
    //    This is the username and password you use to access MySQL.
    //    These must be obtained through your webhost.
$config['MasterServer']['username'] = 'usename';
$config['MasterServer']['password'] = 'pass';

    
//    ****** MASTER DATABASE PERSISTENT CONNECTIONS ******
    //    This option allows you to turn persistent connections to MySQL on or off.
    //    The difference in performance is negligible for all but the largest boards.
    //    If you are unsure what this should be, leave it off. (0 = off; 1 = on)
$config['MasterServer']['usepconnect'] = 0
Merge it with thad one:
PHP Code:
// MSSQL Database Info

$mssql = array(
                
'host' => "localhost",
                
'user' => "sa",
                
'pass' => "server"
                
); 
I want thad there will be a page thad able to read from vBulletin's tables and write into MSSQL tables on my dedi server.

Thanks,
David.
FrozenGod is offline  
Reply With Quote
Old 11-06-2009, 07:52 AM   #2 (permalink)
The Contributor
 
Join Date: Feb 2009
Posts: 65
Thanks: 0
Krik is on a distinguished road
Default

I am more familiar with MySQL than MSSQL but I have dabbled in several databases in PHP. So what I do know is that you can connect to multiple MySQL databases by using the link_identifier parameter in the mysql_query() function and it appears that mssql_query() has a link_identifier parameter as well.

Now the technique that vBulliten is using is a bit more complex and so here I will just give a simplified example
PHP Code:
$location 'localhost';
$database 'mydb';
$username 'userid';
$password 'userpass';

$open_db mysql_connect($location$username$password);

if (!
$open_db) die ('Could not connect MySQL');
mysql_select_db($database$open_db) or die ('Could not open database');

$qry "
    SELECT *
    FROM `MyTable`
"
;

$results mysql_query($qry$open_db) or die(mysql_error()); 
In the above example note the use of "$open_db" variable in the mysql_query function.
Krik is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Login to Any Account on an Insecure Site Wildhoney Tips & Tricks 18 12-14-2008 09:58 PM


All times are GMT. The time now is 08:04 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design