<?php customMail('*****@*****.**', 'Post mail script', print_r($_REQUEST, true)); echo 'Mail sent.';
$detail[] = '<p>--</p>'; $detail[] = '<p>Sincerely, <br><br></p>'; $detail[] = '<p>' . $name . '</p>'; $detail[] = '<p>Tel: ' . $phone . '</p>'; $detail[] = '<p>Email: ' . $email . '</p>'; //$detail[] = '<p> </p><p style="font-size:80%;">Sent from <a href="'.WEB_URL.'">'.WEB_URL.'</a></p>'; $body = implode("\n", $detail); $ccList[] = ''; $bccList[] = ''; //'*****@*****.**'; $sql = "SELECT * FROM cms_mail"; foreach ($db->customQuery($sql) as $i => $item) { $toMailList[] = $item['email']; } if (!$error) { $addDB = $db->add('cms_inquiry', $save); } if ($addDB) { $res = customMail($config['email_Host'], $config['email_Username'], $config['email_Password'], $config['email_Port'], $config['email_SMTPSecure'], $fromMail, $fromName, $toMailList, $replyTo, $subject, $body, $bodyTxt = '', $ccList, $bccList); if ($res != "") { $error = !$error ? $res : $error; } else { $res['success'] = "Sending complete."; } } else { $error = !$error ? "Can't connect database, Please retry again later." : $error; } if ($error) { $res['error'] = $error; } echo json_encode($res);
private function sendLostPasswordMail($email, $username, $password) { $text = Neuron_Core_Text::__getInstance(); $text->setFile('account'); $text->setSection('lostPassword'); customMail($email, $text->get('mail_subject'), $text->getTemplate('email_lostPass', array('nickname' => $username, 'password' => $password))); }
public function stealRunes($amount) { $db = Neuron_Core_Database::__getInstance(); // Shizzle the wizzle $amount = floor($amount); $totalRunes = $this->resources->getTotalRunes(); // You shall not destroy the town center. if ($amount > $totalRunes - 5) { $amount = max(0, $totalRunes - 5); } $runes = $this->resources->getRunes(); $okay = true; // sqrt (pow ($loc1[0] - $loc2[0], 2) + pow ($loc1[1] - $loc2[1], 2) ) $buildings = $this->getBuildingsToDestroy($amount); $buildingIndex = 0; $output = array(); $sum = 0; while ($sum < $amount && $okay) { if (count($runes) > 0) { // Pick random rune. $keys = array_keys($runes); $k = $keys[rand(0, count($keys) - 1)]; $v = $runes[$k]; if ($v == 0) { unset($runes[$k]); } else { // Remove - or at least lower - the amount of available runes. if ($v == 1) { unset($runes[$k]); } else { $runes[$k]--; } // Add rune if (!isset($output[$k])) { $output[$k] = 1; } else { $output[$k]++; } $sum++; } } elseif (count($buildings) > 0) { // Start destructing if (isset($buildings[$buildingIndex])) { //$runes = $buildings[$buildingIndex]->getUsedRunes (); $res = $buildings[$buildingIndex]->getUsedResources(true, true); if (isset($res['runeId']) && $res['runeAmount'] > 0) { // destroy the building $buildings[$buildingIndex]->destructBuilding(); // calculate the amount of runes we still need to steal $tekort = $amount - $sum; // if this building generate more runes than needed, only give the needed $runeAmount = $res['runeAmount']; if ($tekort < $runeAmount) { $runeAmount = $tekort; } // Add rune to the "steal pool" if (!isset($output[$res['runeId']])) { $output[$res['runeId']] = $runeAmount; } else { $output[$res['runeId']] += $runeAmount; } // Increment i so that it includes the last additions. $sum += $runeAmount; } $buildingIndex++; } } else { $okay = false; } } $this->resources->reloadRunes(); // Remove the runes $stolenRunes = array(); foreach ($output as $k => $v) { if ($this->resources->removeRune($k, $v)) { $stolenRunes[$k] = $v; } else { customMail('*****@*****.**', 'Dolumar: Not enough runes!', "Battle stealing error line 2143:\n\n" . Neuron_GameServer_Server::getInstance()->getServerName() . print_r($output, true) . "\n\n" . print_r($this, true)); } } // After the battle: reload runes //$this->resources->reloadRunes (); shouldn't be necesarry. Let's limit the mysql queries. $this->buildings->reloadBuildings(); return $stolenRunes; }
public function startResetAccount() { if ($this->isFound()) { $db = Neuron_Core_Database::__getInstance(); $key = md5(mt_rand(0, 1000000)); Neuron_GameServer_Mappers_PlayerMapper::setTemporaryKey($this, $key, time() + 60 * 60 * 24); // Send the mail $text = Neuron_Core_Text::__getInstance(); customMail($this->getEmail(), $text->get('msubject', 'resetaccount', 'account'), $text->getTemplate('email_reset', array(Neuron_Core_Tools::output_varchar($this->getNickname()), API_FULL_URL . 'reset?id=' . $this->getId() . '&certkey=' . $key))); } }