Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-13-2007, 02:28 PM
CooganA CooganA is offline
 
Join Date: Mar 2007
Location: London, England
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Database fields

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
Reply With Quote
  #2  
Old 03-13-2007, 02:54 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That is stored in 2 tables: setting & datastore
Reply With Quote
  #3  
Old 03-13-2007, 04:08 PM
nexialys
Guest
 
Posts: n/a
Default

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.
Reply With Quote
  #4  
Old 03-13-2007, 04:21 PM
CooganA CooganA is offline
 
Join Date: Mar 2007
Location: London, England
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #5  
Old 03-14-2007, 08:57 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please see: http://www.vbulletin.com/forum/showthread.php?t=213135
Reply With Quote
  #6  
Old 03-14-2007, 09:47 AM
CooganA CooganA is offline
 
Join Date: Mar 2007
Location: London, England
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
PHP Code:
require_once(DIR '/includes/adminfunctions_misc.php');
$query1 sprintf("UPDATE datastore SET data=REPLACE(data,'"bbactive";i:1;','"bbactive";i:0;') WHERE title='options'");
$query2 sprintf("UPDATE setting SET value=0 WHERE varname='bbactive'");
mysql_query($query1);
mysql_query($query2);
?> 
My hacked code:
PHP Code:
<?php
// ########################## REQUIRE BACK-END ############################

require_once(DIR '/includes/adminfunctions_misc.php');


// Formulate Query
// This is the best way to perform a SQL query
// For more examples, see mysql_real_escape_string()
$query sprintf("SELECT data FROM datastore WHERE title='options'");

// Perform Query
$result mysql_query($query);

if (!
$result) {
   echo 
'Could not run query: ' mysql_error();
   exit;
}
/**/ if (mysql_num_rows($result) > 0) {
   while (
$row mysql_fetch_assoc($result)) {
       
print_r($row);
       print 
"<BR><BR><BR>";
       Print 
$result[data];
       
$tempDataStore str_replace('"bbactive";i:1;','"bbactive";i:0;'$row['data']);
       Print 
$tempDataStore;
      
// echo $row['data'];
   
}
}

mysql_free_result($result);

$query sprintf("UPDATE datastore SET data = '$tempDataStore;' WHERE title='options'");

// Perform Query
$result mysql_query($query);

?>
Reply With Quote
  #7  
Old 03-14-2007, 09:58 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is that the full myfile.php?

PS Why do you use sprintf() to assign a variable?
Reply With Quote
  #8  
Old 03-14-2007, 10:04 AM
CooganA CooganA is offline
 
Join Date: Mar 2007
Location: London, England
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!!
Reply With Quote
  #9  
Old 03-14-2007, 10:42 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could you please copy&paste the full error message, as i don't see a line 3 in your code.
Reply With Quote
  #10  
Old 03-14-2007, 11:13 AM
CooganA CooganA is offline
 
Join Date: Mar 2007
Location: London, England
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

PHP Code:
<?php
require_once(DIR '/includes/adminfunctions_misc.php');
$query1 sprintf("UPDATE datastore SET data=REPLACE(data,'"bbactive";i:0;','"bbactive";i:1;') WHERE title='options'");
$query2 sprintf("UPDATE setting SET value=1 WHERE varname='bbactive'");
mysql_query($query1);
mysql_query($query2);
?>
Reply With Quote
Reply


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

Forum Jump


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


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06884 seconds
  • Memory Usage 2,267KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (9)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete