vBulletin Modifications

Integration with vBulletin - simple question: query the database

Welcome to vBHackers.com! - vBHackers Updates:

Go Back   vBulletin Modifications > General vBulletin Section > vBulletin Hacker Forum

Reply
 
LinkBack Thread Tools
Old 02-09-2008, 03:00 AM   #1
vB Newbie
Join Date: May 2007
anarchoi is on a distinguished road

Default Integration with vBulletin - simple question: query the database

Hi,

since a few months i started adding php codes almost everywhere INSIDE of the templates in VB (i use a hack that allows php code in templates since i don't know **** about plugins/products/hooks)

But i added a LOT of queries everywhere... and since i'm not familiar with vb variables i add my own queries and connections to the database.... I'm starting to think this could be a security hole if i ever have a mod who has access to the templates editing...

I have codes like this on a lot of pages:
Quote:
$server = "localhost";
$user = "me";
$password = "my_pass";
$database = "my_db";
mysql_connect($server, $user, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
could anyone suggest me an example code that uses VB variables and would allow me to not have to add my db's username and password every time?

thanks!




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 02-09-2008, 03:29 AM   #2
Michael Biddle
Administrator
Michael Biddle's Avatar
Join Date: Feb 2005
Real Name: Michael Biddle
Location: Anaheim
Michael Biddle is on a distinguished road

Default

Well include global.php. That saves all the db info.
__________________
Support will ONLY be offered through forums


Michael Biddle / vBHackers.com
vBSEO 3.1 GOLD Released vB Blogs Compatible | Non-Encrypted | Branding Removal Option | Sitemaps 2.1 | Language Packs

Crawlability Network: vBulletin SEO | vBulletin Hackers
Affiliates: vBulletinSetup
Are you interested in a Recipe mod for vBulletin
Free Modifications: Latest X Posts on Forumhome | Default Signature | Default Signature Per Usergroup




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-09-2008, 05:20 AM   #3
vB Newbie
Join Date: May 2007
anarchoi is on a distinguished road

Default

and what variables would replace $server, $user, $password and $database ?

or is there a function that will do all the mysql_connect things for me ?




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-09-2008, 07:00 PM   #4
Michael Biddle
Administrator
Michael Biddle's Avatar
Join Date: Feb 2005
Real Name: Michael Biddle
Location: Anaheim
Michael Biddle is on a distinguished road

Default

You should be already connected. To read from the database it would be like $vbulletin->db->query_read/first/write, etc.
__________________
Support will ONLY be offered through forums


Michael Biddle / vBHackers.com
vBSEO 3.1 GOLD Released vB Blogs Compatible | Non-Encrypted | Branding Removal Option | Sitemaps 2.1 | Language Packs

Crawlability Network: vBulletin SEO | vBulletin Hackers
Affiliates: vBulletinSetup
Are you interested in a Recipe mod for vBulletin
Free Modifications: Latest X Posts on Forumhome | Default Signature | Default Signature Per Usergroup




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-11-2008, 02:16 AM   #5
vB Newbie
Join Date: May 2007
anarchoi is on a distinguished road

Default

so i'm supposed to use something like $vbulletin->db->query_read "SELECT myfield FROM mytable" for my queries ?

i'm a bit confused




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply




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

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

BB 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
Database question? blowfish General vBulletin Support 1 05-01-2007 08:50 PM
simple session/cookie question bitHacker General vBulletin Support 2 03-21-2007 07:29 PM
database question world32 General vBulletin Support 7 07-02-2006 07:02 AM
[vb help] simple question hkboi General vBulletin Support 10 01-25-2005 01:35 AM
Just a simple question... Infamouz Nex General vBulletin Support 2 04-15-2004 06:05 AM


All times are GMT -3. The time now is 08:13 PM.


SEO by vBSEO 3.1.0 ©2007, Crawlability, Inc. (Patent Pending)