vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   What is wrong with my query? (https://vborg.vbsupport.ru/showthread.php?t=129700)

josiespencer 10-22-2006 04:53 PM

What is wrong with my query?
 
I am not a php coder - I am just trying to do a simple update query:

PHP Code:

$db->query_write("UPDATE " TABLE_PREFIX "forum 
SET password="'george' 
$vbulletin->options['dateformat']" WHERE forumid = '757';"); 

Could anyone please help? I am trying to set a password to george20061022.

Paul M 10-22-2006 05:08 PM

There are a number of errors in that, but first of all it's not going to work even when you correct the syntax as vb does not store passwords directly like that, they are an MD5 hash. Why are you trying to do this ?

josiespencer 10-22-2006 05:47 PM

vBulletin does save the forum passwords like this. I need a password that changes on a specific forum every day. I want to cron it as a task. Could you please offer assistance and not criticism of a feature you obviously have not checked out yourself?

Paul M 10-22-2006 10:07 PM

Nice reply :p

You didn't actually mention this was a forum password in your post and I didn't notice the table name in the SQL - since password questions generally relate to user passwords I mistakenly assumed your request did. :)

Anyway, you are best splitting this into two lines, something like this.

PHP Code:

$pwdate vbdate('Ymd',TIMENOW);
$db->query_write("UPDATE " .TABLE_PREFIX"forum SET password = george{$pwdate} WHERE forumid = 757"); 


josiespencer 10-22-2006 10:35 PM

Quote:

Originally Posted by Paul M
Nice reply :p

You didn't actually mention this was a forum password in your post and I didn't notice the table name in the SQL - since password questions generally relate to user passwords I mistakenly assumed your request did. :)

Anyway, you are best splitting this into two lines, something like this.

PHP Code:

$pwdate vbdate('Ymd',TIMENOW);
$db->query_write("UPDATE " .TABLE_PREFIX"forum SET password = george{$pwdate} WHERE forumid = 757"); 


Since the update was against the forum table to set the password column, how could you not know it was a forum password?

Anyway, thanks for the help, I will try it out.

Paul M 10-22-2006 10:38 PM

Quote:

Originally Posted by josiespencer
Since the update was against the forum table to set the password column, how could you not know it was a forum password?

I believe I mentioned the reason.

Quote:

and I didn't notice the table name in the SQL
:smoke:

josiespencer 10-22-2006 10:52 PM

Sorry, but your code generated an database error:

http://sapsuperusers.com/myPictures/dberror.png

Paul M 10-22-2006 10:54 PM

Ah, forgot the single quotes around the password.

PHP Code:

$pwdate vbdate('Ymd',TIMENOW);
$db->query_write("UPDATE " .TABLE_PREFIX"forum SET password = 'george{$pwdate}' WHERE forumid = 757"); 


josiespencer 10-22-2006 11:06 PM

Excellent! Thanks! That code plus my code makes a perfect sniplet to change the forum's password and then rebuild the forum so the new password will take effect. Croning it for 12:01 at night will force my forum to have a new password everyday!

PHP Code:

$pwdate vbdate('Ymd',TIMENOW);
$db->query_write("UPDATE " .TABLE_PREFIX"forum SET password = 'george{$pwdate}' WHERE forumid = 757");
build_forum_permissions($forum['757']);
vbflush();
unset(
$forum['757'], $vbulletin->forumcache); 



All times are GMT. The time now is 03:12 AM.

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.02736 seconds
  • Memory Usage 1,743KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete