PDA

View Full Version : Database fields


CooganA
13 Mar 2007, 16:28
Hiya

Anyone know what the database table names are and what the fields are?

Anyone have a list of this anywhere? I just want to know which field contains the true/false value for the board being on/offline.

Thanks
Adam

Marco van Herwaarden
13 Mar 2007, 16:54
That is stored in 2 tables: setting & datastore

nexialys
13 Mar 2007, 18:08
basically, there is a "setting" table that store "officially" the settings you set on the adminCP... but in the essence, these settings are stored in the cache called "datastore", so they are loaded quicly at the startup of the process... they can also be stored in the datastore_file if you decide to store them in file... (complicated part)...

even if you edit the "setting" table with your proper detail, the board will continue to read the datastore element only, so you have to enter your admincp and save a setting to make the update.

CooganA
13 Mar 2007, 18:21
I'm new to PHP, so how would I update the datastore database? Does anyone have a little example of updating a table?

And do you know what the field name for the Turn On/Off setting would be?

Thanks
Adam

Marco van Herwaarden
14 Mar 2007, 10:57
Please see: http://www.vbulletin.com/forum/showthread.php?t=213135

CooganA
14 Mar 2007, 11:47
Hi

After lots of trial and error, I finally hacked together some code that turned the board off/on.

Looking at the link you sent me, the code looks a lot cleaner then the one I put together last night.

But all i'm just getting an error:
Parse error: parse error, unexpected T_STRING in myfile.php on line 3

This is the code I'm now trying to use, if you want a laugh the code I hacked together is below that.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



My hacked code:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Marco van Herwaarden
14 Mar 2007, 11:58
Is that the full myfile.php?

PS Why do you use sprintf() to assign a variable?

CooganA
14 Mar 2007, 12:04
Yup, thats the full file at the moment.

The reason I use sprintf() is becuase it seemed to work last night on the code I use. I'm not a PHP developer and this is the first time I've ever had to use PHP.

I'm a Coldfusion and Actionscript 2 developer... so this is all foreign to me at the moment. So any help is grantful!!

Marco van Herwaarden
14 Mar 2007, 12:42
Could you please copy&paste the full error message, as i don't see a line 3 in your code.

CooganA
14 Mar 2007, 13:13
This is line 3:
$query1 = sprintf("UPDATE datastore SET data=REPLACE(data,'"bbactive";i:0;','"bbactive";i:1;') WHERE title='options'");



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Marco van Herwaarden
14 Mar 2007, 13:19
change it to:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Or even better:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

CooganA
14 Mar 2007, 14:14
I'm now getting this error... with both suggestions.

Warning: main(DIR/includes/adminfunctions_misc.php) [function.main]: failed to open stream: No such file or directory in /home/chat/public_html/forums/turnon.php on line 2

Fatal error: main() [function.require]: Failed opening required 'DIR/includes/adminfunctions_misc.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/chat/public_html/forums/turnon.php on line 2

Marco van Herwaarden
14 Mar 2007, 14:24
You must include ./global.php before you can use any of the other vBulletin includes/functions.

CooganA
14 Mar 2007, 17:23
When including ./global.php I seem to get an error when running these as scheduled tasks. But seems to work ok without them. Tho the scheduled task only runs if I click "run now" and doesn't work when a time is set.

Thanks
Adam

Marco van Herwaarden
15 Mar 2007, 08:38
If run as a Scheduled Task, you do not need to include global.php, this is done automatic.