HOW TO GET A PAGE ON YOUR WEBSITE WHERE PEAPLE GO AND SELECT A ITEM AND GETS MAILED TO THEM!
I actually wrote this last night. So far it's worked every time. What I did first was create a new character named "Mailer" (you can call it whatever you want of course). The page adds items to Mailer's inventory, then mails them from his inventory to the player you want to send it to. Here's the code. Just replace your DB information
<html><head><title>Create an Auction on Game Mastas WoW Server</title></head>
<body>
<br><br>
<?php
?>
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=GET>
<center>
<table width=600 height=492><tr><td><center>
<table>
<tr><td><center>Item</center></td></tr>
<tr><td><center><INPUT TYPE="TEXT" NAME="item"></center></td></tr>
<tr><td><center>Send To</center></td></tr>
<tr><td><center><INPUT TYPE="TEXT" NAME="recipient"></center></td></tr>
<tr><td><center><INPUT TYPE="SUBMIT" NAME="send" VALUE="Submit"></FORM></center></td></tr>
</table></center></td></tr></table>
<?php
$endTime = round(microtime(true));
$db = @mysql_connect(localhost, login, pass);
if (!$db) {
echo( "<P>Unable to connect to the " .
"database server at this time.</P>" );
exit();
}
if (!@mysql_select_db("antrix2") )
{
echo( "<p>Unable to connect to the Antrix database</p>" );
exit();
}
if ("Submit" == $send) {
$charNum = mysql_query("SELECT guid FROM characters WHERE Name = '$recipient'");
$charNum = mysql_fetch_array($charNum);
$result = mysql_query("SELECT max(guid) as maxguid FROM playeritems");
$row = mysql_fetch_assoc($result);
$itemGUID = $row[maxguid] + 1;
$result = mysql_query("SELECT max(slot) as maxslot FROM playeritems WHERE ownerguid = '333'");
$row = mysql_fetch_array($result);
$itemSlot = $row[maxslot] + 1;
if($itemSlot < 24) $itemSlot = 23;
$result = mysql_query("SELECT max(message_id) as mid FROM mailbox");
$row = mysql_fetch_array($result);
$messageID = $row[mid] + 1;
$add = "INSERT INTO playeritems SET " .
"ownerguid=333, " .
"guid='$itemGUID', " .
"entry='$item', " .
"count=1, " .
"slot='$itemSlot'";
$sql = "INSERT INTO mailbox SET " .
"message_id='$messageID', " .
"player_guid='$charNum[guid]', " .
"sender_guid=333, " .
"subject='Attached Item', " .
"attached_item_guid='$itemGUID', " .
"stationary=41, " .
"delivery_time='$endTime'";
if(mysql_query($add) && mysql_query($sql)) {
echo("<p>Item sent.</p>");
} else {
echo("<p>Error sending item: " . mysql_error() . "</p>");
}
}
?>
</font>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-289644-4";
urchinTracker();
</script>
</body>
</html>
Oh yeah. Make sure the player guid matches the one in the code. Either make a character with guid 333, or change the 333 to something else.
My only problem now: I can't get antrix to reload the mail table. grr
Edit: This works with BoP items as well. I tried sending things like Staff of Westfall, Ring of the Martyr, etc, and they all work. That's actually why I created the page. I had someone who wanted an item that at the time wasn't in the database (Swift Nether Drake, item 30609). So I added the item, but he hasn't logged on yet. Since I couldn't just .additem, I decided to mail it to him - so I had to come up with a way. lol
Here's a screenshot. I guess I do have to add code to figure out durability. I don't have time right now, but if you want to add it, you can just make the current durability = MaxDurability from the items table.