The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Need some help auto-PMing a user
I had this posted in another thread, but it was off topic from the original post...
All I need to know is what exactly is going on in these SQL queries belowso that I can pass the right stuff to the variables to get the PM to go through. Thanks for any help. Quote:
PHP Code:
PHP Code:
PHP Code:
|
#2
|
|||
|
|||
bump? anyone?
|
#3
|
||||
|
||||
well the queries are pretty much self explanatory. The first one ads the PM to the database. The text, sender, reciever, title, icon, whatever is saved here.
The middle one enters a database row with a little less data. This is probably used when displaying the pm folders overview, as the database query gets a lot less intensive. The last one ads a pm to the users pm count. |
#4
|
|||
|
|||
Could someone fill in the values for me for a fake PM? I guess the part I really don't understand is the addslashes and serialze stuff in the first query. Yeah I suck at PHP.
LOL |
#5
|
|||
|
|||
addslashes()
Should be used around all character data when inserting into the datebase to avoid exploits. serialize Used to store and array (or any other var) into a single field keeping the type an attribures. This means that you can later unserialize this single field again into the origianl var. |
#6
|
|||
|
|||
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "pmtext\n\t(fromuserid, fromusername, title, message, touserarray, iconid, dateline, showsignature, allowsmilie)\nVALUES\n\t(1, '" . addslashes(fly) . "', 'test', 'this is a test', '" . addslashes(serialize(1)) . "', 0, " . TIMENOW . ", 0, 1)");
So would that be a valid query for the first one? edit: I guess not. Quote:
|
#7
|
|||
|
|||
I believe it would, yes.
|
#8
|
|||
|
|||
Quote:
Now I don't get an error, but cant see the message inserted. =( |
#9
|
||||
|
||||
'fraid I don't think that's right. There's a load of logic missing.
The below code is untested but I think shoudl work. There's nothing in the way of email notification or read receipts in there. James PHP Code:
|
#10
|
|||
|
|||
Sweet! That was it. Initally I hadn't listed the other queries because I wanted to get the first one right. I really need to figure out how arrays work. LOL
Here was my final code. The only thing you missed was adding to the recipients unread totals, and I wanted a pmpopup... PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|