Jump to content

[PATCH] External Mail from SQL


Recommended Posts

  • Replies 104
  • Created
  • Last Reply

Top Posters In This Topic

I will test this on one of our development servers and let you know asap diablox.

EDIT - It works perfectly, except for the fact that it wont show the mail until you relog which isn't THAT big of a deal, but im more than sure that, that can be fixed.. Any ideas?

Link to comment
Share on other sites

Bumps, i have a quesiton with the last patch, in my script PhP how have the good id mail_external with the good mail_id mail_external_items ?

I make this bur it's not good because the mail_id it's always = 0 >< ...

mysql_query("INSERT INTO mail_external (`id`, `receiver`, `subject`, `message`, `money`) VALUES
('', $guid, 'Items', 'Thanks for your items', 0)");

$mail_id_num = mysql_query("SELECT id FROM mail_external WHERE receiver='$guid'") or die("ERREUR SQL!!");    

mysql_query("INSERT INTO mail_external_items (`id`, `mail_id`, `item`, `count`) VALUES
('', '$mail_id_num', 29434, 10)");

Thanks if you can help :)

Link to comment
Share on other sites

$mail_id_num = mysql_query("SELECT id FROM mail_external WHERE receiver='$guid'") or die("ERREUR SQL!!");    

You don't need use SELECT query , use this php function is the best way : mysql_insert_id
mysql_query("INSERT INTO mail_external_items (`id`, `mail_id`, `item`, `count`) VALUES
('', '$mail_id_num', 29434, 10)");

However the problem is here, you insert a SELECT result . You need a variable whith mysql_result. exemple : $mail_id_num_2 = mysql_result($mail_id_num,0); and add variable in mysql_query : mysql_query("INSERT INTO mail_external_items (`id`, `mail_id`, `item`, `count`) VALUES

('', '$mail_id_num_2', 29434, 10)"); but whith mysql_insert_id it's better.:)

Link to comment
Share on other sites

Bumps, i have a quesiton with the last patch, in my script PhP how have the good id mail_external with the good mail_id mail_external_items ?

I make this bur it's not good because the mail_id it's always = 0 >< ...

mysql_query("INSERT INTO mail_external (`id`, `receiver`, `subject`, `message`, `money`) VALUES
('', $guid, 'Items', 'Thanks for your items', 0)");

$mail_id_num = mysql_query("SELECT id FROM mail_external WHERE receiver='$guid'") or die("ERREUR SQL!!");    

mysql_query("INSERT INTO mail_external_items (`id`, `mail_id`, `item`, `count`) VALUES
('', '$mail_id_num', 29434, 10)");

Thanks if you can help :)

That is not the best way to send mail. Insert mail is done this way

mysql_query('INSERT INTO mail_external (`receiver`, `subject`, `message`, `money`) VALUES
('.$reciver_guid.', "'.$subject.'", "'.$message.'", '.$money.')')or die(mysql_error());
$mail_id = mysql_insert_id();
mysql_query('INSERT INTO mail_external_items (`mail_id`, `item`, `count`) VALUES
('.$mail_id.', '.$item_id.', '.$count.')')or die(mysql_error());

Link to comment
Share on other sites

I also had the problem that you need to relog with the original patch I wrote, any idea why that happens ?

You need to modify the mail function , I think maybe he check mail that the player send just a login in . You need analyse the code for auction house because the mail that is sent when the player buy is immediat.

Link to comment
Share on other sites

Thanks i need Send Item or Money to the TABLE mail_external and mail_external_items

To Send Item or money :

<?php
//Variable
$receiver="The guid of character";
$subject="Subject of mail";
$message="The content mail whithout special char";
$money="The money that you want send (copper coin) , put 0 if you send just item ";  
$item_id="Your item id that you want send";
$count="The number of item , if you put 2 for example there is 2 x the same item ";
//Sql query
$database = mysql_connect('ip_server', 'login', 'password'); 
mysql_select_db('database name where the table are.',$database);
mysql_query('INSERT INTO mail_external (`receiver`, `subject`, `message`, `money`) VALUES
('$receiver', '$subject', '$message', '$money')');
$mail_id = mysql_insert_id();
mysql_query('INSERT INTO mail_external_items (`mail_id`, `item`, `count`) VALUES
('$mail_id', '$item_id', '$count')');
mysql_close();
?>

Its just the base for send mail , you can improve the code whith dynamic data (and other ) for this you need use form (GET or POST) .

Link to comment
Share on other sites

My web developer made a complete mail index via php that connects the ids of the items to the mail but any who moving on from that.

Im surprised no one has figured out why you have to relog, im beginning to think its just not updating the session to the player.. The other external mail patch let you receive mail while logged in so something must be missing to update the player and say "hey you gots mail" sad thing is i haven't looked at it hard enough to see why it isn't pushing to the player unless they relog and it reloads all there mail, and other junk.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use