Jump to content

Lamerxaker

Members
  • Posts

    1
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Posts posted by Lamerxaker

  1. function send_ingame_mail($to, $from, $subject, $body, $gold = 0, $item = 0, $stack = 1){

    $sql_0->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']);

    $result = $sql_0->query("SELECT MAX(`id`) FROM item_text");

    $item_page_id = ($sql_0->result($result, 0)) + 1;

    $result = $sql_0->query("INSERT INTO item_text (id, text) VALUES

    ($item_page_id,'$body')");

    $result = $sql_0->query("SELECT MAX(`id`) FROM mail");

    $mail_id = ($sql_0->result($result, 0)) + 1;

    $item_guid = ($item) ? gen_item_instance($to, $item, $stack) : 0;

    if ($item == 0) {

    $has_items = 0;

    } else {

    $has_items = 1;

    }

    $result = $sql_0->query("INSERT INTO mail (id,messageType,stationery,mailTemplateId,sender,receiver,subject,itemTextId,has_items,expire_time,deliver_time,money,cod,checked)

    VALUES

    ($mail_id, 0, 61, 0, '$from', '$to', '$subject', '$item_page_id', '$has_items', '".(time() + (30*24*3600))."','".(time()+5)."', '$gold', 0, 0)");

    if ($has_items) {

    $result = $sql_0->query("INSERT INTO mail_items (mail_id,item_guid,item_template,receiver)

    VALUES

    ($mail_id, '$item_guid', '$item', '$to')");

    }

    if ($result) {

    $sql_0->close();

    return $mail_id;

    } else {

    $sql_0->close();

    return 0;

    }

    }

    $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']);

    if($to){ //single Recipient

    $result = $sql->query("SELECT guid FROM `characters` WHERE name ='$to'");

    if ($sql->num_rows($result) == 1) {

    $receiver = $sql->result($result, 0, 'guid');

    $result = $sql->query("SELECT guid FROM `characters` WHERE name ='$user_name'");

    $sender = 0;

    //if ($sql->num_rows($result) == 1) {

    // $sender = $sql->result($result, 0, 'guid');

    //};

    // we need the id of a character, account username is provided atm

    send_ingame_mail($receiver, $sender, $subject, $body, $att_gold, $att_item, $att_stack);

    } else {

    $sql->close();

    echo "error";

    }

    $sql->close();

    echo "error";

    Try opimise this on your site. it's from other project

×
×
  • 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