function SaveTextToFile($datafile, $text, $type = "w") { if (!($handle = fopen($datafile, $type))) { SendMessage($email, "{$subj} Error", "Cannot open file \"{$datafile}\" for write text \"" . $text . "\""); } if (!fwrite($handle, $text)) { SendMessage($email, "{$subj} Error", "Cannot write text \"" . $text . "\" to file \"{$datafile}\""); } fclose($handle); }
function AllyPage_CircularMessage() { global $db_prefix; global $GlobalUser; global $session; global $ally; global $AllianzenError; if (method() === "POST" && key_exists('r', $_POST)) { $ally_id = $ally['ally_id']; $myrank = LoadRank($ally_id, $GlobalUser['allyrank']); if (!($myrank['rights'] & 0x80)) { $AllianzenError = "<center>\nНедостаточно прав для проведения операции<br></center>"; return; } $rank_id = intval($_POST['r']); if ($rank_id == 0) { $query = "SELECT * FROM " . $db_prefix . "users WHERE ally_id = {$ally_id}"; } else { $query = "SELECT * FROM " . $db_prefix . "users WHERE ally_id = {$ally_id} AND allyrank = {$rank_id}"; } $result = dbquery($query); $rows = dbrows($result); if ($rows) { ?> <script src="js/cntchar.js" type="text/javascript"></script><script src="js/win.js" type="text/javascript"></script> <table width=519> <form action="index.php?page=allianzen&session=<?php echo $session; ?> " method=POST> <tr><td class=c>Следующие игроки получили Ваше общее послание</td></tr> <tr><th> <?php $text = str_replace('\\"', """, bb($_POST['text'])); $text = str_replace('\'', "’", $text); $text = str_replace('\\`', "‘", $text); while ($rows--) { $user = dbarray($result); SendMessage($user['player_id'], va("Альянс [#1]", $ally['tag']), va("Общее послание Вашему альянсу [#1]", $ally['tag']), va("Игрок #1 сообщает Вам следующее:<br>#2", $GlobalUser['oname'], $text), 0); echo $user['oname'] . "<br>\n"; } ?> </th></tr> <tr><th><input type=submit value="Ok"></th></tr> </table></center></form> <?php } else { ?> <script src="js/cntchar.js" type="text/javascript"></script><script src="js/win.js" type="text/javascript"></script> <table width=519> <form action="index.php?page=allianzen&session=<?php echo $session; ?> &a=17" method=POST> <tr><td class=c>Ошибка</td></tr> <tr><th>К сожалению, получатели не найдены</th></tr> <tr><th><input type=submit value="Назад"></th></tr> </table></center></form> <?php } return; } ?> <script src="js/cntchar.js" type="text/javascript"></script><script src="js/win.js" type="text/javascript"></script> <table width=519> <form action="index.php?page=allianzen&session=<?php echo $session; ?> &a=17&sendmail=1" method=POST> <tr><td class=c colspan=2>Отправить общее сообщение</td></tr> <tr><th>Получатель</th><th> <select name=r> <option value=0>Все игроки</option> <?php $result = EnumRanks($ally['ally_id']); $rows = dbrows($result); while ($rows--) { $rank = dbarray($result); if ($rank['rank_id'] == 0 || $rank['rank_id'] == 1) { continue; } // Основателя и новичка не показываем echo " <option value=" . $rank['rank_id'] . ">Только определённому рангу: " . $rank['name'] . "</option>\n"; } ?> </select></th></tr> <tr><th>Текст сообщения (<span id="cntChars">0</span> / 2000 Симв.)</th><th><textarea name=text cols=60 rows=10 onkeyup="javascript:cntchar(2000)"></textarea></th></tr> <tr><th colspan=2><input type=submit value="Отправить"></th></tr></table></center></form> <?php }
function SendGreetingsMessage($player_id) { SendMessage($player_id, "Командование флотом", "Добро пожаловать в ОГейм!", bb("Добро пожаловать в [b]OGame[/b] !\n" . "\n" . "Для начала Вам необходимо развить рудники.\n" . "Это можно сделать в меню \"постройки\".\n" . "Выберите рудник по добыче металла и нажмите на \"строить\".\n" . "Теперь у Вас есть немного времени для ознакомления с игрой.\n" . "Помощь по игре Вы можете найти по этим ссылкам: \n" . "[url=http://tutorial.oldogame.ru/]Туториал[/url]\n" . "[url=http://board.oldogame.ru]Форум[/url]\n" . "\n" . "Тем временем Ваш рудник уже должен построиться.\n" . "Для работы рудников необходима энергия, для её получения постройте солнечную электростанцию.\n" . "Для этого снова зайдите в меню \"постройки\" и кликните на электростанции.\n" . "Для того, чтобы посмотреть, насколько далеко Вы зашли в развитии, зайдите в меню \"Технологии\".\n" . "Итак, Ваш победный поход по вселенной начался... Удачи!\n"), 5); }
} } } } echo "\r\n\r\n{$count} issues:\r\n{$collected}"; if (array_key_exists('notify', $settings['settings'])) { $to = $settings['settings']['notify']; if ($count && strlen($collected)) { SendMessage($to, "{$count} locations with issues - WebPagetest ALERT", $collected); } // send the slow logs from the last hour if (strlen($to) && is_file('./tmp/slow_tests.log')) { $slow = file_get_contents('./tmp/slow_tests.log'); unlink('./tmp/slow_tests.log'); if ($slow !== false && strlen($slow)) { SendMessage($to, 'Slow tests report', $slow); } } } function SendMessage($to, $subject, &$body) { global $settings; // send the e-mail through an SMTP server? if (array_key_exists('mailserver', $settings)) { require_once "Mail.php"; $mailServerSettings = $settings['mailserver']; $mailInit = array(); if (array_key_exists('host', $mailServerSettings)) { $mailInit['host'] = $mailServerSettings['host']; } if (array_key_exists('port', $mailServerSettings)) {
function Admin_Broadcast() { global $session; global $db_prefix; global $GlobalUser; $write_error = ""; // Обработка POST-запроса. if (method() === "POST") { $cat = $_POST['cat']; $subj = $_POST['subj']; if ($subj === "") { $write_error = "<center><font color=#FF0000>Заполните тему</font><br/></center>\n"; } $text = $_POST['text']; if ($text === "") { $write_error = "<center><font color=#FF0000>Введите текст сообщения</font><br/></center>\n"; } if ($write_error === "") { if ($cat == 1) { $query = "SELECT * FROM " . $db_prefix . "users WHERE score1 < 5000;"; } else { if ($cat == 2) { $query = "SELECT * FROM " . $db_prefix . "users WHERE place1 < 100;"; } else { if ($cat == 3) { $query = "SELECT * FROM " . $db_prefix . "users WHERE admin = 1;"; } else { $query = "SELECT * FROM " . $db_prefix . "users;"; } } } // Всем $ownhome = GetPlanet($GlobalUser['hplanetid']); $from = $GlobalUser['oname'] . " <a href=\"index.php?page=galaxy&galaxy=" . $ownhome['g'] . "&system=" . $ownhome['s'] . "&position=" . $ownhome['p'] . "&session={PUBLIC_SESSION}\">[" . $ownhome['g'] . ":" . $ownhome['s'] . ":" . $ownhome['p'] . "]</a>\n"; $subj = $subj . " <a href=\"index.php?page=writemessages&session={PUBLIC_SESSION}&messageziel=" . $GlobalUser['player_id'] . "&re=1&betreff=Re:" . $subj . "\">\n" . "</a>\n"; $text = str_replace('\\"', """, bb($text)); $text = str_replace('\'', "’", $text); $text = str_replace('\\`', "‘", $text); $result = dbquery($query); $usernum = $rows = dbrows($result); while ($rows--) { $user = dbarray($result); SendMessage($user['player_id'], $from, $subj, $text, 5); } if ($usernum > 0) { $write_error = "<center><font color=#00FF00>Сообщение отправлено {$usernum} пользователям.</font><br/></center>\n"; } else { $write_error = "<center><font color=#00FF00>Адресаты не найдены.</font><br/></center>\n"; } } } ?> <?php echo AdminPanel(); ?> <?php echo $write_error; ?> <table> <form action="index.php?page=admin&session=<?php echo $session; ?> &mode=Broadcast" method="POST"> <tr><td> Кому: <select name="cat"> <option value="0">Всем</option> <option value="1">Новичкам (менее 5.000 очков)</option> <option value="2">Игрокам из топ100</option> <option value="3">Операторам</option> </select> </td></tr> <tr><td> Тема : <input name="subj" size=80> </td></tr> <tr><td> <textarea cols='100' rows='20' name='text'></textarea> </td></tr> <tr><td> <center><input type="submit" value="Отправить"></center> </td></tr> </form> </table> <?php }
SendMessage($user['player_id'], va("Альянс [#1]", $ally['tag']), "Общее сообщение", va("Игрок #1 был принят в наш альянс.", $newcomer['oname']), 0); } SendMessage($player_id, va("Альянс [#1]", $ally['tag']), va("Регистрация [#1] принята", $ally['tag']), va("Сердечно поздравляем, Вы теперь член альянса [#1]", $ally['tag']), 0); $query = "UPDATE " . $db_prefix . "users SET ally_id = {$ally_id}, allyrank = 1, joindate = {$now} WHERE player_id = {$player_id}"; dbquery($query); RemoveApplication($show); } if ($_POST['aktion'] === "Отклонить" && $show > 0) { $app = LoadApplication($show); RemoveApplication($show); // Выслать сообщение об отказе. $reason = "-причина не указана-"; if ($_POST['text'] !== "") { $reason = $_POST['text']; } SendMessage($app['player_id'], va("Альянс [#1]", $ally['tag']), va("Регистрация [#1] отклонена", $ally['tag']), $reason, 0); } } $result = EnumApplications($ally['ally_id']); $apps = dbrows($result); if ($apps > 0) { ?> <!-- CONTENT AREA --> <div id='content'> <center> <table width=519> <tr><td class=c colspan=2>Обзор регистрации в этом альянсе [<?php echo $ally['tag']; ?> ]</td></tr>
function NewMessage() { global $CFG, $dbConn, $aPostIcons, $aSmilies; // Default values. $bParseURLs = FALSE; $bParseEMails = TRUE; $bDisableSmilies = FALSE; $bSaveCopy = TRUE; $bTrack = TRUE; // Are they submitting? if ($_REQUEST['submit'] == 'Send Message') { $aError = SendMessage(); } // Are they forwarding? if (strtolower($_REQUEST['action']) == 'forward') { // Yes, get the message they want to forward. $iMessageID = (int) $_REQUEST['id']; $dbConn->query("SELECT pm.datetime, pm.author, pm.subject, pm.body, citizen.username FROM pm JOIN citizen ON (citizen.id = pm.author) WHERE pm.id={$iMessageID} AND pm.ownerid={$_SESSION['userid']}"); $aSQLResult = $dbConn->getresult(); // Change the subject and add a copy of the message being forwarded. $strSubject = htmlsanitize("Fw: {$aSQLResult[2]}"); $strMessage = "\n\n[quote][i]{$aSQLResult[4]} wrote on [dt={$aSQLResult[0]}]:[/i]\n[b]{$aSQLResult[3]}[/b][/quote]"; } // Are they replying? if ($_REQUEST['action'] == 'reply') { // Yes, get the message they want to reply to. $iMessageID = (int) $_REQUEST['id']; $dbConn->query("SELECT pm.datetime, pm.author, pm.subject, pm.body, citizen.username FROM pm JOIN citizen ON (citizen.id = pm.author) WHERE pm.id={$iMessageID} AND pm.ownerid={$_SESSION['userid']}"); $aSQLResult = $dbConn->getresult(); // Set the recipient & subject, and add a copy of the message being forwarded. $strRecipient = $aSQLResult[4]; $strSubject = strpos($aSQLResult[2], 'Re: ') !== 0 ? "Re: {$aSQLResult[2]}" : $aSQLResult[2]; $strMessage = "\n\n[quote][i]{$aSQLResult[4]} wrote on [dt={$aSQLResult[0]}]:[/i]\n[b]{$aSQLResult[3]}[/b][/quote]"; } // Are they specifying a user ID? if (isset($_REQUEST['userid'])) { // Yes, so get the username of the user whose ID was specified. $iUserID = (int) $_REQUEST['userid']; $dbConn->query("SELECT username FROM citizen WHERE id={$iUserID}"); list($strRecipient) = $dbConn->getresult(); } // Template require "./skins/{$CFG['skin']}/pm/newmessage.tpl.php"; // Send the page. exit; }
$write_error = "<center><font color=#FF0000>Не хватает темы</font><br/><br/></center>\n"; } else { if ($text === "") { $write_error .= "<center><font color=#FF0000>А где же сообщение?</font><br/><br/></center>\n"; } else { if ($user['useskin']) { $skin = $user['skin']; } else { $skin = hostname() . "evolution/"; } $text = str_replace('\\"', """, bb($text)); $text = str_replace('\'', "’", $text); $text = str_replace('\\`', "‘", $text); $from = $GlobalUser['oname'] . " <a href=\"index.php?page=galaxy&galaxy=" . $ownhome['g'] . "&system=" . $ownhome['s'] . "&position=" . $ownhome['p'] . "&session={PUBLIC_SESSION}\">[" . $ownhome['g'] . ":" . $ownhome['s'] . ":" . $ownhome['p'] . "]</a>\n"; $subj = $subj . " <a href=\"index.php?page=writemessages&session={PUBLIC_SESSION}&messageziel=" . $GlobalUser['player_id'] . "&re=1&betreff=Re:" . $subj . "\">\n" . "<img border=\"0\" alt=\"Ответить\" src=\"" . $skin . "img/m.gif\" /></a>\n"; SendMessage($user['player_id'], $from, $subj, $text, 0); $write_error = "<center><font color=#00FF00>Сообщение отправлено</font><br/></center>\n"; } } } } echo "<!-- CONTENT AREA -->\n"; echo "<div id='content'>\n"; echo "<center>\n"; echo $write_error; echo "<center>\n"; echo "<form action=\"index.php?page=writemessages&session=" . $_GET['session'] . "&gesendet=1&messageziel=" . intval($_GET['messageziel']) . "\" method=\"post\">\n"; echo "<table width=\"519\">\n\n"; //echo "GET: "; print_r ($_GET); echo "<br>"; //echo "POST: "; print_r ($_POST); echo "<br>"; echo "<tr><td class=\"c\" colspan=\"2\">Написать сообщение</td></tr>\n";
if (key_exists('action', $_GET) && $_GET['action'] == 6) { Buddy_Outcome(); } else { if (key_exists('action', $_GET) && $_GET['action'] == 7) { Buddy_Request(); } else { if (key_exists('action', $_GET) && $_GET['action'] == 8 && $_GET['buddy_id']) { $buddy_id = intval($_GET['buddy_id']); $buddy = LoadBuddy($buddy_id); if ($buddy['request_from'] == $GlobalUser['player_id']) { RemoveBuddy($buddy_id); SendMessage($buddy['request_to'], loca("BUDDY_LIST"), loca("BUDDY_CONFIRM"), va(loca("BUDDY_MSG_DELETED"), $GlobalUser['oname']), 0); } if ($buddy['request_to'] == $GlobalUser['player_id']) { RemoveBuddy($buddy_id); SendMessage($buddy['request_from'], loca("BUDDY_LIST"), loca("BUDDY_CONFIRM"), va(loca("BUDDY_MSG_DELETED"), $GlobalUser['oname']), 0); } Buddy_Home(); } else { Buddy_Home(); } } } } } } } } echo "</center>\n"; echo "</div>\n"; echo "<!-- END CONTENT AREA -->\n";
function SendMessageFromMenteeToMentor($toEmail, $msg, $email) { $mentorArr = GetMentorDetailsByEmail($toEmail); $menteeArr = GetMenteeDetailsByEmail($email); // mentor names and email address $mentorEmail = $mentorArr["MentorEmail"]; $mentorName = $mentorArr["MentorName"]; // mentee name and email address $menteeEmail = $menteeArr["MenteeEmail"]; $menteeName = $menteeArr["MenteeName"]; $subject = $menteeName . " - Query Received"; $message = "Dear " . $mentorName . "<br /><br />"; $message .= "You have Received a query from one of your mentees, namely " . $menteeName . " (" . $menteeEmail . "). Please repond to him either privately or through the <a href='http://mentored-research.com/login' target='_blank'>MR-Portal</a> <br /><br />"; $message .= $msg . "<br /><br />"; $message .= "Team Mentored-Research<br />"; $message .= "info@mentored-research.com<br /><br />"; $message .= "Please do not reply to this automated mail.<br />"; $res = SendMessage($mentorEmail, $mentorName, $menteeEmail, $menteeName, $subject, $message); if ($res == "-1") { echo $res; } else { header('Content-Type: application/json'); echo json_encode($res); } }
function AllyPage_Takeover() { global $GlobalUser; global $session; global $ally; global $AllianzenError; // Обменять званиями главу и "правую руку". if ($_GET['a'] == 18 && $_REQUEST['s'] == 1) { $now = time(); $myrank = LoadRank($ally['ally_id'], $GlobalUser['allyrank']); if (!($myrank['rights'] & 0x100)) { $AllianzenError = "<center>\nНедостаточно прав для проведения операции<br></center>"; } else { // Выслать всем участникам сообщение что власть поменялась (кроме самого главы). $from = va("Альянс [#1]", $ally['tag']); $subj = va("Смена власти в альянсе [#1]", $ally['tag']); $text = va("Игрок #1, обладающий титулом основателя альянса, покинул его", $GlobalUser['oname'], $ally['tag']); $result = EnumerateAlly($ally['ally_id']); $rows = dbrows($result); while ($rows--) { $user = dbarray($result); if ($user['player_id'] != $ally['owner_id']) { SendMessage($user['player_id'], $from, $subj, $text, 0); } } // Поменять звания $newhead = LoadUser(intval($_REQUEST['uid'])); $newhead_rank = LoadRank($ally['ally_id'], $newhead['allyrank']); if ($newhead['ally_id'] != $ally['ally_id'] || ($newhead_rank['rights'] & 0x100) == 0) { $AllianzenError = "<center>\nНедостаточно прав для проведения операции<br></center>"; return; } SetUserRank($newhead['player_id'], $GlobalUser['allyrank']); SetUserRank($GlobalUser['player_id'], $newhead['allyrank']); // Установить нового хозяина альянса AllyChangeOwner($ally['ally_id'], $newhead['player_id']); ?> <table width=519> <form action="index.php?page=allianzen&session=<?php echo $session; ?> " method="POST"> <tr><td class=c>Вы утратили свой статус</td></tr><tr><th><br><input type="submit" value="OK"></th></tr></form></table><br><br><br><br> <?php } return; } // Ололош, любой игрок по этому параметру может взять на себя права главы, без всяких проверок..... if ($_GET['a'] == 18 && $_REQUEST['s'] == 2) { ?> <table width=519> <form action="index.php?page=allianzen&session=<?php echo $session; ?> " method="POST"> <tr><td class=c>Звание передано</td></tr><tr><th><br><input type="submit" value="OK"></th></tr></form></table><br><br><br><br> <?php return; } // Если открыть у НЕ главы страничку: if ($ally['owner_id'] != $GlobalUser['player_id']) { ?> <table width=519> <form action="index.php?page=allianzen&session=<?php echo $session; ?> &a=5" method=POST> <tr><td class=c>Глава ещё активен</td></tr><tr><th><input type=submit value="Назад"></th></tr></form></table><br><br><br><br> <?php return; } // Перечислить всех игроков альянса с правами "правая рука". Если никого нет, то просто вывести кнопку "назад". $users = array(); $rank_result = EnumRanks($ally['ally_id']); while ($rank = dbarray($rank_result)) { if ($rank['rights'] & 0x100) { $result = LoadUsersWithRank($ally['ally_id'], $rank['rank_id']); while ($user = dbarray($result)) { if ($user['player_id'] == $ally['owner_id']) { continue; } // не показывать главу $user['rankname'] = $rank['name']; $users[] = $user; } } } if (count($users) == 0) { // Никто не найден, вывести кнопку "назад" ?> <table width=519> <form action="index.php?page=allianzen&session=<?php echo $session; ?> &a=5" method=POST> <tr><td class=c></th></tr><tr><th><input type=submit value="Назад"></th></tr></form></table><br><br><br><br> <?php } else { // Перечислить найденных пользователей с рангом "правая рука" ?> <table width=519> <form action="index.php?page=allianzen&session=<?php echo $session; ?> &a=18" method=POST> <input type=hidden name=s value=1> <tr><td class=c colspan=2><?php echo va("Перенять руководство над #1", "\"" . $ally['name'] . "\""); ?> </td></tr> <tr><th>Передача звания</th><th><select name=uid> <?php foreach ($users as $i => $user) { echo " <option value=" . $user['player_id'] . ">" . $user['oname'] . " (Rang: " . $user['rankname'] . ")\n"; } ?> </select></th></tr> <tr><th colspan=2><input type=submit value="Передать"></th></tr></form></table><br><br><br><br> <?php } }
//Print error if any if (curl_errno($ch)) { echo 'error:' . curl_error($ch); } curl_close($ch); echo $output; } if (isset($_GET) && !empty($_GET) || isset($_POST) && !empty($_POST)) { if (isset($_REQUEST['keyword']) && !empty($_REQUEST['keyword'])) { if (isset($_REQUEST['number']) && !empty($_REQUEST['number'])) { if (isset($_REQUEST['message']) && !empty($_REQUEST['message'])) { $mobile = $_REQUEST['number']; $mess = $_REQUEST['message']; $keyword = $_REQUEST['keyword']; var_dump($_REQUEST); $message = $keyword . $mobile . $mess; SendMessage('9910065699', $message); $sms = new SMSReceiver(); $sms->ProcessData($keyword, $mobile, $mess); } else { echo "ERROR : Message not sent -- Text parameter is missing!\r\n"; } } else { echo "ERROR : Message not sent -- Phone parameter is missing!\r\n"; } } else { echo "ERROR : Message not sent -- Keyword is missing!\r\n"; } } else { echo "ERROR : Message not received -- Phone and Text parameter is missing!\r\n"; }
case 2: if (!$Message) { BeginHtml($Title2, $Title2, "http://" . $DOC_DOMAIN . "/management/messages/"); $perm->ExitIfNotAccess(NC_PERM_ITEM_GROUP, NC_PERM_ACTION_MAIL, 0, 0, 1); nc_print_status(CONTROL_USER_MAIL_ERROR_NOBODY, 'error'); ShowForm(); break; } if (isset($Attach)) { BeginHtml($Title2, $Title3, "http://" . $DOC_DOMAIN . "/management/messages/"); $perm->ExitIfNotAccess(NC_PERM_ITEM_GROUP, NC_PERM_ACTION_MAIL, 0, 0, 1); $Result = $db->query("INSERT INTO MailTmp (Subject,Message) VALUES ('" . $Subject . "','" . $Message . "')"); $TmpID = $db->insert_id; AttachForm($is_html); } else { BeginHtml($Title2, $Title3, "http://" . $DOC_DOMAIN . "/management/messages/"); $perm->ExitIfNotAccess(NC_PERM_ITEM_GROUP, NC_PERM_ACTION_MAIL, 0, 0, 1); SendMessage($PermissionGroupID, $Subject, $Message, 0, $is_html); } break; case 3: BeginHtml($Title2, $Title3, "http://" . $DOC_DOMAIN . "/management/messages/"); $perm->ExitIfNotAccess(NC_PERM_ITEM_GROUP, NC_PERM_ACTION_MAIL, 0, 0, 1); $Array = $db->get_row("SELECT Subject, Message FROM MailTmp WHERE MailTmp_ID='" . $TmpID . "'", ARRAY_N); $Subject = $Array[0]; $Message = $Array[1]; $Result = $db->query("DELETE FROM MailTmp WHERE MailTmp_ID='" . $TmpID . "'"); SendMessage($PermissionGroupID, $Subject, $Message, 1, $is_html); break; } EndHtml();
function PageAlly_MemberSettings() { global $db_prefix; global $session; global $ally; global $GlobalUser; global $AllianzenError; $selected_user = 0; if (key_exists('u', $_GET)) { $selected_user = intval($_GET['u']); } if (method() === "GET" && $_GET['a'] == 13 && $selected_user) { $leaver = LoadUser($selected_user); $query = "UPDATE " . $db_prefix . "users SET ally_id = 0 WHERE player_id = {$selected_user}"; dbquery($query); // Разослать сообщения членам альянса об исключении игрока $result = EnumerateAlly($ally['ally_id']); $rows = dbrows($result); while ($rows--) { $user = dbarray($result); SendMessage($user['player_id'], va("Альянс [#1]", $ally['tag']), "Общее сообщение", va("Игрок #1 исключён из альянса.", $leaver['oname']), 0); } // Сообщение игроку об исключении. SendMessage($leaver['player_id'], va("Альянс [#1]", $ally['tag']), va("Членство в альянсе [#1] окончено", $ally['tag']), va("Игрок #1 исключает Вас из альянса [#2] .<br>Теперь Вы можете зарегистрироваться снова", $GlobalUser['oname'], $ally['tag']), 0); } if (method() === "POST" && $_GET['a'] == 16 && $selected_user) { $newrank = intval($_POST['newrang']); $query = "UPDATE " . $db_prefix . "users SET allyrank = {$newrank} WHERE player_id = {$selected_user}"; dbquery($query); } $now = time(); $members = CountAllyMembers($ally['ally_id']); $sort1 = intval($_GET['sort1']); $sort2 = intval($_GET['sort2']) ^ 1; ?> <script src="js/cntchar.js" type="text/javascript"></script><script src="js/win.js" type="text/javascript"></script><br> <a href="index.php?page=allianzen&session=<?php echo $session; ?> &a=5">Назад к обзору</a> <table width=519> <tr><td class='c' colspan='10'>Список членов (кол-во: <?php echo $members; ?> )</td></tr> <tr> <th>N</th> <th><a href="index.php?page=allianzen&session=<?php echo $session; ?> &a=7&sort1=1&sort2=<?php echo $sort2; ?> ">Имя</a></th> <th> </th> <th><a href="index.php?page=allianzen&session=<?php echo $session; ?> &a=7&sort1=2&sort2=<?php echo $sort2; ?> ">Статус</a></th> <th><a href="index.php?page=allianzen&session=<?php echo $session; ?> &a=7&sort1=3&sort2=<?php echo $sort2; ?> ">Очки</a></th> <th><a href="index.php?page=allianzen&session=<?php echo $session; ?> &a=7&sort1=0&sort2=<?php echo $sort2; ?> ">Координаты</a></th> <th><a href="index.php?page=allianzen&session=<?php echo $session; ?> &a=7&sort1=4&sort2=<?php echo $sort2; ?> ">Вступление</a></th> <th><a href="index.php?page=allianzen&session=<?php echo $session; ?> &a=7&sort1=5&sort2=<?php echo $sort2; ?> ">Неактивный</a></th> <th>Функция</th></tr> <?php $result = EnumerateAlly($ally['ally_id'], intval($_GET['sort1']), intval($_GET['sort2'])); for ($i = 0; $i < $members; $i++) { $user = dbarray($result); $rank = LoadRank($user['ally_id'], $user['allyrank']); $hplanet = GetPlanet($user['hplanetid']); $days = floor(($now - $user['lastclick']) / (60 * 60 * 24)); echo "<tr>"; echo "<th>" . ($i + 1) . "</th>"; echo "<th>" . $user['oname'] . "</th>"; if ($GlobalUser['player_id'] != $user['player_id']) { echo "<th><a href=\"index.php?page=writemessages&session={$session}&messageziel=" . $user['player_id'] . "\"><img src=\"" . UserSkin() . "img/m.gif\" border=0 alt=\"Написать сообщение\"></a></th>"; } else { echo "<th></th>"; } echo "<th>" . $rank['name'] . "</th>"; echo "<th>" . nicenum($user['score1'] / 1000) . "</th>"; echo "<th><a href=\"index.php?page=galaxy&galaxy=" . $hplanet['g'] . "&system=" . $hplanet['s'] . "&position=" . $hplanet['p'] . "&session={$session}\" >[" . $hplanet['g'] . ":" . $hplanet['s'] . ":" . $hplanet['p'] . "]</a></th>"; echo "<th>" . date("Y-m-d H:i:s", $user['joindate']) . "</th>"; echo "<th>" . $days . "d</th>"; if ($user['allyrank'] > 0) { echo "<th>"; echo "<a onmouseover='return overlib(\"<font color=white>Выгнать игрока</font>\", WIDTH, 100);' onmouseout='return nd();' alt='Выгнать игрока' href='javascript:if(confirm(\"Вы уверены, что игрок " . $user['oname'] . " должен покинуть альянс?\"))document.location=\"index.php?page=allianzen&session={$session}&a=13&u=" . $user['player_id'] . "\"';>"; echo "<img src='" . UserSkin() . "pic/abort.gif' alt='Выгнать игрока' border='0' ></a>"; echo "<a onmouseover=\"return overlib('<font color=white>Назначить ранг</font>', WIDTH, 100);\" onmouseout='return nd();' alt='Назначить ранг' href=\"index.php?page=allianzen&session={$session}&a=7&u=" . $user['player_id'] . "\">"; echo "<img src=\"" . UserSkin() . "pic/key.gif\" alt='Назначить ранг' border=0></a> "; echo "</th>"; echo "</tr>\n"; if ($user['player_id'] == $selected_user) { $rank_result = EnumRanks($ally['ally_id']); $rows = dbrows($rank_result); echo "<form action=\"index.php?page=allianzen&session={$session}&a=16&u={$selected_user}\" method=POST><tr><th colspan=3>Ранг для " . $user['oname'] . ":</th><th><select name=\"newrang\">"; while ($rows--) { $user_rank = dbarray($rank_result); if ($user_rank['rank_id'] == 0) { continue; } echo "<option value=\"" . $user_rank['rank_id'] . "\""; if ($user_rank['rank_id'] == $user['allyrank']) { echo " SELECTED"; } echo ">" . $user_rank['name'] . "\n"; } echo "</th><th colspan=5><input type=submit value=\"Сохранить\"></th></tr></form>\n"; } } else { echo "<th> </th></tr>\n"; } } ?> </table> <?php }
throw new Exception($result->getErrorMessage()); } } //get params if (ReturnGetPost('recieverid') && preg_match('/' . REGEXP_THREEMAID_ANY . '/', ReturnGetPost('recieverid'))) { $threemaId = htmlentities(ReturnGetPost('recieverid')); $message = ReturnGetPost('message'); } //create connection $connector = CreateConnection(); //Send message if ($threemaId !== null && $message !== null) { if (!$isIncluded) { header('Content-Type: text/plain'); } $actionDone = true; try { $messageId = SendMessage($connector, $threemaId, $message); } catch (Exception $e) { http_response_code(500); $errorMessage = $e->getMessage(); } } //Show direct output if the file is called directly if (!$isIncluded) { if ($errorMessage === null) { echo 'Message ID: ' . $messageId; } else { echo $errorMessage; } }
<?php session_start(); require_once $_SERVER['DOCUMENT_ROOT'] . "/data-layer/dbCommunication.php"; if (isset($_POST['update_chat'])) { GetMessages(); } if (isset($_POST['update_leaderboard'])) { GetLeaderboard(); } if (isset($_POST['get_games'])) { GetGames(); } if (isset($_POST['send_message'])) { $Message = $_POST["message"]; SendMessage($Message); } if (isset($_POST['update_game'])) { UpdateBoard(); } if (isset($_POST['create_game'])) { $GameName = $_POST["game_name"]; $Username = $_SESSION["Username"]; $output = CreateGame($GameName, $Username); UpdateBoard(); } if (isset($_POST['game_hit'])) { $Username = $_SESSION["Username"]; $GameID = $_SESSION["GameID"]; if (IsUserTurn($Username, $GameID)) { HitPlayer();
function ExpeditionHold($queue, $fleet_obj, $fleet, $origin, $target) { global $loca_lang; global $GlobalUni; $exptab = LoadExpeditionSettings(); $hold_time = $fleet_obj['flight_time'] / 3600; loca_add("common", $GlobalUni['lang']); loca_add("technames", $GlobalUni['lang']); loca_add("expedition", $GlobalUni['lang']); // Событие экспедиции. $chance = mt_rand(0, 99); if ($chance < $exptab['chance_success'] + $hold_time) { $expcount = $target['m']; // счётчик посещений if ($expcount <= $exptab['depleted_min']) { $chance_depleted = 0; } else { if ($expcount <= $exptab['depleted_med']) { $chance_depleted = $exptab['chance_depleted_min']; } else { if ($expcount <= $exptab['depleted_max']) { $chance_depleted = $exptab['chance_depleted_med']; } else { $chance_depleted = $exptab['chance_depleted_max']; } } } $chance = mt_rand(0, 99); if ($chance >= $chance_depleted) { if ($chance >= $exptab['chance_alien']) { $text = Exp_BattleAliens($queue, $fleet_obj, $fleet, $origin, $target); } else { if ($chance >= $exptab['chance_pirates']) { $text = Exp_BattlePirates($queue, $fleet_obj, $fleet, $origin, $target); } else { if ($chance >= $exptab['chance_dm']) { $text = Exp_DarkMatterFound($queue, $fleet_obj, $fleet, $origin, $target); } else { if ($chance >= $exptab['chance_lost']) { $text = Exp_NothingHappens($queue, $fleet_obj, $fleet, $origin, $target); } else { if ($chance >= $exptab['chance_delay']) { $text = Exp_DelayFleet($queue, $fleet_obj, $fleet, $origin, $target); } else { if ($chance >= $exptab['chance_accel']) { $text = Exp_AccelFleet($queue, $fleet_obj, $fleet, $origin, $target); } else { if ($chance >= $exptab['chance_res']) { $text = Exp_ResourcesFound($queue, $fleet_obj, $fleet, $origin, $target); } else { if ($chance >= $exptab['chance_fleet']) { $text = Exp_FleetFound($queue, $fleet_obj, $fleet, $origin, $target); } else { $text = Exp_TraderFound($queue, $fleet_obj, $fleet, $origin, $target); } } } } } } } } } else { $text = Exp_NothingHappens($queue, $fleet_obj, $fleet, $origin, $target); } } else { $text = Exp_NothingHappens($queue, $fleet_obj, $fleet, $origin, $target); } // DEBUG //$text = Exp_FleetFound ($queue, $fleet_obj, $fleet, $origin, $target); // Обновляем счётчик посещений экспедиции на планете. AdjustResources(1, 0, 0, $target['planet_id'], '+'); // Бортовой журнал, дополнение связиста if ($fleet[210] > 0) { $text .= "\n<br/>\n<br/>\n" . Logbook($expcount, $exptab); } SendMessage($fleet_obj['owner_id'], "Командование флотом", "Результат экспедиции [" . $target['g'] . ":" . $target['s'] . ":" . $target['p'] . "]", $text, 3, $queue['end']); }
function bawkBotExecuteCommand($server, $messageNick, $messageType, $messageChan, $messageCont, $messageMask = "", $choke = false) { global $plugins, $aliaser, $messageQueue, $mysql_statistics, $mysql_statistics; $isCommand = substr($messageCont, 0, 1) == COMMANDSYMBOL; $preAliaser = $messageCont; if ($isCommand) { do { $pipeCount = substr_count($messageCont, "|"); $messageCommands = parse_delimiters($messageCont, "|"); foreach ($messageCommands as &$tmpMsg) { $tmp = parse_delimiters(substr($tmpMsg, 1), " "); $tmpMsg = COMMANDSYMBOL . implode(" ", $aliaser->performAlias($tmp)); } $messageCont = implode(" | ", $messageCommands); } while ($pipeCount != substr_count($messageCont, "|")); $messageCommands = parse_delimiters($messageCont, "|"); } else { $messageCommands = array($messageCont); } $pipeCommandCounter = 1; $stdin = array(); //The output of a message if it is piped. If it returns multiple lines, they are concatenated //together with a space in between. if ($isCommand) { if ($mysql_statistics) { $queryString = sprintf("INSERT INTO `commands` (`time`,`server`,`nick`,`hostmask`,`type`,`channel`,`prealiser`,`message`,`choked`) VALUES ('%d','%s','%s','%s','%s','%s','%s','%s','%d')", time(), addslashes($server['host']), addslashes($messageNick), addslashes($messageMask), addslashes($messageType), addslashes($messageChan), addslashes($preAliaser), addslashes($messageCont), addslashes($choke)); mysql_query($queryString, $mysql_statistics); } $stdinCnt = 1; foreach ($messageCommands as $message) { $counter = 1; foreach ($stdin as $stdinval) { $message = str_replace_outside_quotes("[in-" . $counter . "]", '"' . trim($stdin[$counter]) . '"', $message); $counter++; } if (isset($stdin[$stdinCnt - 1])) { $message = str_replace_outside_quotes("[in]", '"' . trim($stdin[$stdinCnt - 1]) . '"', $message); } $stdin[$stdinCnt] = ""; $command = parse_delimiters(substr($message, 1, strlen($message)), ' '); $message = COMMANDSYMBOL . implode($command, " "); /*End aliasing. Output is the final (valid) command.*/ /*Plugin messenger / pipe output manager*/ foreach ($plugins as $key => $plugin) { if (in_array(trim($messageType . "." . strtolower(trim($command[0]))), $plugin['object']->getHooks())) { //Get the permission level for the plugin, and the user. if ($server["USERDATA"]->existsUserData("BawkBotPermissions", $messageChan, $messageNick, "PermissionLevel") && $server["USERDATA"]->existsUserData("BawkBotPermissions", $messageChan, $messageNick, "isAuthenticated")) { $userPermissionsData = $server["USERDATA"]->getUserData("BawkBotPermissions", $messageChan, $messageNick); $userPermissionsLevel = $userPermissionsData['isAuthenticated'] ? $userPermissionsData["PermissionLevel"] : 0; } else { $userPermissionsLevel = 0; $server["USERDATA"]->addUserData("BawkBotPermissions", $messageChan, $messageNick, array("PermissionLevel" => 0, "isAuthenticated" => 0)); } $pluginPermissionsLevel = $plugin['object']->getUserPermissions($server, $messageChan, $messageNick, $message); //Make sure we have enough permissions, make sure the permissions on the plugin is set, and make sure we're not ignored. if ((int) $userPermissionsLevel >= (int) $pluginPermissionsLevel && (int) $pluginPermissionsLevel <= 9000 && (int) $userPermissionsLevel >= 0) { $finalMsg = $message; if (substr(trim($message), -1, 1) == "&") { $finalMsg = substr($finalMsg, 0, strlen($finalMsg) - 1); } //Push the data to the plugin, signal for it to process, and receive output. $plugin['object']->pushMessage($server, $messageChan, $messageNick, $finalMsg, $messageType, $messageMask); $plugin['object']->pluginLogic(); $output = $plugin['object']->receiveOutput(); foreach ($output as $msgKey => $toPrint) { //If we have an ampersand at the end of our command, make sure we output the message no matter what. if (substr(trim($message), -1, 1) == "&") { $stdin[$stdinCnt] .= trim($toPrint->getMessage()) . " " . chr(3); } if ($pipeCommandCounter >= count($messageCommands) || substr(trim($message), -1, 1) == "&") { //Print outputs of the plugin if (trim($toPrint->getMessage()) != "") { $outMessages = str_split($toPrint->getMessage(), 400); foreach ($outMessages as $outMessage) { SendMessage($toPrint->getServer(), $toPrint->getChannel(), $outMessage); } } } else { //Prepare it for the next pipe down the line... /*chr(3) is used because it is neutral to the client (invisible), doesn't break IRC, and is splitable.*/ $stdin[$stdinCnt] .= $toPrint->getMessage() . " " . chr(3); } } $stdinCnt++; } else { if ($userPermissionsLevel >= 0) { //Silence ignored people. SendCommand($server, "PRIVMSG NickServ STATUS " . $messageNick . "\r\n"); SendMessage($server, $messageChan, "Permission Denied. To do this, you need level: " . $pluginPermissionsLevel . " for `" . strtolower(trim($command[0])) . "`, you have: " . $userPermissionsLevel); } } } } $pipeCommandCounter++; } //foreach (piping loop) } //This sends off the chat to plugins that request it. Note that a chr(4) is appended to the beginning of the message. if (!$choke) { foreach ($plugins as $key => $plugin) { if (in_array("BawkBot.logMsg", $plugin['object']->getHooks())) { $plugin['object']->pushMessage($server, $messageChan, $messageNick, chr(4) . $messageCont, $messageType, $messageMask); $plugin['object']->pluginLogic(); $output = $plugin['object']->receiveOutput(); foreach ($output as $idk => $toPrint) { //Print outputs of the plugin if (trim($toPrint->getMessage()) != "") { $outMessages = str_split($toPrint->getMessage(), 400); foreach ($outMessages as $outMessage) { SendMessage($toPrint->getServer(), $toPrint->getChannel(), $outMessage); } } } } } } //Sends chat responses that bawkbot sends out. foreach ($plugins as $key => $plugin) { if (in_array("BawkBot.Messages", $plugin['object']->getHooks()) || in_array("BawkBot.logMsg", $plugin['object']->getHooks())) { foreach ($messageQueue as $outMessage) { $plugin['object']->pushMessage($server, $messageChan, "BawkBot", chr(4) . $outMessage, $messageType, $messageMask); $plugin['object']->pluginLogic(); } } } $messageQueue = array(); }
Logger::configure("../class/Logger.ini"); require_once "../include/config.inc.php"; __BeginRecivePostData(); __EndRecivePostData(); switch ($_POST['FUNC']) { case 'MOBILE_RECHARGE': require_once "../third_api/ofpay/ofpayV3.class.php"; OfpayV3::MobileRecharge($_POST); break; case 'GAME_RECHARGE': require_once "../third_api/ofpay/ofpayV2.class.php"; OfpayV2::GameRecharge($_POST); break; case 'SEND_SMS': require_once "../third_api/sendsms.php"; SendMessage($_POST); break; } /* * 接口开始接收POST数据 */ function __BeginRecivePostData() { ob_end_clean(); header("Connection: close\r\n"); // 这里的冒号前面不能有空格 header("Content-Encoding: none\r\n"); ignore_user_abort(); ob_start(); } /*
$subject = "Quota P-" . $project_id . " V-" . $vp_id; $body = "Quota for Project " . $project_id . " , Panel " . $vp_id . " has been fulfilled"; SendMessage($subject, $body, $project_id, $sales_user_id, $manager_user_id); } //Step 6. Checking for Client Codes if (strpos($client_link, "{{CLIENTKEY}}", 0) > 0) { //$query2 = 'SELECT Code FROM clientcode WHERE status IS NULL AND ClientRedirectID = ' . $ClientRedirectID . ' ORDER BY ID ASC LIMIT 1 '; $query2 = 'SELECT Code FROM ' . $tbl_cli_cd . ' WHERE status IS NULL AND project_id = ' . $project_id . ' ORDER BY id ASC LIMIT 1 '; $result2 = mysql_query($query2) or die(mysql_error() . $query2); if (mysql_num_rows($result2) <= 0) { echo '<h1 class="wrn">The study is temporarily on hold, Please try again later.</h1>'; $subject = "Client code over flow Project-" . $project_id; $body = "Client code out of stock for Project " . $project_id . " and no new panellist will be allowed to these survey."; //SendMessage($subject, $body, $ClientRedirectID, $SalesPersonID, $ManagerID); //UpdateErrors($ClientRedirectID, $vp_id); SendMessage($subject, $body, $project_id, $sales_user_id, $manager_user_id); UpdateErrors($project_id, $vp_id); mysql_close(); exit; } else { extract(mysql_fetch_assoc($result2)); $client_link = str_replace("{{CLIENTKEY}}", $Code, $client_link); //ClientID VendorID Referrer // $query = 'INSERT INTO panelistredirects // ( ClientRedirectID, VendorRedirectID, ForeignID, ForeignMISC,Status, Created, StartIP, clientcode, ClientID, VendorID, referrer, DataOnRedirect) // VALUES // (' . $ClientRedirectID . ', ' . $vp_id . ', "' . $proj_id . '", "' . $ext . '", "Redirected" , NOW() ,"' . $_SERVER['REMOTE_ADDR'] . '","' . $Code . '", ' . $ClientID . ', ' . $VendorID . ', "' . $referrer . '" ,"' . $DataOnRedirect . '")'; $query = 'INSERT INTO ' . $tbl_pnl_red . ' ( project_id, vendor_project_id, panellist_id, foreign_misc, redirect_status_id, created_datetime, StartIP, client_code, client_id, vendor_id, referrer, DataOnRedirect) VALUES (' . $project_id . ', ' . $vp_id . ', "' . $panellist_id . '", "' . $ext . '", ' . STATUS_REDIRECT_REDIRECTED . ' , NOW() ,"' . $_SERVER['REMOTE_ADDR'] . '","' . $Code . '", ' . $client_id . ', ' . $vendor_id . ', "' . $referrer . '" ,"' . $DataOnRedirect . '")';
/** * Send a validation email * * @param mixed $info */ function EmailValidation($info) { $email = $info['email']; $id = $info['id']; $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' || isset($_SERVER['HTTP_SSL']) && $_SERVER['HTTP_SSL'] == 'On' ? 'https' : 'http'; $url = "{$protocol}://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?validate={$id}"; $content = "Thank you for requesting a WebPagetest API key. In order to assign a key we need to validate your email address.\n\nTo complete the validation and retrieve your API key please go to {$url}"; SendMessage($email, 'WebPagetest API Key Request', $content); echo 'A validation email was sent to ' . htmlspecialchars($email) . '.<br><br>Once the email arrives, follow the instructions in it to activate your API key.'; }
function Admin_BattleSim() { global $session; global $db_prefix; global $GlobalUser; $fleetmap = array(202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215); $defmap = array(401, 402, 403, 404, 405, 406, 407, 408); $unitab = LoadUniverse(); $rf = $unitab['rapid']; $fid = $unitab['fid']; $did = $unitab['did']; $debug = false; $maxslot = $unitab['acs'] * $unitab['acs']; $BattleReport = ""; $aloss = $dloss = 0; // -------------------------------------------------------------------------------------------------------------------------- // Обработка POST-запроса. if (method() === "POST" && $GlobalUser['admin'] >= 2) { //print_r ( $_POST ); //echo "<hr>"; // Сформировать список атакующих и обороняющихся $a = array(); $d = array(); $anum = intval($_POST['anum']); $dnum = intval($_POST['dnum']); // Атакующие for ($i = 0; $i < $anum; $i++) { if ($_POST["a" . $i . "_weap"] === "") { $_POST["a" . $i . "_weap"] = 0; } if ($_POST["a" . $i . "_shld"] === "") { $_POST["a" . $i . "_shld"] = 0; } if ($_POST["a" . $i . "_armor"] === "") { $_POST["a" . $i . "_armor"] = 0; } $a[$i]['r109'] = intval($_POST["a" . $i . "_weap"]); $a[$i]['r110'] = intval($_POST["a" . $i . "_shld"]); $a[$i]['r111'] = intval($_POST["a" . $i . "_armor"]); $a[$i]['oname'] = "Attacker{$i}"; $a[$i]['g'] = mt_rand(1, 9); $a[$i]['s'] = mt_rand(1, 499); $a[$i]['p'] = mt_rand(1, 15); $a[$i]['fleet'] = array(); foreach ($fleetmap as $n => $gid) { if ($_POST["a" . $i . "_{$gid}"] === "") { $_POST["a" . $i . "_{$gid}"] = 0; } $a[$i]['fleet'][$gid] = intval($_POST["a" . $i . "_{$gid}"]); } } // Обороняющиеся for ($i = 0; $i < $dnum; $i++) { if ($_POST["d" . $i . "_weap"] === "") { $_POST["d" . $i . "_weap"] = 0; } if ($_POST["d" . $i . "_shld"] === "") { $_POST["d" . $i . "_shld"] = 0; } if ($_POST["d" . $i . "_armor"] === "") { $_POST["d" . $i . "_armor"] = 0; } $d[$i]['r109'] = intval($_POST["d" . $i . "_weap"]); $d[$i]['r110'] = intval($_POST["d" . $i . "_shld"]); $d[$i]['r111'] = intval($_POST["d" . $i . "_armor"]); $d[$i]['oname'] = "Defender{$i}"; $d[$i]['g'] = mt_rand(1, 9); $d[$i]['s'] = mt_rand(1, 499); $d[$i]['p'] = mt_rand(1, 15); $d[$i]['fleet'] = array(); foreach ($fleetmap as $n => $gid) { if ($_POST["d" . $i . "_{$gid}"] === "") { $_POST["d" . $i . "_{$gid}"] = 0; } $d[$i]['fleet'][$gid] = intval($_POST["d" . $i . "_{$gid}"]); } $d[$i]['defense'] = array(); foreach ($defmap as $n => $gid) { if ($_POST["d" . $i . "_{$gid}"] === "") { $_POST["d" . $i . "_{$gid}"] = 0; } $d[$i]['defense'][$gid] = intval($_POST["d" . $i . "_{$gid}"]); } } // Симулировать битву $battle_result = 0; if ($_POST['debug'] === "on") { $debug = true; } else { $debug = false; } if ($_POST['rapid'] === "on") { $rf = true; } else { $rf = 0; } if ($_POST['fid'] === "") { $fid = 0; } else { $fid = intval($_POST['fid']); } if ($_POST['did'] === "") { $did = 0; } else { $did = intval($_POST['did']); } $BattleReport = SimBattle($a, $d, $rf, $fid, $did, $debug, &$battle_result, &$aloss, &$dloss); } // -------------------------------------------------------------------------------------------------------------------------- // Таблица ввода параметров симуляции. function getval($name) { if ($_POST[$name] != "") { return "value=\"" . $_POST[$name] . "\" "; } } function getval2($arr, $id) { if ($_POST[$arr][$id] != 0) { return "value=\"" . $_POST[$arr][$id] . "\" "; } else { return ""; } } ?> <script language="JavaScript"> var maxslot = <?php echo $maxslot; ?> ; function toint (num) { if ( typeof (num) == "undefined" ) num = 0; return parseInt (num); } // Пересчитать количество атакующих и обороняющихся. function RecalcAttackersDefendersNum () { var anum = dnum = 1; var fleet = [ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215 ]; var defense = [ 401, 402, 403, 404, 405, 406, 407, 408 ]; for ( n=0; n<maxslot; n++ ) // Атакующие { sum = 0; for (var i in fleet) { value = toint (document.getElementById ( "a"+n+"_" + fleet[i] ).value); if ( value ) sum += value; } if ( sum > 0 ) anum = n + 1; } for ( n=0; n<maxslot; n++ ) // Обороняющиеся { sum = 0; for (var i in fleet) { value = toint (document.getElementById ( "d"+n+"_" + fleet[i] ).value); if ( value ) sum += value; } for (var i in defense) { value = toint (document.getElementById ( "d"+n+"_" + defense[i] ).value); if ( value ) sum += value; } if ( sum > 0 ) dnum = n + 1; } document.getElementById ( "anum" ).value = anum; document.getElementById ( "dnum" ).value = dnum; //alert ( "Атакующих : " + anum + ", Обороняющихся : " + dnum ); } // При смене слота - занести данные из массива слотов в ячейки ввода function OnChangeSlot (attacker) { var fleet = [ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215 ]; var defense = [ 401, 402, 403, 404, 405, 406, 407, 408 ]; if (attacker) { slot = document.simForm.aslot.value - 1; for (var i in fleet) { value = toint (document.getElementById ( "a"+slot+"_" + fleet[i] ).value); if (value) document.getElementById ( "a_" + fleet[i] ).value = value; else document.getElementById ( "a_" + fleet[i] ).value = ""; } } else { slot = document.simForm.dslot.value - 1; for (var i in fleet) { value = toint (document.getElementById ( "d"+slot+"_" + fleet[i] ).value); if ( value ) document.getElementById ( "d_" + fleet[i] ).value = value; else document.getElementById ( "d_" + fleet[i] ).value = ""; } for (var i in defense) { value = toint (document.getElementById ( "d"+slot+"_" + defense[i] ).value); if (value) document.getElementById ( "d_" + defense[i] ).value = value; else document.getElementById ( "d_" + defense[i] ).value = ""; } } } // При изменении ячейки - внести данные из неё в массив слотов function OnChangeValue (attacker, id) { if (attacker) { slot = document.simForm.aslot.value - 1; document.getElementById ( "a"+slot+"_" + id ).value = document.getElementById ( "a_" + id ).value; } else { slot = document.simForm.dslot.value - 1; document.getElementById ( "d"+slot+"_" + id ).value = document.getElementById ( "d_" + id ).value; } RecalcAttackersDefendersNum (); } RecalcAttackersDefendersNum (); </script> <?php echo AdminPanel(); ?> <table cellpadding=0 cellspacing=0> <form name="simForm" action="index.php?page=admin&session=<?php echo $session; ?> &mode=BattleSim" method="POST" > <?php for ($n = 0; $n < $maxslot; $n++) { foreach ($fleetmap as $i => $gid) { echo "<input type=\"hidden\" id=\"a" . $n . "_{$gid}\" name=\"a" . $n . "_{$gid}\" value=\"0\"> \n"; } foreach ($fleetmap as $i => $gid) { echo "<input type=\"hidden\" id=\"d" . $n . "_{$gid}\" name=\"d" . $n . "_{$gid}\" value=\"0\"> \n"; } foreach ($defmap as $i => $gid) { echo "<input type=\"hidden\" id=\"d" . $n . "_{$gid}\" name=\"d" . $n . "_{$gid}\" value=\"0\"> \n"; } echo "<input type=\"hidden\" id=\"a" . $n . "_weap\" name=\"a" . $n . "_weap\" size=2 > <input type=\"hidden\" id=\"a" . $n . "_shld\" name=\"a" . $n . "_shld\" size=2 > <input type=\"hidden\" id=\"a" . $n . "_armor\" name=\"a" . $n . "_armor\" size=2 > \n"; echo "<input type=\"hidden\" id=\"d" . $n . "_weap\" name=\"d" . $n . "_weap\" size=2 > <input type=\"hidden\" id=\"d" . $n . "_shld\" name=\"d" . $n . "_shld\" size=2 > <input type=\"hidden\" id=\"d" . $n . "_armor\" name=\"d" . $n . "_armor\" size=2 > \n"; } ?> <input type="hidden" id="anum" name="anum" value="1" /> <input type="hidden" id="anum" name="dnum" value="1" /> <tr> <td class=c>Атакующий</td> <td class=c>Оборояющийся</td> </tr> <tr> <td> Вооружение: <input id="a_weap" size=2 > Щиты: <input id="a_shld" size=2 > Броня: <input id="a_armor" size=2 ></td> <td> Вооружение: <input id="d_weap" size=2 > Щиты: <input id="d_shld" size=2 > Броня: <input id="d_armor" size=2 ></td> </tr> <tr> <th valign=top> <table> <?php echo "<tr><td class=c><b>Флот</b></td> "; if ($maxslot > 0) { echo "<td>Слот: <select name=\"aslot\" onchange=\"OnChangeSlot(1);\">\n"; for ($n = 1; $n <= $maxslot; $n++) { echo "<option value=\"{$n}\">{$n}</option>\n"; } echo "</select> </td> "; } echo " </tr>\n"; foreach ($fleetmap as $i => $gid) { ?> <tr><td> <?php echo loca("NAME_{$gid}"); ?> </td> <td> <input id="a_<?php echo $gid; ?> " size=5 onKeyUp="OnChangeValue(1, <?php echo $gid; ?> );"> </td> </tr> <?php } ?> <tr><td colspan=2> <table> <tr><td class=c colspan=2>Настройки</td></tr> <tr><td>Отладочная информация</td><td><input type="checkbox" name="debug" <? if($debug) echo "checked"; ?> ></td></tr> <tr><td>Скорострел</td><td><input type="checkbox" name="rapid" <? if($rf) echo "checked"; ?> ></td></tr> <tr><td>Флот в обломки</td><td><input name="fid" size=3 value="<?php echo $fid; ?> "> </td></tr> <tr><td>Оборона в обломки</td><td><input name="did" size=3 value="<?php echo $did; ?> "></td></tr> </table> </td></tr> </table> </th> <th valign=top> <table> <?php echo "<tr><td class=c><b>Флот</b></td>"; if ($maxslot > 0) { echo "<td>Слот: <select name=\"dslot\" onchange=\"OnChangeSlot(0);\">\n"; for ($n = 1; $n <= $maxslot; $n++) { echo "<option value=\"{$n}\">{$n}</option>\n"; } echo "</select> </td> "; } echo "</tr>\n"; foreach ($fleetmap as $i => $gid) { ?> <tr><td> <?php echo loca("NAME_{$gid}"); ?> </td> <td> <input id="d_<?php echo $gid; ?> " size=5 onKeyUp="OnChangeValue(0, <?php echo $gid; ?> );"> </td> </tr> <?php } echo "<tr><td class=c><b>Оборона</b></td></tr>\n"; foreach ($defmap as $i => $gid) { ?> <tr><td> <?php echo loca("NAME_{$gid}"); ?> </td> <td> <input id="d_<?php echo $gid; ?> " size=5 onKeyUp="OnChangeValue(0, <?php echo $gid; ?> );"> </td> </tr> <?php } ?> </table> </th></tr> <tr><td colspan=2><center><input type="submit" value="Начать бой"></center></td></tr> </form> </table> <?php if ($BattleReport !== "") { $a_result = array(0 => "combatreport_ididattack_iwon", 1 => "combatreport_ididattack_ilost", 2 => "combatreport_ididattack_draw"); $bericht = SendMessage($GlobalUser['player_id'], "Командование флотом", "Боевой доклад", $BattleReport, 6); MarkMessage($GlobalUser['player_id'], $bericht); $subj = "<a href=\"#\" onclick=\"fenster('index.php?page=bericht&session={$session}&bericht={$bericht}', 'Bericht_Kampf');\" ><span class=\"" . $a_result[$battle_result] . "\">Боевой доклад [" . $d[0]['g'] . ":" . $d[0]['s'] . ":" . $d[0]['p'] . "] (V:" . nicenum($dloss) . ",A:" . nicenum($aloss) . ")</span></a>"; echo "{$subj}<br>"; } ?> <?php }
function test_notif() { build_progress(15, "Send a test message..."); $sock = new sockets(); $users = new usersMenus(); $UfdbguardSMTPNotifs = unserialize(base64_decode($sock->GET_INFO("UfdbguardSMTPNotifs"))); $GLOBALS["PROGRESS"] = true; SendMessage("This is a test message ", "This is the body message", $UfdbguardSMTPNotifs); }
function RocketAttack($fleet_id, $planet_id) { global $UnitParam; $fleet = LoadFleet($fleet_id); $amount = $fleet['ipm_amount']; $primary = $fleet['ipm_target']; $origin = GetPlanet($fleet['start_planet']); $target = GetPlanet($planet_id); $origin_user = LoadUser($origin['owner_id']); $target_user = LoadUser($target['owner_id']); // Отбить атаку МПР перехватчиками $ipm = $amount; $abm = $target['d502']; $ipm = max(0, $ipm - $abm); $ipm_destroyed = $amount - $ipm; $target['d502'] -= $ipm_destroyed; $maxdamage = $ipm * 12000 * (1 + $origin_user['r109'] / 10); // Произвести атаку первичной цели if ($primary > 0 && $ipm > 0) { $armor = $UnitParam[$primary][0] * (1 + 0.1 * $target_user['r111']) / 10; $count = $target["d{$primary}"]; $destroyed = min(floor($maxdamage / $armor), $count); $target["d{$primary}"] -= $destroyed; $maxdamage -= $destroyed * $armor; $maxdamage -= $destroyed; } // Расчитать потери обороны, если еще остались МПР if ($maxdamage > 0) { $defmap = array(401, 402, 403, 404, 405, 406, 407, 408, 502, 503); foreach ($defmap as $i => $id) { if ($id == $primary) { continue; } $armor = $UnitParam[$id][0] * (1 + 0.1 * $target_user['r111']) / 10; $count = $target["d{$id}"]; if ($count == 0) { continue; } $destroyed = min(floor($maxdamage / $armor), $count); $target["d{$id}"] -= $destroyed; $maxdamage -= $destroyed * $armor; $maxdamage -= $destroyed; if ($maxdamage <= 0) { break; } } } // Записать назад потери обороны. SetPlanetDefense($planet_id, $target); // Изменить статистику игроков RecalcRanks(); $text = "{$amount} ракетам из общего числа выпущенных ракет с планеты " . $origin['name'] . " <a href=# onclick=showGalaxy(" . $origin['g'] . "," . $origin['s'] . "," . $origin['p'] . "); >[" . $origin['g'] . ":" . $origin['s'] . ":" . $origin['p'] . "]</a> "; $text .= "удалось попасть на Вашу планету " . $target['name'] . " <a href=# onclick=showGalaxy(" . $target['g'] . "," . $target['s'] . "," . $target['p'] . "); >[" . $target['g'] . ":" . $target['s'] . ":" . $target['p'] . "]</a> !<br>"; if ($ipm_destroyed) { $text .= "{$ipm_destroyed} ракет(-ы) было уничтожено Вашими ракетами-перехватчиками<br>:<br>"; } $defmap = array(503, 502, 408, 407, 406, 405, 404, 403, 402, 401); $text .= "<table width=400><tr><td class=c colspan=4>Поражённая оборона</td></tr>"; $n = 0; foreach ($defmap as $i => $gid) { if ($n % 2 == 0) { $text .= "</tr>"; } if ($target["d{$gid}"]) { $text .= "<td>" . loca("NAME_{$gid}") . "</td><td>" . nicenum($target["d{$gid}"]) . "</td>"; $n++; } } $text .= "</table><br>\n"; // Обновить активность на планете. $queue = GetFleetQueue($fleet_id); UpdatePlanetActivity($planet_id, $queue['end']); SendMessage($target_user['player_id'], "Командование флотом", "Ракетная атака", $text, 2); }
function AddUnionMember($union_id, $name) { global $db_prefix; global $GlobalUser; $union = LoadUnion($union_id); // Пустое имя, ничего не делаем. if ($name === "") { return ""; } // Достигнуто максимальное количество пользователей if ($union['players'] >= 5) { return "Участвовать могут максимум 5 игроков!"; } // Найти пользователя $name = mb_strtolower($name, 'UTF-8'); $query = "SELECT * FROM " . $db_prefix . "users WHERE name = '" . $name . "' LIMIT 1"; $result = dbquery($query); if (dbrows($result) == 0) { return "Пользователь не найден"; } $user = dbarray($result); // Проверить есть ли уже такой пользователь в САБе. for ($i = 0; $i <= $union['players']; $i++) { if ($union["player"][$i] == $user['player_id']) { return "Такой пользователь уже добавлен в союз"; } // есть. } // Проверить является ли пользователем другом или соалом. if (!IsBuddy($GlobalUser['player_id'], $user['player_id'])) { if ($user['ally_id']) { if ($user['ally_id'] != $GlobalUser['ally_id']) { return "Пользователь должен быть в списке друзей или одном альянсе"; } } else { return "Пользователь должен быть в списке друзей или одном альянсе"; } } // Добавить пользователя в САБ и послать ему сообщение о приглашении. $union['player'][$union['players']] = $user['player_id']; $query = "UPDATE " . $db_prefix . "union SET players = '" . implode(",", $union['player']) . "' WHERE union_id = {$union_id}"; dbquery($query); $target_player = LoadUser($union['target_player']); $head_fleet = LoadFleet($union['fleet_id']); $target_planet = GetPlanet($head_fleet['target_planet']); $queue = GetFleetQueue($union['fleet_id']); $text = va("#1 приглашает Вас на миссию #2 против игрока #3 на планете <a href=\"#\" onClick=showGalaxy(#4,#5,#6)><b><u>[#7:#8:#9]</u></b></a>. ", $GlobalUser['oname'], $union['name'], $target_player['oname'], $target_planet['g'], $target_planet['s'], $target_planet['p'], $target_planet['g'], $target_planet['s'], $target_planet['p']) . va("Прибытие флота назначено на #1. ВНИМАНИЕ: время прибытия может измениться из-за скорости других задействованных флотов!", date("D M Y H:i:s", $queue['end'])); SendMessage($user['player_id'], $GlobalUser['oname'], "Приглашение к совместной атаке", $text, 5); return ""; }
function PropagateBuildQueue($planet_id, $from) { global $db_prefix, $GlobalUni; $speed = $GlobalUni['speed']; $planet = GetPlanet($planet_id); $user = LoadUser($planet['owner_id']); $result = GetBuildQueue($planet_id); $cnt = dbrows($result); if ($cnt > 0) { while ($row = dbarray($result)) { $id = $row['tech_id']; $lvl = $row['level']; $destroy = $row['destroy']; $text = CanBuild($user, $planet, $id, $lvl, $destroy); if ($text === '') { // Списать ресурсы $res = BuildPrice($id, $lvl); $m = $res['m']; $k = $res['k']; $d = $res['d']; $e = $res['e']; AdjustResources($m, $k, $d, $planet_id, '-'); if ($destroy) { $BuildEvent = "Demolish"; } else { $BuildEvent = "Build"; } $duration = floor(BuildDuration($id, $lvl, $planet['b14'], $planet['b15'], $speed)); AddQueue($user['player_id'], $BuildEvent, $row['id'], $id, $lvl, $from, $duration, 20); // Обновить время запуска и окончания постройки $query = "UPDATE " . $db_prefix . "buildqueue SET start = {$from}, end = " . ($from + $duration) . " WHERE id = " . $row['id']; dbquery($query); break; } else { if ($destroy) { $pre = 'Заказ на снос'; } else { $pre = 'Заказ на строительство'; } $pre = va("#1 для Вашей постройки #2 #3-го уровня на #4 выполнить не удалось.", $pre, loca("NAME_{$id}"), $lvl, $planet['name'] . " <a href=\"javascript:showGalaxy(" . $planet['g'] . "," . $planet['s'] . "," . $planet['p'] . ")\" >[" . $planet['g'] . ":" . $planet['s'] . ":" . $planet['p'] . "]</a>"); SendMessage($user['player_id'], 'Системное сообщение', 'Производство отменено', $pre . "<br><br>" . $text, 5, $from); // удалить постройку, которую нельзя построить из очереди dbquery("DELETE FROM " . $db_prefix . "buildqueue WHERE id = " . $row['id']); // Корректировать уровень следующих построек. $query = "UPDATE " . $db_prefix . "buildqueue SET level = level - 1 WHERE tech_id = " . $row['tech_id'] . " AND planet_id = {$planet_id} AND list_id > " . $row['list_id']; dbquery($query); // Перегружаем очередь из БД. $result = GetBuildQueue($planet_id); } } } // cnt }
function SendNewUserMail($email) { $subject = "User Added - " . $email; $message = "Dear " . $email . "<br /><br />"; $message .= "Congratulations! You are now a part of the Mentored-Research Family. You have been added to the M-R database. To get started with your account, please <a href='http://mentored-research.com/login/signup.php' target='_blank'>Sign Up Here.</a>" . "<br /><br />"; $message .= "In case you face any issues, please put in a word to us at: guide@mentored-research.com <br /><br />"; $message .= "Team Mentored-Research<br />"; $message .= "info@mentored-research.com<br /><br />"; $message .= "Please do not reply to this automated mail.<br /><br />"; $res = SendMessage($email, $email, "*****@*****.**", "Mentored-Research", $subject, $message); }
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); //get response $output = curl_exec($ch); //Print error if any if (curl_errno($ch)) { echo 'error:' . curl_error($ch); } curl_close($ch); echo $output; } if (isset($_POST) && !empty($_POST)) { if (isset($_REQUEST['phone']) && !empty($_REQUEST['phone'])) { if (isset($_REQUEST['text']) && !empty($_REQUEST['text'])) { $mobile = $_REQUEST['phone']; $mess = $_REQUEST['text']; SendMessage($mobile, $mess); } else { echo "ERROR : Message not sent -- Text parameter is missing!\r\n"; } } else { echo "ERROR : Message not sent -- Phone parameter is missing!\r\n"; } } ?> <HTML> <HEAD><TITLE>Send SMS</TITLE></HEAD> <BODY> <form method="post" action="sendsms.php"> <table border="1">
<?php $phone = $_GET["phone"]; $verifyCode = $_GET["verifycode"]; SendMessage($phone, "您的验证码是:" . $verifyCode . ",欢迎注册通付宝用户。如需帮助请联系客服。"); echo "验证码已发送,60秒内未收到请重新获取"; function SendMessage($phone, $message) { $uid = "nicegan"; $pwd = "chengan"; $url = "http://www.106jiekou.com/webservice/sms.asmx/Submit"; $param = "account=" . $uid . "&password="******"&mobile=" . $phone . "&content=" . rawurlencode($message); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $param); $returnValue = curl_exec($ch); curl_close($ch); }
<?php // this is the file for all the AJAX requests that will be made from the client. //these are for the PHP Helper files include 'headers/databaseConn.php'; include 'helpers.php'; if (isset($_GET["no"]) && $_GET["no"] == "1") { SendMessage($_GET["name"], $_GET["email"], $_GET["phone"], $_GET["message"]); } else { if (isset($_GET["no"]) && $_GET["no"] == "2") { // to check if user exits in the user table. CheckUserSignup($_GET["name"], $_GET["email"]); } else { if (isset($_GET["no"]) && $_GET["no"] == "3") { // to check if user exits in the Register table. CheckUserRegistrationAndVerification($_GET["name"], $_GET["email"]); } else { if (isset($_GET["no"]) && $_GET["no"] == "4") { // to check if user exits in the Register table for logging in functionality. CheckUserRegistrationAndVerification($_GET["name"], $_GET["email"]); } else { if (isset($_GET["no"]) && $_GET["no"] == "5") { // to check if the coupon code exists in the database table or not! CheckCoupon($_GET["code"]); } else { if (isset($_POST["no"]) && $_POST["no"] == "6") { // to insert/update the userEmail and userName in the Register table. UserRegister($_POST["signemail"], $_POST["signname"], $_POST["signpwd"]); } else { if (isset($_GET["no"]) && $_GET["no"] == "7") { // for authentication of password from the Resgiter table during login.