PDA

View Full Version : Update database from external pages?


forcerm
07-01-2011, 03:46 PM
My whole website is powered by vbulletin using the global.php hack at the top of pages

i can pull from the database using lines such as:

vbulletin->db->query_read("SELECT username FROM user WHERE postid = 1");

but how can i update the database?

i want to allow users to change the styleid from an external page, thus needing to change the styleid cell in user table.

i thought i would just be able to link to forum.php?styleid=2 etc but this only changes the style for that session, after logout and log back in it goes back to the style set in options.

Adrian Schneider
07-01-2011, 04:27 PM
This should work...


vbsetcookie('userstyleid', $styleid);

$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET styleid = $styleid
WHERE userid = $userid
");