Уборка Unreachable statement. Замена === на == и !== на != в яваскриптах из-за ошибок с нестрогой типизацией при переходе на 7.4.
This commit is contained in:
parent
0a8662c591
commit
3f3ffc2114
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
if(!defined('GAME')){
|
||||
die();
|
||||
}
|
||||
|
||||
die('Ошибка, смотри файл');
|
||||
|
||||
$dungeon_id = isset($_GET['dungeon_id']) ? intval($_GET['dungeon_id']) : '';
|
||||
|
||||
$dungeon_params = mysql_fetch_assoc(mysql_query("SELECT * FROM `dungeon_room` WHERE `id`='".$dungeon_id."'"));
|
||||
if($_POST['id']){
|
||||
$mysql_query = '';
|
||||
if($dungeon_id){
|
||||
$mysql_query .= "UPDATE `dungeon_room` SET ";
|
||||
$mysql_query .= "`id`='".$_POST['id']."',";
|
||||
$mysql_query .= "`dungeon_id`='".$_POST['dungeon_id']."',";
|
||||
$mysql_query .= "`dungeon_name`='".$_POST['dungeon_name']."' ";
|
||||
$mysql_query .= "`dungeon_room`='".$_POST['dungeon_room']."' ";
|
||||
$mysql_query .= "`dungeon_tag`='".$_POST['dungeon_tag']."' ";
|
||||
$mysql_query .= "`city`='".$_POST['city']."' ";
|
||||
$mysql_query .= "`shop`='".$_POST['shop']."' ";
|
||||
$mysql_query .= "`roomLeave`='".$_POST['roomLeave']."' ";
|
||||
$mysql_query .= "`active`='".$_POST['active']."' ";
|
||||
$mysql_query .= "`quest`='".$_POST['quest']."' ";
|
||||
$mysql_query .= "WHERE `id`='".$dungeon_id."'";
|
||||
}else{
|
||||
$mysql_query .= "INSERT INTO `dungeon_room` ";
|
||||
$mysql_query .= "(`id`,`dungeon_id`,`dungeon_name`,`dungeon_room`,`dungeon_tag`,`shop`,`roomLeave`,`active`,`quest`,`city`)";
|
||||
$mysql_query .= " VALUES ";
|
||||
$mysql_query .= "('".$_POST['id']."','".$_POST['dungeon_id']."','".$_POST['dungeon_name']."','".$_POST['dungeon_room']."','".$_POST['dungeon_tag']."','".$_POST['shop']."','".$_POST['roomLeave']."','".$_POST['active']."','".$_POST['quest']."','".$_POST['city']."');";
|
||||
}
|
||||
mysql_query($mysql_query);
|
||||
die("<script>window.location = 'index.php?mod=dungeon_list';</script>");
|
||||
}
|
||||
?><script src="https://<?= $c['img']; ?>/js/jx/jquery.js" type="text/javascript"></script>
|
||||
<div align="left">
|
||||
<h3 style="text-align:left;"><?= $dungeon_params['id'] ? 'Изменить' : 'Добавить'; ?> пещеру</h3>
|
||||
</div>
|
||||
<form method="post" action="">
|
||||
<table border="0" cellpadding="0" cellspacing="1">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><font color="red">*</font>ID подземелья: </td>
|
||||
<td><input name="dungeon_id" type="text" value="<?= $dungeon_params['dungeon_id']; ?>" size="5" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font color="red">*</font>Название пещеры: </td>
|
||||
<td><input name="dungeon_name" type="text" value="<?= $dungeon_params['dungeon_name']; ?>" size="30" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font color="red">*</font>Город: </td>
|
||||
<td><input name="city" type="text" value="<?= $dungeon_params['city']; ?>" size="30" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font color="red">*</font>Тэг: </td>
|
||||
<td><input name="dungeon_tag" type="text" value="<?= $dungeon_params['dungeon_tag']; ?>" size="30" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font color="red">*</font>ID локации (вход в подземелье): </td>
|
||||
<?php if($dungeon_params['id'] != 0) $room = mysql_fetch_assoc(mysql_query("SELECT id,name FROM `room` WHERE `id`='".$dungeon_params['id']."'")); else $room['name']=''; ?>
|
||||
<td><input name="id" type="text" value="<?= $dungeon_params['id']; ?>" size="5" maxlength="255"><i style="font-size:11px;color: brown;"> <?=$room['name']?></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font color="red">*</font>ID локации (подземелье): </td>
|
||||
<?php if($dungeon_params['dungeon_room'] != 0) $room = mysql_fetch_assoc(mysql_query("SELECT id,name FROM `room` WHERE `id`='".$dungeon_params['dungeon_room']."'")); else $room['name']=''; ?>
|
||||
<td><input name="dungeon_room" type="text" value="<?= $dungeon_params['dungeon_room']; ?>" size="5" maxlength="255"><i style="font-size:11px;color: brown;"> <?=$room['name']?></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ID Рыцарского магазина: </td>
|
||||
<?php if($dungeon_params['shop'] != 0) $room = mysql_fetch_assoc(mysql_query("SELECT id,name FROM `room` WHERE `id`='".$dungeon_params['shop']."'")); else $room['name']=''; ?>
|
||||
<td><input name="shop" type="text" value="<?= $dungeon_params['shop']; ?>" size="5" maxlength="255"><i style="font-size:11px;color: brown;"> <?=$room['name']?></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ID комнаты для выхода: </td>
|
||||
<?php if($dungeon_params['roomLeave'] != 0) $room = mysql_fetch_assoc(mysql_query("SELECT id,name FROM `room` WHERE `id`='".$dungeon_params['roomLeave']."'")); else $room['name']=''; ?>
|
||||
<td><input name="roomLeave" type="text" value="<?= $dungeon_params['roomLeave']; ?>" size="5" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Активна: </td>
|
||||
<td><select name="active"><option <?php if($dungeon_params['active']=='1') echo' selected="selected" '; ?>value="1">Да</option><option <?php if($dungeon_params['active']!='1') echo' selected="selected" ';?>value="0">Нет</option></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Включены квесты: </td>
|
||||
<td><select name="quest"><option <?php if($dungeon_params['quest']=='1') echo' selected="selected" '; ?>value="1">Да</option><option <?php if($dungeon_params['quest']!='1') echo' selected="selected" ';?>value="0">Нет</option></select></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p></p>
|
||||
<input name="submit" type="submit" value="Сохранить" style="width: 150px"/>
|
||||
<input name="cancel" type="submit" onclick="document.location='index.php?mod=dungeon_list'; return false;" value="Отмена" />
|
||||
<p><font color="red">*</font> - Обязательные поля </p>
|
||||
</form>
|
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="https://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
|
||||
<title>Документ без названия</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
die('Что-то тут не так...');
|
||||
|
||||
$dn = htmlspecialchars($_GET['dn']);
|
||||
//
|
||||
if(!mkdir('./dnew/'.$dn.'',0777,true)) {
|
||||
echo '[Директория '.$dn.' не создана]<br>';
|
||||
}
|
||||
//
|
||||
if(!mkdir('./dnew/'.$dn.'/Left',0777,true)) {
|
||||
echo '[Директория '.$dn.'/Left не создана]<br>';
|
||||
}
|
||||
if(!mkdir('./dnew/'.$dn.'/Right',0777,true)) {
|
||||
echo '[Директория '.$dn.'/Right не создана]<br>';
|
||||
}
|
||||
//
|
||||
if(!mkdir('./dnew/'.$dn.'/Left/Front',0777,true)) {
|
||||
echo '[Директория '.$dn.'/Left/Front не создана]<br>';
|
||||
}
|
||||
if(!mkdir('./dnew/'.$dn.'/Right/Front',0777,true)) {
|
||||
echo '[Директория '.$dn.'/Right/Front не создана]<br>';
|
||||
}
|
||||
|
||||
function save_img($img) {
|
||||
global $dn;
|
||||
$s = file_get_contents('//img.new-combats.tech/i/sprites/'.$dn.'/'.$img);
|
||||
file_put_contents('./dnew/'.$dn.'/'.$img , $s);
|
||||
}
|
||||
|
||||
save_img('bg0.gif');
|
||||
save_img('bg1.gif');
|
||||
|
||||
save_img('Left/4_1.gif');
|
||||
save_img('Right/4_1.gif');
|
||||
save_img('Left/4_0.gif');
|
||||
save_img('Right/4_0.gif');
|
||||
save_img('Left/Front/4_2.gif');
|
||||
save_img('Right/Front/4_2.gif');
|
||||
save_img('Left/Front/4_1.gif');
|
||||
save_img('Right/Front/4_1.gif');
|
||||
save_img('Left/Front/4_0.gif');
|
||||
save_img('Left/3_1.gif');
|
||||
save_img('Right/3_1.gif');
|
||||
save_img('Left/3_0.gif');
|
||||
save_img('Right/3_0.gif');
|
||||
save_img('Left/Front/3_1.gif');
|
||||
save_img('Right/Front/3_1.gif');
|
||||
save_img('Left/Front/3_0.gif');
|
||||
save_img('Left/2_0.gif');
|
||||
save_img('Right/2_0.gif');
|
||||
save_img('Left/Front/2_1.gif');
|
||||
save_img('Right/Front/2_1.gif');
|
||||
save_img('Left/Front/2_0.gif');
|
||||
save_img('Left/1_0.gif');
|
||||
save_img('Right/1_0.gif');
|
||||
save_img('Left/Front/1_1.gif');
|
||||
save_img('Right/Front/1_1.gif');
|
||||
save_img('Left/Front/1_0.gif');
|
||||
save_img('Left/0_0.gif');
|
||||
save_img('Right/0_0.gif');
|
||||
|
||||
echo '[Подземелье '.$dn.' скопировано!]';
|
||||
?>
|
@ -1,294 +0,0 @@
|
||||
<?php
|
||||
|
||||
die();
|
||||
|
||||
if (!isset($CRON_CORE)) {
|
||||
define('GAME', true);
|
||||
require_once('../../_incl_data/class/__db_connect.php');
|
||||
}
|
||||
|
||||
function e($t)
|
||||
{
|
||||
(new Chat())->debug($t, true);
|
||||
}
|
||||
|
||||
if (isset($_GET['cron_core'])) {
|
||||
$id = [
|
||||
'id' => $_GET['uid'],
|
||||
'pass' => $_GET['pass'],
|
||||
];
|
||||
if (md5($id['id'] . '_brfCOreW@!_' . $id['pass']) == $_GET['cron_core']) {
|
||||
$uzr = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT `id`,`login`,`pass` FROM `users` WHERE `id` = "' . mysql_real_escape_string(
|
||||
$id['id']
|
||||
) . '" AND `pass` = "' . mysql_real_escape_string($id['pass']) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($uzr['id'])) {
|
||||
$CRON_CORE = true;
|
||||
$_COOKIE['login'] = $uzr['login'];
|
||||
//$_COOKIE['pass'] = $uzr['pass'];
|
||||
$_POST['id'] = 'reflesh';
|
||||
}
|
||||
unset($uzr);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($CRON_CORE)) {
|
||||
header('Expires: Mon, 26 Jul 1970 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
}
|
||||
|
||||
if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' || isset($CRON_CORE)) {
|
||||
if (isset($_POST['atack'], $_POST['block']) || (isset($_POST['id']) && $_POST['id'] == 'reflesh') || isset($_POST['usepriem']) || isset($_POST['useitem'])) {
|
||||
session_start();
|
||||
$tm = microtime();
|
||||
$tm = explode(' ', $tm);
|
||||
$tm = $tm[0] + $tm[1];
|
||||
|
||||
if (!isset($CRON_CORE)) {
|
||||
require_once('../../_incl_data/__config.php');
|
||||
if ($_SESSION['tbr'] > $tm) {
|
||||
die('<script>ggcode="' . $code . '";if(t057!=null){clearTimeout(t057);}</script>');
|
||||
} else {
|
||||
$_SESSION['tbr'] = $tm + 0.350;
|
||||
}
|
||||
}
|
||||
|
||||
unset($tm);
|
||||
$js = '';
|
||||
$u = User::start();
|
||||
$magic = new Magic();
|
||||
$priem = new Priems();
|
||||
|
||||
if (!isset($CRON_CORE) && (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP']))) {
|
||||
die($c['exit']);
|
||||
}
|
||||
|
||||
function json_fix_cyr($json_str)
|
||||
{
|
||||
return $json_str;
|
||||
}
|
||||
|
||||
$u->stats = $u->getStats($u->info['id'], 0);
|
||||
|
||||
if (!isset($CRON_CORE)) {
|
||||
if ($u->info['online'] < time() - 30) {
|
||||
mysql_query(
|
||||
"UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time(
|
||||
) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1"
|
||||
);
|
||||
}
|
||||
}
|
||||
$btl = new Battle();
|
||||
require_once('log_text.php');
|
||||
$btl->is = $u->is;
|
||||
$btl->items = $u->items;
|
||||
$btl->info = $btl->battleInfo($u->info['battle']);
|
||||
if (!isset($btl->info['id'])) {
|
||||
if ($u->info['battle'] == -1) {
|
||||
//завершаем поединок
|
||||
$upd = mysql_query(
|
||||
'UPDATE `users` SET `battle` = "0",`online` = "' . time(
|
||||
) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
|
||||
);
|
||||
if (!$upd) {
|
||||
if (!isset($CRON_CORE)) {
|
||||
die('Ошибка завершения поединка.');
|
||||
}
|
||||
} else {
|
||||
echo '<script>location="main.php";</script>';
|
||||
}
|
||||
} else {
|
||||
mysql_query(
|
||||
'UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100'
|
||||
);
|
||||
if (!isset($CRON_CORE)) {
|
||||
die('<script>location="main.php";</script>');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//получаем массив с игроками в бою
|
||||
$btl->teamsTake();
|
||||
|
||||
if (isset($_POST['useitem'])) {
|
||||
$magic->useItems((int)$_POST['useitem']);
|
||||
if ($u->error != '') {
|
||||
echo '<font color=red><center><b>' . $u->error . '</b></center></font>';
|
||||
}
|
||||
}
|
||||
|
||||
//заносим удары,приемы,эффекты и т.д.
|
||||
//удар
|
||||
if (isset($_POST['atack']) && isset($_POST['block'])) {
|
||||
$btl->addAtack();
|
||||
}
|
||||
//прием
|
||||
if (isset($_POST['usepriem'])) {
|
||||
$priem->pruse($_POST['usepriem']);
|
||||
}
|
||||
//используем заклятие / пирожки
|
||||
|
||||
|
||||
//проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием)
|
||||
//if(!isset($_POST['usepriem'])) {
|
||||
$btl->testActions();
|
||||
//}
|
||||
//авто-смена противника, либо просто смена противника
|
||||
if ($u->stats['hpNow'] >= 1) {
|
||||
//ручная смена
|
||||
if (isset($_POST['smn']) && $_POST['smn'] != 'none') {
|
||||
/* ---------------- */
|
||||
$uidz = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT `id`,`inUser` FROM `users` WHERE `login` = "' . mysql_real_escape_string(
|
||||
$_POST['smn']
|
||||
) . '" AND `battle` = "' . $u->info['battle'] . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if ($uidz['inUser'] > 0) {
|
||||
$uidz['id'] = $uidz['inUser'];
|
||||
}
|
||||
$rsm = $btl->smena($uidz['id'], false);
|
||||
if ($rsm != 1) {
|
||||
echo '<font color=red><center><b>' . $rsm . '</b></center></font>';
|
||||
}
|
||||
unset($rsm);
|
||||
$js .= 'smena_login = \'none\';';
|
||||
}
|
||||
//авто-смена
|
||||
if ($u->info['enemy'] == 0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) {
|
||||
$btl->autoSmena();
|
||||
}
|
||||
} else {
|
||||
$btl->mainStatus = 3;
|
||||
}
|
||||
//получаем данные о поединке
|
||||
|
||||
//получаем данные о логе боя
|
||||
|
||||
//Если бой сыгран - завершаем
|
||||
if (!isset($_POST['usepriem'])) {
|
||||
if ($btl->info['team_win'] == -1) {
|
||||
$btl->testFinish();
|
||||
} else {
|
||||
$btl->testFinish();
|
||||
}
|
||||
}
|
||||
if ($btl->info['team_win'] == -1) {
|
||||
$js .= $btl->genTeams($u->info['id']);
|
||||
} else {
|
||||
$btl->mainStatus = 3;
|
||||
$btl->e = $u->btl_txt;
|
||||
}
|
||||
|
||||
if (!isset($CRON_CORE)) {
|
||||
$js .= $btl->myInfo($u->info['id'], 1);
|
||||
//выводим данные
|
||||
if ($btl->e != '') {
|
||||
echo '<font color="red"><center><b>' . $btl->e . '</b></center></font>';
|
||||
}
|
||||
if (isset($btl->ga[$u->info['id']][$u->info['enemy']])) {
|
||||
if ($u->info['hpNow'] >= 1) {
|
||||
$btl->mainStatus = 2;
|
||||
}
|
||||
} else {
|
||||
if ($u->info['enemy'] != 0 && $btl->info['team_win'] == -1 && $u->info['hpNow'] >= 1) {
|
||||
$js .= $btl->myInfo($u->info['enemy'], 2);
|
||||
}
|
||||
}
|
||||
if ($btl->info['izlom'] > 0) {
|
||||
$js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');';
|
||||
}
|
||||
$i = 1;
|
||||
while ($i <= 7) {
|
||||
if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) {
|
||||
$btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0;
|
||||
}
|
||||
if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) {
|
||||
$btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$atk1 = 0;
|
||||
if (!isset($CRON_CORE)) {
|
||||
$rsys = '';
|
||||
}
|
||||
if ($rsys != '') {
|
||||
$js .= $rsys;
|
||||
}
|
||||
unset($rsys);
|
||||
if (isset($btl->ga[$u->info['enemy']][$u->info['id']])) {
|
||||
$atk1 = 1;
|
||||
}
|
||||
}
|
||||
$rehtml = '';
|
||||
if (!isset($CRON_CORE)) {
|
||||
$js .= '$("#priems").html("' . $priem->seeMy(2) . '");';
|
||||
//if(!isset($_POST['usepriem'])) {
|
||||
$js .= $btl->lookLog();
|
||||
//}
|
||||
$rehtml .= '<script type="text/javascript">eatk=' . $atk1 . ';
|
||||
if(document.getElementById("nabito")!=undefined)
|
||||
{
|
||||
document.getElementById("nabito").innerHTML = "' . (floor(
|
||||
$btl->users[$btl->uids[$u->info['id']]]['battle_yron']
|
||||
)) . '";
|
||||
}
|
||||
if(document.getElementById("expmaybe")!=undefined)
|
||||
{
|
||||
document.getElementById("expmaybe").innerHTML = "' . (floor(
|
||||
$btl->users[$btl->uids[$u->info['id']]]['battle_exp']
|
||||
)) . '";
|
||||
}
|
||||
if(document.getElementById("timer_out")!=undefined)
|
||||
{
|
||||
document.getElementById("timer_out").innerHTML = "' . round(($btl->info['timeout'] / 60), 2) . '";
|
||||
}
|
||||
$(\'#pers_magic\').html("' . $u->btlMagicList() . '");
|
||||
g_iCount = 30;
|
||||
noconnect = 15;
|
||||
connect = 1;
|
||||
if(document.getElementById("go_btn")!=undefined)
|
||||
{
|
||||
document.getElementById("go_btn").disabled = "";
|
||||
}
|
||||
if(document.getElementById("reflesh_btn")!=undefined)
|
||||
{
|
||||
document.getElementById("reflesh_btn").disabled = "";
|
||||
}
|
||||
za = ' . (0 + $btl->stats[$btl->uids[$u->info['id']]]['zona']) . '; genZoneAtack();
|
||||
zb = ' . (0 + $btl->testZonbVis()) . '; genZoneBlock();
|
||||
refleshPoints();
|
||||
tactic(1,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic1']) . ');
|
||||
tactic(2,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic2']) . ');
|
||||
tactic(3,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic3']) . ');
|
||||
tactic(4,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic4']) . ');
|
||||
tactic(5,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic5']) . ');
|
||||
tactic(6,' . (0 + floor($btl->users[$btl->uids[$u->info['id']]]['tactic6'])) . ');
|
||||
smnpty=' . (0 + $u->info['smena']) . ';
|
||||
mainstatus(' . $btl->mainStatus . ');
|
||||
tactic(7,"' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic7']) . '");
|
||||
smena_alls = "0";
|
||||
ggcode="' . $code . '";
|
||||
' . $js . '
|
||||
</script>';
|
||||
|
||||
echo($rehtml);
|
||||
|
||||
if ($btl->cached == true) {
|
||||
$btl->clear_cache_start();
|
||||
}
|
||||
|
||||
unset($atk1);
|
||||
}
|
||||
echo '<script>ggcode="' . $code . '";if(t057!=null){clearTimeout(t057);}</script>';
|
||||
}
|
||||
}
|
||||
}
|
||||
//unlink($lock_file);
|
||||
?>
|
@ -1,469 +0,0 @@
|
||||
<?php
|
||||
if(!defined('GAME')){
|
||||
die();
|
||||
}
|
||||
|
||||
die();
|
||||
|
||||
|
||||
$re = '';
|
||||
if(isset($u->error2)){
|
||||
$re = $u->error2;
|
||||
}
|
||||
|
||||
if( isset($_GET['nightatack'])) {
|
||||
if( date('H') >= 22 || date('H') < 6 ) {
|
||||
if(
|
||||
$u->room['name'] == 'Центральная площадь' ||
|
||||
$u->room['name'] == 'Страшилкина улица' ||
|
||||
$u->room['name'] == 'Большая парковая улица' ||
|
||||
$u->room['name'] == 'Большая паркоторговая улица'
|
||||
) {
|
||||
|
||||
if($u->room['noatack'] == 0) {
|
||||
|
||||
$ua = mysql_fetch_array(mysql_query('SELECT `s`.*,`u`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `s`.`id` = `u`.`id` WHERE `u`.`login` = "'.mysql_real_escape_string($_GET['login']).'" LIMIT 1'));
|
||||
|
||||
if(isset($ua['id']) && $ua['online'] > time()-520){
|
||||
$usta = $u->getStats($ua['id'],0); // статы цели
|
||||
$minHp = $usta['hpAll']/100*33; // минимальный запас здоровья цели при котором можно напасть
|
||||
|
||||
if( $ua['battle'] > 0 ){
|
||||
$uabt = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "'.$ua['battle'].'" AND `team_win` = "-1" LIMIT 1'));
|
||||
if(!isset($uabt['id'])) {
|
||||
$ua['battle'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if( $ua['level'] < 4 ) {
|
||||
$re = 'Новички находятся под защитой Мироздателя...';
|
||||
}elseif($ua['room']==$u->info['room'] && ($minHp <= $usta['hpNow'] || $ua['battle'] > 0)){
|
||||
if( $ua['type_pers'] == 0 ) {
|
||||
if( $cruw == 2 ) {
|
||||
$ua['type_pers'] = 99;
|
||||
}else{
|
||||
$ua['type_pers'] = 50;
|
||||
}
|
||||
}
|
||||
if( $ua['no_ip'] == 'trupojor' ) {
|
||||
$ua['type_pers'] = 500;
|
||||
}
|
||||
$magic->atackUser($u->info['id'],$ua['id'],$ua['team'],$ua['battle'],$ua['bbexp'],$ua['type_pers']);
|
||||
|
||||
if( $cruw == 2 ) {
|
||||
$rtxt = '[img[items/pal_button9.gif]] "'.$u->info['login'].'" совершил'.$sx.' кровавое нападение на персонажа "'.$ua['login'].'".';
|
||||
}else{
|
||||
$rtxt = '[img[items/pal_button8.gif]] "'.$u->info['login'].'" совершил'.$sx.' нападение на персонажа "'.$ua['login'].'".';
|
||||
}
|
||||
|
||||
$cmsg = new ChatMessage();
|
||||
$cmsg->setCity($u->info['city']);
|
||||
$cmsg->setRoom($u->info['room']);
|
||||
$cmsg->setText($rtxt);
|
||||
$cmsg->setType(6);
|
||||
$cmsg->setTypeTime(1);
|
||||
(new Chat())->sendMsg($cmsg);
|
||||
|
||||
header('location: main.php');
|
||||
die();
|
||||
}else{
|
||||
if($ua['room']!=$u->info['room']){
|
||||
//Персонаж в другой комнате
|
||||
$u->error = 'Персонаж находится в другой комнате';
|
||||
}else{
|
||||
$u->error = 'Персонаж имеет слишком малый уровень жизней.';
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//На персонажа нельзя напасть
|
||||
$u->error = 'Персонаж не в игре, либо на нем нет метки';
|
||||
}
|
||||
}
|
||||
$u->error = 'Вам запрещается атаковать без разрешения...';
|
||||
$re = $u->error;
|
||||
|
||||
}else{
|
||||
$re = 'Нападать возможно только на улице...';
|
||||
}
|
||||
}else{
|
||||
$re = 'Нападения возможны только ночью...';
|
||||
}
|
||||
}
|
||||
|
||||
function thisInfRm($id,$tp = NULL)
|
||||
{
|
||||
global $u;
|
||||
$rm = mysql_fetch_array(mysql_query('SELECT * FROM `room` WHERE `code` = "'.mysql_real_escape_string($id).'" AND `city` = "'.$u->info['city'].'" LIMIT 1'));
|
||||
$inf = 'Здание было разрушено';
|
||||
if(isset($rm['id']))
|
||||
{
|
||||
$rown = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `online` > '.(time()-120).' AND `city` = "'.$u->info['city'].'" AND `room` = "'.$rm['id'].'"'));
|
||||
if($tp==NULL)
|
||||
{
|
||||
$inf = '<b>'.$rm['name'].'</b><br>Сейчас в комнате '.(0+$rown[0]).' чел.';
|
||||
}else{
|
||||
$inf = ''.$rm['name'].'
|
||||
Сейчас в комнате '.(0+$rown[0]).' чел.';
|
||||
}
|
||||
}
|
||||
if($tp==NULL)
|
||||
{
|
||||
echo 'onMouseOver="top.hi(this,\'<div align=right>'.$inf.'</div>\',event,0,1,1,1,\'max-height:240px\');" onMouseOut="top.hic();" onMouseDown="top.hic();" onClick="goLocal(\'main.php?loc='.$rm['code'].'\',\''.$rm['name'].'\');"';
|
||||
}else{
|
||||
echo $inf;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_GET['loc']))
|
||||
{
|
||||
$go = mysql_fetch_array(mysql_query('SELECT * FROM `room` WHERE `code` = "'.mysql_real_escape_string($_GET['loc']).'" AND `city` = "'.$u->info['city'].'" LIMIT 1'));
|
||||
if($u->info['id']=='340379' or $u->info['id']=='399105'){
|
||||
//print_r($u->info);
|
||||
}
|
||||
if($u->info['align'] == 2 && $go['nochaos'] == 1){
|
||||
$re = 'Проход для хаосников закрыт!';
|
||||
}elseif($u->info['inTurnir'] > 0){
|
||||
$re = 'Вы не можете перемещаться, Вы приняли заявку на турнир ...';
|
||||
}elseif($u->aves['now']>=$u->aves['max'] && $u->room['name']!='Общежитие' && $u->room['name']!='Общ. Этаж 1' && $u->room['name']!='Общ. Этаж 2' && $u->room['name']!='Общ. Этаж 3'){
|
||||
$re = 'Вы не можете перемещаться, рюкзак переполнен ...';
|
||||
}elseif(isset($go['id'])){
|
||||
$rmgo = array();
|
||||
$rg = explode(',',$u->room['roomGo']);
|
||||
$mlvl = explode('-',$go['level']);
|
||||
$i = 0;
|
||||
while($i<count($rg)){
|
||||
if($rg[$i]>=0){
|
||||
$rmgo[$rg[$i]] = 1;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$sleep = $u->testAction('`vars` = "sleep" AND `uid` = "'.$u->info['id'].'" LIMIT 1',1);
|
||||
if(isset($sleep['id']) && $sleep['vars']=='sleep'){
|
||||
$re = 'Вы моежете перемещаться только когда бодрствуете.';
|
||||
}elseif($u->info['timeGo']>=time()){
|
||||
$re = 'Вы не можете перемещаться еще '.($u->info['timeGo']-time()).' сек.';
|
||||
}elseif($rmgo[$go['id']]==1 || $u->info['admin']>0){
|
||||
$alg = explode('-',$go['align']);
|
||||
if(($alg[0] > $u->info['align'] || $alg[1] < $u->info['align']) && $go['align']!=0 && $u->info['admin'] == 0){
|
||||
$re = 'Вы не можете попасть в эту комнату';
|
||||
}elseif($u->info['zv']>0){
|
||||
$re = 'Подали заявку и убегаем?.. Не хорошо!';
|
||||
}elseif((($go['clan'] > 0 && $u->info['clan'] != $go['clan']) || ($go['clan'] == -1 && $u->info['clan'] == 0)) && $u->info['admin'] == 0){
|
||||
$re = 'Вы не можете попасть в эту комнату';
|
||||
}elseif($go['sex']>0 && $go['sex']-1!=$u->info['sex'] && $u->info['invis'] != 1 && $u->info['invis'] < time() && $u->info['admin'] == 0){
|
||||
$re = 'Вы не можете попасть в эту комнату';
|
||||
}elseif($mlvl[0]>$u->info['level'] && $u->info['admin']==0){
|
||||
$re = 'Вы не можете попасть в эту комнату, уровень маловат ;)';
|
||||
}elseif($mlvl[1]<$u->info['level'] && $u->info['admin']==0){
|
||||
$re = 'Вы не можете попасть в эту комнату, уровень высоковат ;)';
|
||||
}elseif($go['close']==0 || $u->info['admin']>0){
|
||||
$travms = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" and (`v1`="2" or `v1`="3") and `delete`=0 ORDER by v1 DESC'));
|
||||
|
||||
//замедление перемешения при травмах
|
||||
$plus_timeGo=0; // добавочное время при травме
|
||||
$tr_nogo=false; // нету запрещения перемещения по травме
|
||||
if($travms['v1']==3){
|
||||
// тяжелая травма
|
||||
$kostyls = mysql_query('SELECT * FROM `items_users` WHERE `uid`="'.$u->info['id'].'" and `inOdet`!="0" and (`item_id`="630" or `item_id`="631")');
|
||||
if(mysql_num_rows($kostyls)==2){
|
||||
$plus_timeGo=30;
|
||||
}else{
|
||||
$tr_nogo=true;
|
||||
}
|
||||
|
||||
}elseif($travms['v1']==2){
|
||||
//средняя
|
||||
$plus_timeGo=20;
|
||||
}
|
||||
//end freez time go
|
||||
|
||||
if($tr_nogo==false){
|
||||
$u->info['timeGo'] = time()+$go['timeGO']+$plus_timeGo;
|
||||
$u->info['timeGoL'] = time();
|
||||
$upd = mysql_query('UPDATE `stats` SET `timeGo` = "'.$u->info['timeGo'].'",`timeGoL` = "'.$u->info['timeGoL'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
|
||||
}
|
||||
if($upd){
|
||||
$upd2 = mysql_query('UPDATE `users` SET `room` = "'.$go['id'].'",`online` = "'.time().'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
|
||||
if($upd2){
|
||||
if( $u->room['file'] == 'bsenter' && $go['file'] != 'bsenter' ) {
|
||||
//Удаляем все ставки в БС
|
||||
$sp_bs = mysql_query('SELECT `id`,`bsid`,`money` FROM `bs_zv` WHERE `uid` = "'.$u->info['id'].'" AND `inBot` = "0" AND `finish` = "0"');
|
||||
while( $pl_bs = mysql_fetch_array($sp_bs) ) {
|
||||
mysql_query('UPDATE `bs_turnirs` SET `users` = `users` - 1 WHERE `id` = "'.$pl_bs['bsid'].'" LIMIT 1');
|
||||
}
|
||||
unset($sp_bs,$pl_bs);
|
||||
mysql_query('UPDATE `bs_zv` SET `finish` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `inBot` = "0" AND `finish` = "0"');
|
||||
}
|
||||
|
||||
$smt = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.(time()-600).' AND `vars` = "create_snowball_cp" LIMIT 1',1);
|
||||
if(isset($smt['id'])){
|
||||
mysql_query('DELETE FROM `actions` WHERE `id` = "'.$smt['id'].'" LIMIT 1');
|
||||
}
|
||||
mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id_eff` = "24" AND `uid` = "'.$u->info['id'].'" AND `delete` = "0" LIMIT 24');
|
||||
|
||||
$u->info['room'] = $go['id'];
|
||||
$u->room = $go;
|
||||
echo '<script>top.chat.reflesh();</script>';
|
||||
}else{
|
||||
$re = 'Вы не смогли перейти в локацию, возможно она была разрушена';
|
||||
}
|
||||
}elseif($tr_nogo==true){
|
||||
$re = 'Вы травмированны. Не возможно с такими увечиями передвигатся без костылей.';
|
||||
}else{
|
||||
$re = 'Вы не смогли перейти в локацию';
|
||||
}
|
||||
}elseif($go['destroy']==1){
|
||||
$re = 'Здание было разрушено, в данный момент оно реставрируется';
|
||||
}else{
|
||||
$re = 'Временно закрыто';
|
||||
}
|
||||
}else{
|
||||
$re = 'Проход не существует';
|
||||
}
|
||||
}else{
|
||||
$re = 'Проход не существует';
|
||||
}
|
||||
}
|
||||
|
||||
if($u->info['room']==209){
|
||||
$zv = new FightRequest();
|
||||
}
|
||||
|
||||
if($re!=''){
|
||||
$re = $re.' ';
|
||||
}
|
||||
?><svg height="0" xmlns="https://www.w3.org/2000/svg">
|
||||
<filter id="drop-shadow">
|
||||
<feGaussianBlur in="SourceAlpha" stdDeviation="2"/>
|
||||
<feOffset dx="0" dy="0" result="offsetblur"/>
|
||||
<feFlood flood-color="rgba(255,255,255,1)"/>
|
||||
<feComposite in2="offsetblur" operator="in"/>
|
||||
<feMerge>
|
||||
<feMergeNode/>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
</svg>
|
||||
<style>
|
||||
.MoveLine {
|
||||
background:url(//img.new-combats.tech/i/move/wait2.gif) 0px 0px repeat-y;
|
||||
height:6px;
|
||||
}
|
||||
.aFilter {
|
||||
|
||||
}
|
||||
.aFilter:hover {
|
||||
-webkit-filter: drop-shadow(0px 0px 2px rgba(255,255,255,1));
|
||||
filter: url(#drop-shadow);
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=0, OffY=0, Color='#FFF')";
|
||||
filter: "progid:DXImageTransform.Microsoft.Dropshadow(OffX=0, OffY=0, Color='#FFF')";
|
||||
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="js/jquery.js"></script>
|
||||
<script>
|
||||
var speedLoc = 0;
|
||||
var sLoc1 = 0;
|
||||
var sLoc2 = 0;
|
||||
var tgo = 0;
|
||||
var tgol = 0;
|
||||
var rgo_url = 0;
|
||||
var rgo_nm = '';
|
||||
function locGoLine()
|
||||
{
|
||||
var line = document.getElementById('MoveLine');
|
||||
if(line!=undefined)
|
||||
{
|
||||
prc = 100-Math.floor(tgo/tgol*100);
|
||||
sLoc1 = 64/100*prc;
|
||||
if(sLoc1<0)
|
||||
{
|
||||
sLoc1 = 0;
|
||||
}
|
||||
if(sLoc1>64)
|
||||
{
|
||||
sLoc1 = 64;
|
||||
}
|
||||
line.style.width = sLoc1+'px';
|
||||
if(tgo>0)
|
||||
{
|
||||
tgo -= 1;
|
||||
setTimeout('locGoLine()',100);
|
||||
}else{
|
||||
if(rgo_url != 0) {
|
||||
location = rgo_url;
|
||||
}
|
||||
}
|
||||
if($('#moveto') != null && $('#moveto') != undefined) {
|
||||
if(rgo_nm != '') {
|
||||
if( $('#moveto').html() == '' ) {
|
||||
$('#moveto').css({'display':'','height':'auto'});
|
||||
$('#moveto').html('<div onclick="gotoLocationCancel();" style="cursor:pointer;padding:5px;">Вы перейдете в: <b>' + rgo_nm + '</b> (<a onclick="gotoLocationCancel();" href="javascript:void(0)">отмена</a>)</div>');
|
||||
}
|
||||
}else{
|
||||
$('#moveto').css({'display':'none','height':'1px'});
|
||||
$('#moveto').html('');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function goLocal(id,nm) {
|
||||
rgo_url = id;
|
||||
rgo_nm = nm;
|
||||
if($('#moveto') != null && $('#moveto') != undefined && nm != undefined) {
|
||||
if(rgo_nm != '') {
|
||||
$('#moveto').css({'display':'','height':'auto'});
|
||||
$('#moveto').html('<div onclick="gotoLocationCancel(); return false;" style="cursor:pointer;padding:5px;">Вы перейдете в: <b>' + nm + '</b> (<a onclick="gotoLocationCancel();" href="javascript:void(0)">отмена</a>)</div>');
|
||||
if(sLoc1 == 64) {
|
||||
location = rgo_url;
|
||||
}
|
||||
}else{
|
||||
$('#moveto').css({'display':'none','height':'1px'});
|
||||
$('#moveto').html('');
|
||||
}
|
||||
}
|
||||
}
|
||||
function gotoLocationCancel() {
|
||||
rgo_url = 0;
|
||||
rgo_nm = '';
|
||||
$('#moveto').css({'display':'none','height':'1px'});
|
||||
$('#moveto').html('');
|
||||
}
|
||||
</script><?php
|
||||
if(date('m') == 12 || date('m') == 1 || date('m') == 2) {
|
||||
$rsnow = array(
|
||||
/*234 => 1,
|
||||
267 => 1,
|
||||
9 => 1,
|
||||
286 => 1,
|
||||
11 => 1,
|
||||
236 => 1,
|
||||
213 => 1,
|
||||
252 => 1*/
|
||||
);
|
||||
if($rsnow[$u->room['id']]==1) {
|
||||
?>
|
||||
<script>
|
||||
var no = 50; // snow number
|
||||
var speed = 17; // smaller number moves the snow faster
|
||||
var sp_rel = 1.4; //speed relevation
|
||||
var snowflake1 = "/i/itimeges/snow1.gif";
|
||||
var snowflake2 = "/i/itimeges/snow2.gif";
|
||||
|
||||
var i, doc_width, doc_height;
|
||||
|
||||
dx = new Array();
|
||||
xp = new Array();
|
||||
yp = new Array();
|
||||
am = new Array();
|
||||
stx = new Array();
|
||||
sty = new Array();
|
||||
|
||||
Array.prototype.exists = function(el){
|
||||
for(var i=0;i<this.length;i++)
|
||||
if(this[i]==el)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
var rooms = ['1.100', '1.107', '1.111', '1.120'];
|
||||
|
||||
function SetVariable(c) {
|
||||
dx[c] = 0; // set coordinate variables
|
||||
am[c] = Math.random()*15; // set amplitude variables
|
||||
xp[c] = Math.random()*(doc_width-35) + 0 + am[c]; // set position variables
|
||||
yp[c] = 0;
|
||||
stx[c] = 0.02 + Math.random()/10; // set step variables
|
||||
sty[c] = 0.7 + Math.random(); // set step variables
|
||||
}
|
||||
|
||||
function DrawWeather(room) {
|
||||
|
||||
doc_width = document.getElementById('img_ione').width;
|
||||
doc_height = document.getElementById('img_ione').height;
|
||||
|
||||
var div = '';
|
||||
for (i = 0; i < no; ++ i) {
|
||||
SetVariable(i);
|
||||
div += "<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: 30" + i +"; VISIBILITY: visible; TOP: " + 0 + "px; LEFT: " + 0 + "px;\"><img id=\"im"+ i +"\" src=\"" + (sty[i]<sp_rel ? snowflake2 : snowflake1 ) + "\" border=\"0\" alt=\"Снежинка\"></div>";
|
||||
}
|
||||
|
||||
document.getElementById('snow').innerHTML = div;
|
||||
return 1;
|
||||
}
|
||||
|
||||
function WeatherBegin() { // IE main animation function
|
||||
|
||||
for (i = 0; i < no; ++ i) { // iterate for every dot
|
||||
yp[i] += sty[i] < sp_rel ? sty[i]/2 : sty[i];
|
||||
if (yp[i] > doc_height-40) {
|
||||
SetVariable(i);
|
||||
var im = document.getElementById('im'+i);
|
||||
im.src = (sty[i] < sp_rel) ? snowflake2 : snowflake1;
|
||||
}
|
||||
dx[i] += stx[i];
|
||||
document.getElementById('dot'+i).style.top = yp[i]+'px';
|
||||
document.getElementById('dot'+i).style.left = xp[i] + am[i]*Math.sin(dx[i])+'px';
|
||||
}
|
||||
setTimeout('WeatherBegin()', speed);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($u->room['id'])){
|
||||
$tmGo = $u->info['timeGo']-time()+1; //сколько секунд осталось
|
||||
$tmGol = $u->info['timeGo']-$u->info['timeGoL']+1; //сколько секунд идти всего
|
||||
if($tmGo<0){
|
||||
$tmGo = 0;
|
||||
}
|
||||
if($tmGol<1){
|
||||
$tmGol = 1;
|
||||
}
|
||||
//онлайн в этой комнате
|
||||
$goLis = '<table height="15" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td id="locobobr" rowspan="3" valign="bottom"><a href="main.php?rnd='.$code.'"><img style="display:block;" src="//img.new-combats.tech/i/move/rel_1.gif" width="15" height="16" title="Обновить" border="0" /></a></td>
|
||||
<td colspan="3"><img style="display:block;" src="//img.new-combats.tech/i/move/navigatin_462s.gif" width="80" height="4" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img style="display:block;" src="//img.new-combats.tech/i/move/navigatin_481.gif" width="9" height="8" /></td>
|
||||
<td width="64" bgcolor="black"><img src="//img.new-combats.tech/1x1.gif" style="display:block;" id="MoveLine" height="8" class="MoveLine" style="width:33px;" /></td>
|
||||
<td><img style="display:block;" src="//img.new-combats.tech/i/move/navigatin_50.gif" width="7" height="8" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><img style="display:block;" src="//img.new-combats.tech/i/move/navigatin_tt1_532.gif" width="80" height="4" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="test"></div><script>var tgo = '.($tmGo*10).'; var tgol = '.($tmGol*10).';locGoLine();</script>';
|
||||
|
||||
$goline = '<div style="position:absolute; top:0px; z-index:101; right:12px; width:80px;">
|
||||
'.$goLis.'
|
||||
</div>';
|
||||
$rowonmax = '';
|
||||
$rowonmax2 = 0;
|
||||
|
||||
$rowonmax2 = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `online` > '.(time()-520).' AND `inUser` = "0" AND `city` = "'.$u->info['city'].'" AND `no_ip` != "trupojor" LIMIT 1'));
|
||||
$rowonmax = 'Сейчас в городе: '.$rowonmax2[0].' чел.';
|
||||
$rowonmax = ''.$rowonmax.'';
|
||||
$rowonmax2c = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `online` > '.(time()-520).' AND `inUser` = "0" AND `no_ip` != "trupojor" LIMIT 1'));
|
||||
$rowonmax3c = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `online` > '.(time()-520).' AND `inUser` = "0" AND `no_ip` != "trupojor" LIMIT 1'));
|
||||
$rowonmaxc = 'Всего в Игре: '.$rowonmax2c[0].' чел.';
|
||||
$rowonmaxc = ''.$rowonmaxc.'';
|
||||
|
||||
//$rowonmaxc = '';
|
||||
//$rowonmax = '<span title="Сейчас в городе: '.$rowonmax3c[0].' чел.">'.$rowonmax.'</span>';
|
||||
unset($sil,$pil,$rowonmax2);
|
||||
if($u->room['file']!=''){
|
||||
include_once('modules_data/location/'.$u->room['file'].'.php');
|
||||
if((date('m') == 12 || date('m') == 1 || date('m') == 2) && $rsnow[$u->room['id']]==1) {
|
||||
echo '<script>DrawWeather(31);WeatherBegin();</script>';
|
||||
}
|
||||
echo '<div align="right">'.$c['counters'].'</div>';
|
||||
}
|
||||
}else{
|
||||
echo 'Location is lost.';
|
||||
}
|
@ -1,592 +0,0 @@
|
||||
<script type="text/javascript" src="js/commoninf.js"></script>
|
||||
<?php
|
||||
|
||||
die();
|
||||
|
||||
if(!defined('GAME'))
|
||||
{
|
||||
die();
|
||||
}
|
||||
session_start();
|
||||
// реализуем странички https://www.php.su/articles/?cat=examples&page=062
|
||||
|
||||
function bug_user($id){
|
||||
// Загружаем информацию об авторе
|
||||
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".mysql_real_escape_string($id)."' LIMIT 1;"));
|
||||
return $user;
|
||||
}
|
||||
function bug_clan($id){
|
||||
// Догружаем информацию об клане
|
||||
$clan = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id` = '".mysql_real_escape_string($id)."' LIMIT 1;"));
|
||||
return $clan;
|
||||
}
|
||||
|
||||
function bug_moder($align){ // Проверка склонности на модератора
|
||||
$data = mysql_fetch_array(mysql_query("SELECT `id` FROM `moder` WHERE `align` = '".mysql_real_escape_string($align)."' LIMIT 1;"));
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
function bug_classPost($admin, $id, $data, $readUser, $readAdmin, $readModer, $new){
|
||||
if($admin==1){
|
||||
$checkPost='admPost';
|
||||
} elseif(isset($data) AND $data!=0) {
|
||||
$checkPost='admPost moder';
|
||||
} else {
|
||||
$checkPost='userPost';
|
||||
}
|
||||
|
||||
$user2=bug_user($id);
|
||||
$data2=bug_moder($user2['align']);
|
||||
|
||||
if($new>='1'){
|
||||
$checkPost.=' new';
|
||||
} elseif($readAdmin==1 OR $readModer==1 OR $readUser==1){
|
||||
if($user2['admin']==1 AND $readAdmin>='1') {$checkPost.=' hot ad ';}
|
||||
|
||||
if($readModer=='1' AND (isset($data2) AND $data2!=0)){$checkPost.=' hot m';}
|
||||
|
||||
if($readUser=='1' AND ($user2['admin']==0 AND (!isset($data2) OR $data2==0))){$checkPost.=' hot u';} else {$checkPost.='';}
|
||||
}
|
||||
return $checkPost;
|
||||
}
|
||||
function bug_type($type){
|
||||
if(isset($type)){
|
||||
if($type==1){$tiType="Игровые вопросы";}
|
||||
elseif($type==2){$tiType="Ошибки мироздания";}
|
||||
elseif($type==3){$tiType="Орден света";}
|
||||
elseif($type==4){$tiType="Предложения";}
|
||||
elseif($type==5){$tiType="Другое";}
|
||||
else {$tiType='Нет';}
|
||||
} else {
|
||||
$tiType='Тема не задана';
|
||||
}
|
||||
return $tiType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function bug_userinfo($login, $id, $level, $align, $clanname){
|
||||
// Проверяем на существование персонажа и выводим информацию о нем в HTML код
|
||||
if(isset($login)){
|
||||
$userinfo = "<SCRIPT>drwfl('".$login."', '".$id."','".$level."','".$align."','".$clanname."')</SCRIPT>";
|
||||
} else {
|
||||
$userinfo = '<span style=" FONT-WEIGHT: bold;color: #000;font-size: 10pt;">[Игрок не найден]</span>';
|
||||
}
|
||||
return $userinfo;
|
||||
}
|
||||
|
||||
function bug_upView($id) {
|
||||
//$q = mysql_query("UPDATE `bags` SET readUser='0' WHERE id='".$id."'") or die ("<span style='color:red'>Ошибка при выполнении запроса</span>: ".mysql_error ());
|
||||
}
|
||||
|
||||
function bug_filter_area($id, $page){
|
||||
if(isset($_POST['opt1']) OR $_GET['type']==1){$f1=" checked";}
|
||||
if(isset($_POST['opt2']) OR $_GET['type']==2){$f2=" checked";}
|
||||
if(isset($_POST['opt3']) OR $_GET['type']==3){$f3=" checked";}
|
||||
if(isset($_POST['opt4']) OR $_GET['type']==4){$f4=" checked";}
|
||||
if(isset($_POST['opt5']) OR $_GET['type']==5){$f5=" checked";}
|
||||
if($_POST['delete']==1 OR $_COOKIE['delete']==1){$f6=" checked";}
|
||||
|
||||
$filter="<style>input[type=\"checkbox\"]{padding:5px;}</style>";
|
||||
$filter.="<form style=\"padding-top:4px;display:inline-block; margin:6px 30px;\" method=\"post\" action=\"main.php?bagreport=1\">";
|
||||
$filter.="<input type=\"checkbox\" name=\"opt1\" id=\"check1\" value=\"1\" ".$f1."><label for=\"check1\">[Игровые вопросы]</label><br/>";
|
||||
$filter.="<input type=\"checkbox\" id=\"check2\" name=\"opt2\" value=\"2\" ".$f2."><label for=\"check2\">[Ошибки мироздания]</label><br/>";
|
||||
$filter.="<input type=\"checkbox\" name=\"opt3\" value=\"3\" id=\"check3\" ".$f3."><label for=\"check3\">[Орден света(и жалобы на них)]</label><br/>";
|
||||
$filter.="<input type=\"checkbox\" id=\"check4\" name=\"opt4\" value=\"4\" ".$f4."><label for=\"check4\">[Предложения(без ответов)]</label><br/>";
|
||||
$filter.="<input type=\"checkbox\" id=\"check5\" name=\"opt5\" value=\"5\" ".$f5."><label for=\"check5\">[Другое]</label><br/><br/>";
|
||||
$filter.="<input type=\"checkbox\" id=\"delete1\" name=\"delete\" value=\"1\" ".$f6."><label for=\"delete1\">Отображать закрытые темы?</label><br/><br/>";
|
||||
$filter.=" на странице: <select name=\"limit\" onchange='this.form.submit()'><option value=\"".$_POST['limit']."\">".$_POST['limit']."</option>";
|
||||
if ($_POST['limit']>5){$filter.="<option value=\"5\">5</option> ";}$filter.="<option value=\"10\">10</option><option value=\"20\">20</option><option value=\"30\">30</option><option value=\"40\">40</option><option value=\"50\">50</option></select>";
|
||||
|
||||
$filter.=" страница: <select name=\"page\" onchange='this.form.submit()'>";
|
||||
|
||||
for($i=1;$i<=$page;$i++){
|
||||
if($_POST['page']==$i){
|
||||
$filter.="<option value=\"".$i."\" selected=\"selected\">".$i."</option>";
|
||||
} else {
|
||||
$filter.="<option value=\"".$i."\">".$i."</option>";
|
||||
}
|
||||
}
|
||||
|
||||
$filter.="</select>";
|
||||
|
||||
$filter.="<br/><input type=\"submit\" value=\"Применить\"></form>";
|
||||
return $filter;
|
||||
}
|
||||
|
||||
function bug_filter($opt, $f, $id, $t) {
|
||||
$where="";
|
||||
$pre=0;
|
||||
// Фильтр WHERE для поиска
|
||||
|
||||
if($opt!=NULL){
|
||||
for($i=0;$i<count($opt);$i++){
|
||||
if(isset($opt[$i])){
|
||||
if($i==0){
|
||||
if($pre==0){$pre=1;}
|
||||
$where.='(';
|
||||
}
|
||||
|
||||
if($i>=1 && $pre==1){
|
||||
$where.=" OR `type`=".$opt[$i];
|
||||
} else {
|
||||
$where.="`type`=".$opt[$i]." ";
|
||||
}
|
||||
if($i==count($opt)-1){$where.=')';}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($opt==NULL AND $t==0){$where .="(`type`=1 OR `type`=2 OR `type`=3 OR `type`=4 OR `type`=5)";$_POST['opt1']='1';$_POST['opt2']='2';$_POST['opt3']='3';$_POST['opt4']='4';$_POST['opt5']='5';unset($_POST['delete']);}
|
||||
|
||||
if(isset($_GET['type'])) {$where = "WHERE `type`=".$_GET['type']." ";}
|
||||
|
||||
|
||||
if(empty($_POST['limit'])){ $_POST['limit']='5';}
|
||||
if(empty($_POST['page'])){ $_POST['page']='1';}
|
||||
$current_page = (($_POST['limit']*$_POST['page'])-$_POST['limit']);
|
||||
if(isset($_POST['limit'])){ $limit="LIMIT ".$current_page.",".$_POST['limit']." ";} else { $limit="LIMIT 5";}
|
||||
if(isset($_GET['post']) AND $f==0) { $where=" `id`=".$_GET['post']." "; $limit="LIMIT 1"; } //adm
|
||||
if(isset($_GET['post']) AND $f==1) { $where=" `id`=".$_GET['post']." "; $limit="LIMIT 1"; } //user
|
||||
//echo "".."".."";
|
||||
|
||||
|
||||
if($f==1){
|
||||
if($t==1){$limit='';}
|
||||
if($_POST['delete']==0 && !isset($_GET['post'])){
|
||||
$where.= " AND `delete`=0 ";
|
||||
}
|
||||
$bugs = mysql_query("SELECT * FROM `bags` WHERE uid='".$id."' AND ".$where." ORDER BY time DESC ".$limit." ");
|
||||
|
||||
} else {
|
||||
if($t==1){$limit='';}
|
||||
if($_POST['delete']==0 && empty($where) && !isset($_GET['post'])){
|
||||
$where.= " WHERE `delete`=0 ";
|
||||
} elseif ($_POST['delete']==0 && !isset($_GET['post'])) {
|
||||
$where.= " AND `delete`=0 ";
|
||||
}
|
||||
$bugs = mysql_query("SELECT * FROM `bags` WHERE ".$where." ORDER BY time DESC ".$limit." ");
|
||||
}
|
||||
|
||||
|
||||
return $bugs;
|
||||
}
|
||||
|
||||
if($u->error!=''){ echo '<font color="red"><b>'.$u->error.'</b></font><br>'; }
|
||||
$page ="";
|
||||
$post = round($_GET['post']);
|
||||
$data = bug_moder($u->info['align']);
|
||||
$atp = 'Приветствую тебя, ';
|
||||
//$opt = array($_POST['opt1'],$_POST['opt2'],$_POST['opt3'],$_POST['opt4'],$_POST['opt5']);
|
||||
if(isset($_POST['opt1'])){ $opt[]=$_POST['opt1'];}if(isset($_POST['opt2'])){ $opt[]=$_POST['opt2'];}if(isset($_POST['opt3'])){ $opt[]=$_POST['opt3'];}if(isset($_POST['opt4'])){ $opt[]=$_POST['opt4'];}if(isset($_POST['opt5'])){ $opt[]=$_POST['opt5'];}
|
||||
|
||||
|
||||
/*
|
||||
if($_POST['delete']==1){
|
||||
$_POST['delete']=1;
|
||||
} else {
|
||||
$_POST['delete']=0;
|
||||
setcookie("delete", 0);
|
||||
}
|
||||
if($_POST['delete']==1 && isset($_COOKIE['delete'])){setcookie("delete", $_POST['delete'], time()+3600);}
|
||||
else {setcookie("delete", 0);}
|
||||
echo $_POST['delete']."-".$_COOKIE['delete'];
|
||||
*/
|
||||
|
||||
?>
|
||||
<style>
|
||||
html,body {margin: 0px!important; padding: 0px !important; background-color:#404040;}
|
||||
#adm { display:block; width:100%; height:100%; background-color:#404040;}
|
||||
#adm * { font-family: Arial, Helvetica, Tahoma, sans-serif; }
|
||||
#adm .title { font-size:15px; padding:6px 20px 2px 20px;background-color:white; border-bottom:1px solid #8c8c8c; height:24px; }
|
||||
#adm .title .left { float:left;}
|
||||
#adm .title .right { float:right;}
|
||||
#adm .title .button { border:1px solid #bebebe; font-family:"Minion Pro", Times, "Times New Roman", serif; margin:0px 3px; padding: 1px 15px; font-size: 13px; border-radius:12px; background:url('//img.new-combats.tech/admin/adm_inputs_bg.png') no-repeat center center;}
|
||||
#adm .menu { font-size:16px; padding:0px 20px;background:url('//img.new-combats.tech/admin/adm_menu_bg.png') repeat-x top; height:28px;}
|
||||
#adm .menu a { font-weight: normal; text-decoration:none; padding:4px 8px; margin:0px 3px; color: #404040;height:20px; display:inline-block; }
|
||||
#adm .menu a:hover, #adm .menu a.active { text-decoration:underline; color:#f7f7f7; background:url('//img.new-combats.tech/admin/adm_menu_bg-active.png') repeat-x top;}
|
||||
#adm .content { margin: 8px 0px; border:0px; width:100%; display: table;}
|
||||
#adm .content .cell { vertical-align:top; margin:0px; padding:0px; }
|
||||
#adm .content .cell .t { background:#eaeaea; margin:0px;}
|
||||
#adm .content .cell.right { width:350px; }
|
||||
#adm .content .cell .t.right { margin:0px 10px !important; }
|
||||
#adm .content .cell .t.right .f { background:url('//img.new-combats.tech/admin/adm_bg-create.png') no-repeat top right; padding:10px 14px; width:350px; }
|
||||
#adm .content .cell .t.left { padding:10px 20px 10px 0px !important; }
|
||||
form .newpost input, form .newpost textarea, form .newpost select{ padding:2px 4px; border-radius: 5px;color: #7E4007;font-size: 10pt;}
|
||||
.linegrad_answer {
|
||||
background: rgb(224,224,224); /* Old browsers */
|
||||
background: -moz-linear-gradient(left, rgba(214,214,214,1) 0%, rgba(239,239,239,1) 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(214,214,214,1)), color-stop(100%,rgba(239,239,239,1))); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(left, rgba(214,214,214,1) 0%,rgba(239,239,239,1) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(left, rgba(214,214,214,1) 0%,rgba(239,239,239,1) 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(left, rgba(214,214,214,1) 0%,rgba(239,239,239,1) 100%); /* IE10+ */
|
||||
background: linear-gradient(to right, rgba(214,214,214,1) 0%,rgba(239,239,239,1) 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d6d6d6', endColorstr='#efefef',GradientType=1 ); /* IE6-9 */
|
||||
margin: 8px auto;
|
||||
padding: 0px;
|
||||
border-bottom: 1px solid #DBDBDB;
|
||||
border-right: 3px solid #B3B3B3;
|
||||
}
|
||||
.linegrad {
|
||||
background: rgb(210,210,210); /* Old browsers */
|
||||
background: -moz-linear-gradient(left, rgba(200,200,200,1) 0%, rgba(234,234,234,1) 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(200,200,200,1)), color-stop(100%,rgba(234,234,234,1))); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(left, rgba(200,200,200,1) 0%,rgba(234,234,234,1) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(left, rgba(200,200,200,1) 0%,rgba(234,234,234,1) 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(left, rgba(200,200,200,1) 0%,rgba(234,234,234,1) 100%); /* IE10+ */
|
||||
background: linear-gradient(to right, rgba(200,200,200,1) 0%,rgba(234,234,234,1) 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bfbfbf', endColorstr='#eaeaea',GradientType=1 ); /* IE6-9 */
|
||||
margin: 8px auto;
|
||||
padding: 0px;
|
||||
border-bottom: 1px solid #DBDBDB;
|
||||
border-right: 3px solid #B3B3B3;
|
||||
}
|
||||
.userPost { padding: 8px 20px; background:url('//img.new-combats.tech/admin/user_post-old.png') no-repeat top right; }
|
||||
.userPost.hot{ background:url('//img.new-combats.tech/admin/user_post-hot.png') no-repeat top right; }
|
||||
.userPost.new { background:url('//img.new-combats.tech/admin/user_post-new.png') no-repeat top right; }
|
||||
.admPost { padding: 8px 20px; background:url('//img.new-combats.tech/admin/adm_post-old.png') no-repeat bottom left; }
|
||||
.admPost.hot{ background:url('//img.new-combats.tech/admin/adm_post-hot.png') no-repeat bottom left; }
|
||||
.admPost.new { background:url('//img.new-combats.tech/admin/adm_post-new.png') no-repeat bottom left; }
|
||||
.moderPost { padding: 8px 20px; background:url('//img.new-combats.tech/admin/moder_post-old.png') no-repeat bottom left; }
|
||||
.moderPost.hot{ background:url('//img.new-combats.tech/admin/moder_post-hot.png') no-repeat bottom left; }
|
||||
.moderPost.new { background:url('//img.new-combats.tech/admin/moder_post-new.png') no-repeat bottom left; }
|
||||
</style>
|
||||
<?php
|
||||
if(!isset($_GET['post'])) { $formTitle='СОЗДАТЬ СООБЩЕНИЕ'; $formButton='Задать вопрос';} else { $postLink='&post='.$_GET['post']; $formTitle='ОТВЕТИТЬ В ТЕМЕ'; $formButton='Ответить в теме';}
|
||||
$formcreate='<h2 style="font-size:16px; padding-left:20px; font-weight:bold; color: #404040; margin:0px; text-transform:uppercase;">'.$formTitle.'</h2>
|
||||
<form style="color: #3F2A11;" method="post" action="main.php?bagreport=1&action=create'.$postLink.'">
|
||||
<table class="newpost" width="100%">
|
||||
<tr>
|
||||
<td style="padding-right:7px;" align="right" width="85px"> Персонаж:</td>';
|
||||
if(isset($u->info['login'])){$c=strlen($u->info['login']);$formcreate.='<td><input type="text" name="name" size="'.$c.'" value="'.$u->info['login'].'" disabled/></td>';}else{$formcreate.='<td><input type="text" name="name" size="24" value=""/></td>';}
|
||||
$formcreate.='</tr>';
|
||||
|
||||
if(!isset($_GET['post'])){ $formcreate.='
|
||||
<tr>
|
||||
<td style="padding-right:7px;width: 75px;" align="right" >Категория:</td>
|
||||
<td>
|
||||
<select name="type">
|
||||
<option value="1">Игровые вопросы</option>
|
||||
<option value="3">Орден Света</option>
|
||||
<option value="2">Ошибки Мироздания</option>
|
||||
<option value="4">Предложения</option>
|
||||
<option value="5" selected>Другое</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-right:7px;" align="right" >Тема:</td>
|
||||
<td><input type="text" size="32" name="title" /></td>
|
||||
</tr>'; }
|
||||
$formcreate.='
|
||||
<tr>
|
||||
<td style="vertical-align:top; padding-right:10px;" align="right" >Текст:</td>
|
||||
<td><textarea name="description" style="width:238px; height:100px; "></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2><input type="submit" style="margin-top: 20px;padding: 6px 10px;font-weight: bold;color: #89634e;" value="Отправить" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//if($data OR $u->info['admin']>0 OR $u->info['login']=='Хорс'){ // if moder or admin
|
||||
if($data OR $u->info['admin']>0){ // if moder or admin
|
||||
if(isset($_POST['limit'])){
|
||||
$num = $_POST['limit'];
|
||||
}else{$num=5;}
|
||||
|
||||
$limitposts=round($limit);
|
||||
$posts=mysql_num_rows(bug_filter($opt, 0, $u->info['id'], 1));
|
||||
$bugs=bug_filter($opt, 0, $u->info['id'], 0);
|
||||
$total=intval(($posts - 1) / $num) + 1;
|
||||
$filter=bug_filter_area($u->info['admin'], $total);
|
||||
|
||||
// Отображение списка записей
|
||||
$page.= '<h2 style="font-size:16px; padding-left:20px; font-weight:bold; color: #404040; margin:0px; text-transform:uppercase;">ЗАЯВКИ</h2>';
|
||||
while ($r = mysql_fetch_array($bugs)) { // Вывод списка
|
||||
// Сокращение содержимого текста, возвращает[$text]
|
||||
if(strlen($r['text'])>=100 && empty($_GET['post'])){$text=substr($r['text'], 0, 100)."...";} else {$text=$r['text'];}
|
||||
|
||||
$author = $r['uid'];
|
||||
$user = bug_user($author);
|
||||
$clan = bug_clan($user['clan']);
|
||||
$userinfo = bug_userinfo($user['login'], $user['id'], $user['level'], $user['align'], $clan['name_mini']);
|
||||
$tiType = bug_type($r['type']);
|
||||
$data = bug_moder($user['align']);
|
||||
$checkPost = bug_classPost($user['admin'],$u->info['id'], $data, $r['readUser'], $r['readAdmin'], $r['readModer'], $r['up']);
|
||||
|
||||
if(strlen($r['title'])>=1){ $title="<b>«".$r['title']."»</b>"; } else { $title="<b>«Отсутствует»</b>"; }
|
||||
|
||||
$func="";
|
||||
$func.="<a href=\"main.php?bagreport=1&post=".$r['id']."&action=read\"><img src=\"//img.new-combats.tech/admin/read.png\" height=\"16\"/></a>"; // Отметить - Я прочитал
|
||||
if($u->info['admin']>0 OR $data)$func.="<a href=\"main.php?bagreport=1&post=".$r['id']."&action=update\"><img src=\"//img.new-combats.tech/admin/update.png\" height=\"16\"/></a>"; // Вернуть отметку - Я не прочел
|
||||
$func.="<a href=\"main.php?bagreport=1&post=".$r['id']."&action=delete\"><img src=\"//img.new-combats.tech/admin/close.png\" height=\"16\"/></a>";
|
||||
|
||||
|
||||
$bug_sid = mysql_query("SELECT * FROM `bags` WHERE `sid`=".$r['id']." ORDER BY time ASC");
|
||||
if($r['delete']==1){$thisDelete="<span style='color:red'>Тема закрыта</span> | ";} else {$thisDelete=" ";}
|
||||
$reCount=mysql_num_rows($bug_sid);
|
||||
$result= "<div class='linegrad'>
|
||||
<div class='".$checkPost."'>
|
||||
<div><a href='main.php?bagreport=1&type=".$r['type']."' title='Вернуться в рубрику'><b>".$tiType."</b></a> > <a href='main.php?bagreport=1&post=".$r['id']."' title='Подробнее...'>".$title."</a> от ".$userinfo." <span style='float:right; text-align:right;'>".$thisDelete."Сообщений: ".$reCount." (<i class='date'>".date("G:i, d.m.Y",$r['time'])."</i>) <br/>".$func."</span></div>
|
||||
<div style='padding:6px 0px; width: 90%;'>".$text."</div>
|
||||
</div>
|
||||
</div>";
|
||||
if(isset($_GET['post'])){
|
||||
while($s = mysql_fetch_array($bug_sid)) {
|
||||
$user = bug_user($s['uid']);
|
||||
$clan = bug_clan($user['clan']);
|
||||
$userinfo = bug_userinfo($user['login'], $user['id'], $user['level'], $user['align'], $clan['name_mini']);
|
||||
$data = bug_moder($user['align']);
|
||||
$checkPost = bug_classPost($user['admin'],$u->info['id'], $data, $s['readUser'], $s['readAdmin'], $s['readModer'], $s['up']);
|
||||
|
||||
$result.= "<div class='linegrad_answer' ><div class='".$checkPost."'><div style='font-size:12px'>Ответ от ".$userinfo." <span style='float:right;'>(<i class='date'>".date("G:i, d.m.Y",$s['time'])."</i>)</span></div><div style='padding:6px 0px; width: 90%;'>".$s['text']."</div></div></div>";
|
||||
|
||||
if($s['uid']!=$u->info['id']){
|
||||
bug_upView($s['id']);
|
||||
}
|
||||
if($r['uid']!=$u->info['id']){
|
||||
bug_upView($r['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
$page .= $result;
|
||||
if(isset($_GET['post']) AND $r['id']==$_GET['post']) break;
|
||||
}
|
||||
|
||||
} else {
|
||||
// if user
|
||||
if(isset($_POST['limit'])){
|
||||
$num = $_POST['limit'];
|
||||
} else { $num=5;}
|
||||
|
||||
$limitposts = round($limit);
|
||||
$posts = mysql_num_rows(bug_filter($opt, 1, $u->info['id'], 1));
|
||||
$bugs = bug_filter($opt, 1, $u->info['id'], 0);
|
||||
$total = intval(($posts - 1) / $num) + 1;
|
||||
$filter=bug_filter_area($u->info['admin'], $total);
|
||||
|
||||
// Отображение списка записей пользователя
|
||||
$page.= '<h2 style="font-size:16px; font-weight:bold; color: #404040; padding-left:20px; margin:0px; text-transform:uppercase;">ВАШИ СООБЩЕНИЯ</h2> ';
|
||||
while ($r = mysql_fetch_array($bugs)) {
|
||||
// Сокращение содержимого текста, возвращает[$text]
|
||||
if(strlen($r['title'])>=1){ $title="<b>«".$r['title']."»</b>"; } else { $title="<b>«Отсутствует»</b>"; }
|
||||
if(strlen($r['text'])>=47 && empty($_GET['post'])){$text=substr($r['text'], 0, 47)."...";} else {$text=$r['text'];}
|
||||
|
||||
$author = $r['uid'];
|
||||
$user = bug_user($author);
|
||||
$clan = bug_clan($user['clan']);
|
||||
$userinfo = bug_userinfo($user['login'], $user['id'], $user['level'], $user['align'], $clan['name_mini']);
|
||||
$tiType = bug_type($r['type']);
|
||||
$data = bug_moder($user['align']);
|
||||
$checkPost = bug_classPost($user['admin'],$u->info['id'], $data, $r['readUser'], $r['readAdmin'], $r['readModer'], $r['up']);
|
||||
|
||||
$func="";
|
||||
$func.="<a href=\"main.php?bagreport=1&post=".$r['id']."&action=read\"><img src=\"//img.new-combats.tech/admin/read.png\" height=\"16\"/></a>"; // Отметить - Я прочитал
|
||||
$func.="<a href=\"main.php?bagreport=1&post=".$r['id']."&action=update\"><img src=\"//img.new-combats.tech/admin/update.png\" height=\"16\"/></a>"; // Вернуть отметку - Я не прочел
|
||||
$func.="<a href=\"main.php?bagreport=1&post=".$r['id']."&action=delete\"><img src=\"//img.new-combats.tech/admin/close.png\" height=\"16\"/></a>"; // Закрыть мою тему
|
||||
|
||||
if($r['delete']==1){$thisDelete="<span style='color:red'>Тема закрыта</span> | ";} else {$thisDelete="";}
|
||||
$bug_sid = mysql_query("SELECT * FROM `bags` WHERE `sid`=".$r['id']." ORDER BY time ASC");
|
||||
$reCount=mysql_num_rows($bug_sid);
|
||||
$result= "<div class='linegrad'><div class='".$checkPost."'><div><span style='color:darkred; font-size:11px; font-style:italic;'>".$tiType."</span> > <a href='main.php?bagreport=1&post=".$r['id']."' title='Подробнее...'>".$title."</a> <span style='float:right; text-align:right;'>".$thisDelete." Ответов в теме: ".$reCount." (<i class='date'>".date("G:i, d.m.Y",$r['time'])."</i>) <br/>".$func."</span></div><div style='padding:6px 0px;'>".$text."</div></div></div>";
|
||||
|
||||
if(isset($_GET['post'])){
|
||||
if($r['delete']==1){
|
||||
if ($_GET['action']=='delete' OR empty($_GET['action'])){
|
||||
$formcreate='<h2 style="font-size:16px; padding-left:20px; font-weight:bold; color: red; margin:0px; text-transform:uppercase;">Тема закрыта</h2>';
|
||||
}elseif($_GET['action']=='edit') {
|
||||
$formcreate='';
|
||||
}
|
||||
}
|
||||
while($s = mysql_fetch_array($bug_sid)) {
|
||||
$text=$s['text'];
|
||||
$user = bug_user($s['uid']);
|
||||
$clan = bug_clan($user['clan']);
|
||||
$userinfo = bug_userinfo($user['login'], $user['id'], $user['level'], $user['align'], $clan['name_mini']);
|
||||
$data = bug_moder($user['align']);
|
||||
$checkPost = bug_classPost($user['admin'],$u->info['id'], $data, $s['readUser'], $s['readAdmin'], $s['readModer'], $s['up']);
|
||||
|
||||
$result.= "<div class='linegrad_answer' ><div class='".$checkPost."'><div style='font-size:12px'>Ответ от ".$userinfo." <span style='float:right;'>(<i class='date'>".date("G:i, d.m.Y",$s['time'])."</i>)</span></div><div style='padding:6px 0px;'>".$text."</div></div></div>";
|
||||
/*if($s['uid']!=$u->info['id']){
|
||||
// Если сообщение не мое, отмечаем как прочитанное
|
||||
$query = "UPDATE `bags` SET readUser='0' WHERE id='".$s['id']."'";
|
||||
$q = mysql_query($query) or die ("<span style='color:red'>Ошибка при выполнении запроса</span>: ".mysql_error ());
|
||||
}*/
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
$page .= $result;
|
||||
if(isset($_GET['post'])) break;
|
||||
}
|
||||
|
||||
// Вывод сообщений пользователя
|
||||
}
|
||||
|
||||
|
||||
if($_GET['action']=='create'){
|
||||
if(isset($u->info['id'])){$id=$u->info['id'];} else { $usLogin = mysql_fetch_array(mysql_query("SELECT `login`,`id` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['name'])."' LIMIT 1;"));$id=$usLogin['id'];}
|
||||
$title=htmlspecialchars(mysql_real_escape_string($_POST['title']),NULL);
|
||||
$type=$_POST['type'];
|
||||
$ip=$_SERVER['REMOTE_ADDR'];
|
||||
$descr=htmlspecialchars(mysql_real_escape_string($_POST['description']),NULL);
|
||||
|
||||
if ($u->info['admin']>0) { $readAdmin="0"; $readUser="1"; } else{ $readAdmin="1"; $readUser="0";}
|
||||
if ($data) { $readModer="0"; $readUser="1"; } else { $readModer="1"; $readUser="0"; }
|
||||
|
||||
// Отмечает предыдущие сообщения как прочитанные
|
||||
$query = "UPDATE `bags` SET readAdmin='0', readModer='0', readUser='0' WHERE sid='".$post."'";
|
||||
$q = mysql_query($query) or die ("<span style='color:red'>Ошибка при выполнении запроса</span>: ".mysql_error ());
|
||||
|
||||
// Добавление новое сообщение
|
||||
$query = "INSERT INTO `bags` (`uid`, `title`, `sid`, `text`, `type`, `time`, `ip`, `fast`, `readAdmin`, `readModer`, `readUser`) VALUES ('".$id."', '".$title."', '".$_GET['post']."', '".htmlspecialchars($descr,NULL)."', '".$type."', '".time()."', '".$ip."', '0', '".$readAdmin."', '".$readModer."', '".$readUser."');";
|
||||
$q = mysql_query($query) or die ("<span style='color:red'>Ошибка при выполнении запроса</span>: ".mysql_error ());
|
||||
|
||||
// Обновление статуса темы
|
||||
$thead = mysql_fetch_array(mysql_query("SELECT `delete`,`readUser`,`readModer`,`readAdmin`, `uid` FROM `bags` WHERE `id` = '".mysql_real_escape_string($_GET['post'])."' LIMIT 1;"));
|
||||
if($u->info['admin']>0){
|
||||
$query = "UPDATE `bags` SET `delete`='0', `readUser`=1, `readModer`=0, `readAdmin`=0, `time`='".time()."' WHERE `id`='".$post."';";
|
||||
}elseif($data){
|
||||
$query = "UPDATE `bags` SET `delete`='0', `readUser`=1, `readModer`=0, `readAdmin`=0, `time`='".time()."' WHERE `id`='".$post."';";
|
||||
}else{
|
||||
$query = "UPDATE `bags` SET `delete`='0', `readUser`=0, `readModer`=1, `readAdmin`=1, `time`='".time()."' WHERE `id`='".$post."';";
|
||||
}
|
||||
//$query = "UPDATE `bags` SET readUser='1', readAdmin='1', time='".time()."' WHERE id='".$post."'";
|
||||
$q = mysql_query($query) or die ("<span style='color:red'>Ошибка при выполнении запроса</span>: ".mysql_error ());
|
||||
|
||||
$answer.="<div style=\"text-align:center; width:100%;\"><span style='margin-top:30px;color:green; font-weight:bold'>Тема успешно создана</span>.</div>";
|
||||
$answer.='<META HTTP-EQUIV="refresh" CONTENT="0; url=/main.php?bagreport=1&post='.$post.'">';
|
||||
//redirect to post
|
||||
$answer.=$formcreate;
|
||||
} elseif($_GET['action']=='edit'){
|
||||
/**/
|
||||
$formTitle='РЕДАКТИРОВАНИЕ ТЕМЫ';
|
||||
$formButton='Сохранить изменения';
|
||||
$postLink='post='.$_GET['post'].'&';
|
||||
|
||||
$formcreate='<h2 style="font-size:16px; padding-left:20px; font-weight:bold; color: #404040; margin:0px; text-transform:uppercase;">'.$formTitle.'</h2>
|
||||
<form style="color: #3F2A11;" method="post" action="main.php?bagreport=1&'.$postLink.'action=edit">
|
||||
<table class="newpost" width="100%">
|
||||
<tr>
|
||||
<td style="padding-right:7px;" align="right" width="85px"> Персонаж:</td>';
|
||||
if(isset($u->info['login'])){$c=strlen($u->info['login']);
|
||||
$formcreate.='<td><input type="text" name="name" size="'.$c.'" value="'.$u->info['login'].'" disabled/></td>';}else{$formcreate.='<td><input type="text" name="name" size="24" value=""/></td>';}
|
||||
$formcreate.='</tr>';
|
||||
$formcreate.='
|
||||
<tr>
|
||||
<td style="padding-right:7px;width: 75px;" align="right" >Категория:</td>
|
||||
<td>
|
||||
<select name="type" selected="4">
|
||||
<option value="1">Игровые вопросы</option>
|
||||
<option value="3">Орден Света</option>
|
||||
<option value="2">Ошибки Мироздания</option>
|
||||
<option value="4">Предложения</option>
|
||||
<option value="5" selected>Другое</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-right:7px;" align="right" >Тема:</td>
|
||||
<td><input type="text" size="32" name="title" /></td>
|
||||
</tr>';
|
||||
$formcreate.='
|
||||
<tr>
|
||||
<td style="vertical-align:top; padding-right:10px;" align="right" >Текст:</td>
|
||||
<td><textarea name="description" style="width:238px; height:100px; "></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2><input type="submit" style="margin-top: 20px;padding: 6px 10px;font-weight: bold;color: #89634e;" value="'.$formButton.'" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>';
|
||||
$answer.=$formcreate;
|
||||
/**/
|
||||
} elseif($_GET['action']=='delete'){
|
||||
$dlt = mysql_fetch_array(mysql_query("SELECT `delete`, `uid` FROM `bags` WHERE `id` = '".mysql_real_escape_string($_GET['post'])."' LIMIT 1;"));
|
||||
if($dlt['delete']=='1'){$dlt=0;}
|
||||
if($dlt['delete']=='0'){$dlt=1;}
|
||||
|
||||
if($u->info['admin']>0){
|
||||
$query = "UPDATE `bags` SET `delete`='".$dlt."', `readModer`='0', `readAdmin`='0', `readUser`='0' WHERE `id`='".$_GET['post']."';";
|
||||
}
|
||||
if($data){
|
||||
$query = "UPDATE `bags` SET `delete`='".$dlt."', `readModer`=0, `readAdmin`=0, `readUser`=0 WHERE `id`='".$_GET['post']."';";
|
||||
}
|
||||
if(isset($data) AND $data!=0) {
|
||||
$query = "UPDATE `bags` SET `delete`='".$dlt."', readModer=0, readAdmin=0, readUser=0 WHERE `id`='".$_GET['post']."';";
|
||||
}
|
||||
if($dlt['uid']==$author){
|
||||
if($dlt['uid']==$author){
|
||||
$query = "UPDATE `bags` SET `delete`='".$dlt."', `readUser`=0, `readModer`=0, `readAdmin`=0 WHERE `id`='".$post."';";
|
||||
}
|
||||
}
|
||||
$q = mysql_query($query) or die ("<span style='color:red'>Ошибка при выполнении запроса</span>: ".mysql_error());
|
||||
$answer.=$formcreate;
|
||||
} elseif($_GET['action']=='update'){
|
||||
if($u->info['admin']>0){
|
||||
$query = "UPDATE `bags` SET readAdmin='1', time='".time()."' WHERE id='".$post."'";
|
||||
} elseif(isset($data) AND $data!=0) {
|
||||
$query = "UPDATE `bags` SET readModer='1', time='".time()."' WHERE id='".$post."'";
|
||||
} else {
|
||||
$query = "UPDATE `bags` SET readUser='1', time='".time()."' WHERE id='".$post."'";
|
||||
}
|
||||
$q = mysql_query($query) or die ("<span style='color:red'>Ошибка при выполнении запроса</span>: ".mysql_error ());
|
||||
$answer.="<div style=\"text-align:center; width:100%;\"><span style='margin-top:30px;color:#8f0000; font-weight:bold'>Прочесть позже</span>.</div>";
|
||||
$answer.='<META HTTP-EQUIV="refresh" CONTENT="0; url=/main.php?bagreport=1&post='.$post.'">';
|
||||
} elseif($_GET['action']=='read'){
|
||||
if($u->info['admin']>0){
|
||||
$query = "UPDATE `bags` SET readAdmin='0', time='".time()."' WHERE id='".$post."'";
|
||||
} elseif(isset($data) AND $data!=0) {
|
||||
$query = "UPDATE `bags` SET readAdmin='0', time='".time()."' WHERE id='".$post."'";
|
||||
} else {
|
||||
$query = "UPDATE `bags` SET readUser='0', time='".time()."' WHERE id='".$post."'";
|
||||
}
|
||||
$q = mysql_query($query) or die ("<span style='color:red'>Ошибка при выполнении запроса</span>: ".mysql_error ());
|
||||
$answer.=$formcreate;
|
||||
} else {
|
||||
$answer.=$formcreate;
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="adm">
|
||||
<div class="title">
|
||||
<div class="left"><?=$atp;?><?$clan = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id` = '".mysql_real_escape_string($u->info['clan'])."' LIMIT 1;"));?><SCRIPT>drwfl("<?=$u->info['login']?>",<?=$u->info['id']?>,"<?=$u->info['level']?>",<?=$u->info['align']?>,"<?=$clan['name_mini'];?>")</SCRIPT>!</div>
|
||||
<div class="right">
|
||||
<INPUT TYPE="button" class='button' onclick="location.href='main.php?bagreport=1';" value="Обновить" title="Обновить">
|
||||
<INPUT TYPE="button" class='button' onclick="location.href='main.php';" value="Вернуться" title="Вернуться">
|
||||
</div>
|
||||
</div>
|
||||
<div class="menu">
|
||||
<a href='#' onclick="location.href='main.php?bagreport=1';" <?if(isset($_GET['bagreport']))echo"class='active'";?>>Служба поддержки</a>
|
||||
</div>
|
||||
<table class="content">
|
||||
<tr style="display:table-row;">
|
||||
<td class='cell'>
|
||||
<div class='t left'>
|
||||
<?=$page?>
|
||||
</div>
|
||||
</td>
|
||||
<td class='cell right'>
|
||||
<div class='t right'>
|
||||
<div class="f">
|
||||
<h2 style="font-size:16px; padding-left:20px; font-weight:bold; color: #404040; margin:0px; text-transform:uppercase;">Фильтр</h2>
|
||||
<?=$filter?>
|
||||
</div>
|
||||
</div><br/>
|
||||
<div class='t right'>
|
||||
<div class="f">
|
||||
<?=$answer?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -1,287 +0,0 @@
|
||||
<?php
|
||||
if(!defined('GAME'))die();
|
||||
|
||||
header('location:/core/comission/');
|
||||
die();
|
||||
|
||||
if($u->room['file']=='commision')
|
||||
{
|
||||
if(isset($u->stats['shopSale'],$_GET['sale']))
|
||||
{
|
||||
$bns = 0+$u->stats['shopSale'];
|
||||
if($bns!=0)
|
||||
{
|
||||
if($bns>0)
|
||||
{
|
||||
$bns = '+'.$bns;
|
||||
}
|
||||
$shopProcent -= $bns;
|
||||
if($shopProcent>99){ $shopProcent = 99; }
|
||||
if($shopProcent<1){ $shopProcent = 1; }
|
||||
echo '<div style="color:grey;"><b>У Вас действует бонус при продаже: '.$bns.'%</b><br><small>Вы сможете продавать предметы за '.(100-$shopProcent).'% от их стоимости</small></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($_GET['otdel'])) $_GET['otdel'] = 1;
|
||||
|
||||
$sid = 1;
|
||||
|
||||
$error = '';
|
||||
|
||||
# Выполнение функции покупки предмета
|
||||
if(isset($_GET['buy']))
|
||||
{
|
||||
if($u->info['allLock'] > time()) {
|
||||
$re = '<div align="left">Вам запрещается пользоваться данным магазином до '.date('d.m.y H:i',$u->info['allLock']).'</div>';
|
||||
}elseif($u->info['align'] == 2 || $u->info['haos'] > time()) {
|
||||
$re = '<div align="left">Хаосникам запрещается пользоваться данным магазином</div>';
|
||||
}elseif($u->newAct($_GET['sd4'])==true)
|
||||
{
|
||||
$re = $u->buyItemCommison($sid,(int)$_GET['itemid'],(int)$_GET['buy']);
|
||||
}else{
|
||||
$re = 'Вы уверены что хотите купить этот предмет?';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Выполнение функции "положить предмет в комисионку"
|
||||
* Или забрать предме из коммисионки.
|
||||
*/
|
||||
|
||||
if($u->info['align'] == 2 || $u->info['haos'] > time()) {
|
||||
$re = '<div align="left">Хаосникам запрещается пользоваться данным магазином</div>';
|
||||
}elseif(isset($_POST['PresTR'])){
|
||||
$u->commisonRent(mysql_real_escape_string($_POST['PresTR']),(int)$_POST['iid'],(int)$_POST['summTR']);
|
||||
}
|
||||
|
||||
if($re!=''){ echo '<div align="right"><font color="red"><b>'.$re.'</b></font></div>'; } ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function AddCount(name, txt)
|
||||
{
|
||||
document.getElementById("hint4").innerHTML = '<table border=0 width=100% cellspacing=1 cellpadding=0 bgcolor="#CCC3AA"><tr><td align=center><B>Купить неск. штук</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</TD></tr><tr><td colspan=2>'+
|
||||
'<form method=post><table border=0 width=100% cellspacing=0 cellpadding=0 bgcolor="#FFF6DD"><tr><INPUT TYPE="hidden" name="set" value="'+name+'"><td colspan=2 align=center><B><I>'+txt+'</td></tr><tr><td width=80% align=right>'+
|
||||
'Количество (шт.) <INPUT TYPE="text" NAME="count" id=count size=4></td><td width=20%> <INPUT TYPE="submit" value=" »» ">'+
|
||||
'</TD></TR></form></TABLE></td></tr></table>';
|
||||
document.getElementById("hint4").style.visibility = 'visible';
|
||||
document.getElementById("hint4").style.left = '100px';
|
||||
document.getElementById("hint4").style.top = '100px';
|
||||
document.getElementById("count").focus();
|
||||
}
|
||||
function closehint3() {
|
||||
document.getElementById('hint4').style.visibility='hidden';
|
||||
Hint3Name='';
|
||||
}
|
||||
</script>
|
||||
<style type="text/css">
|
||||
|
||||
.pH3 { COLOR: #8f0000; FONT-FAMILY: Arial; FONT-SIZE: 12pt; FONT-WEIGHT: bold; }
|
||||
.class_ {
|
||||
font-weight: bold;
|
||||
color: #C5C5C5;
|
||||
cursor:pointer;
|
||||
}
|
||||
.class_st {
|
||||
font-weight: bold;
|
||||
color: #659BA3;
|
||||
cursor:pointer;
|
||||
}
|
||||
.class__ {
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
cursor:pointer;
|
||||
background-color: #659BA3;
|
||||
}
|
||||
.class__st {
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
cursor:pointer;
|
||||
background-color: #659BA3;
|
||||
font-size: 10px;
|
||||
}
|
||||
.class_old {
|
||||
font-weight: bold;
|
||||
color: #919191;
|
||||
cursor:pointer;
|
||||
}
|
||||
.class__old {
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
cursor:pointer;
|
||||
background-color: #838383;
|
||||
font-size: 10px;
|
||||
}
|
||||
</style>
|
||||
<TABLE width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr><td valign="top"><?php
|
||||
echo '<b style="color:red">'.$error.'</b>';
|
||||
?>
|
||||
<br />
|
||||
<TABLE width="100%" cellspacing="0" cellpadding="4">
|
||||
<TR>
|
||||
<form name="F1" method="post">
|
||||
<TD valign="top" align="left">
|
||||
<!--Магазин-->
|
||||
<table width="100%" cellspacing="0" cellpadding="0" bgcolor="#a5a5a5">
|
||||
<div id="hint3" style="visibility:hidden"></div>
|
||||
<tr>
|
||||
<td align="center" height="21">
|
||||
<?php
|
||||
/*названия разделов (сверху)*/
|
||||
if(!isset($_GET['sale']) && isset($_GET['otdel']))
|
||||
{
|
||||
$otdels_small_array = array (1050=>'<b>Отдел "Прочие предметы"</b>',1=>'<b>Отдел "Оружие: кастеты,ножи"</b>',2=>'<b>Отдел "Оружие: топоры"</b>',3=>'<b>Отдел "Оружие: дубины,булавы"</b>',4=>'<b>Отдел "Оружие: мечи"</b>',5=>'<b>Отдел "Оружие: магические посохи"</b>',6=>'<b>Отдел "Одежда: сапоги"</b>',7=>'<b>Отдел "Одежда: перчатки"</b>',8=>'<b>Отдел "Одежда: рубахи"</b>',9=>'<b>Отдел "Одежда: легкая броня"</b>',10=>'<b>Отдел "Одежда: тяжелая броня"</b>',11=>'<b>Отдел "Одежда: шлемы"</b>',12=>'<b>Отдел "Одежда: наручи"</b>',13=>'<b>Отдел "Одежда: пояса"</b>',14=>'<b>Отдел "Одежда: поножи"</b>',15=>'<b>Отдел "Щиты"</b>',16=>'<b>Отдел "Ювелирные товары: серьги"</b>',17=>'<b>Отдел "Ювелирные товары: ожерелья"</b>',18=>'<b>Отдел "Ювелирные товары: кольца"</b>',19=>'<b>Отдел "Заклинания: нейтральные"</b>',20=>'<b>Отдел "Заклинания: боевые и защитные"</b>',21=>'<b>Отдел "Амуниция"</b>',22=>'<b>Отдел "Эликсиры"</b>',23=>'<b>Отдел "Подарки"</b>',24=>'<b>Отдел "Подарки: недобрые"</b>',25=>'<b>Отдел "Подарки: упаковка"</b>',26=>'<b>Отдел "Подарки: открытки"</b>',27=>'<b>Отдел "Подарки: фейерверки"</b>');
|
||||
if(isset($otdels_small_array[$_GET['otdel']]))
|
||||
{
|
||||
echo $otdels_small_array[$_GET['otdel']];
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<tr><td>
|
||||
<!--Рюкзак / Прилавок-->
|
||||
<table width="100%" CELLSPACING="1" CELLPADDING="1" bgcolor="#a5a5a5">
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Вывод списка вещей продаваемых в комисионке
|
||||
* Вывод вещей которые уже сдали в комок
|
||||
*/
|
||||
if(!isset($_GET['toRent'])){
|
||||
/*
|
||||
* Выводим все вещи продоваемые в комке
|
||||
* В режиме предварительного просмотра
|
||||
*/
|
||||
$u->commisionShop($sid,"preview");
|
||||
}elseif($_GET['toRent'] == 1){
|
||||
/*
|
||||
* Выводим вещи из инвентарая
|
||||
* которые хотим сдать в комок
|
||||
*/
|
||||
if($u->info['allLock'] < time()) {
|
||||
$itmAll = $u->genInv(30,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`!="30" AND `iu`.`gift` = "" ORDER BY `lastUPD` DESC');
|
||||
}else{
|
||||
$itmAll[0] = 0;
|
||||
}
|
||||
if($itmAll[0]==0){
|
||||
$itmAllSee = '<tr><td align="center" bgcolor="#e2e0e0">ПУСТО</td></tr>';
|
||||
}else{
|
||||
$itmAllSee = $itmAll[2];
|
||||
}
|
||||
echo $itmAllSee;
|
||||
}elseif($_GET['toRent'] == 2){
|
||||
/*
|
||||
* Выводим вещи которые мы сдали в комок
|
||||
*/
|
||||
$itmAll = $u->genInv(31,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="30" AND `iu`.`gift` = "" AND `iu`.`data` NOT LIKE "%fromshop=2%" ORDER BY `lastUPD` DESC');
|
||||
if($itmAll[0]==0){
|
||||
$itmAllSee = '<tr><td align="center" bgcolor="#e2e0e0">ПУСТО</td></tr>';
|
||||
}else{
|
||||
$itmAllSee = $itmAll[2];
|
||||
}
|
||||
echo $itmAllSee;
|
||||
}elseif($_GET['toRent'] == 3){
|
||||
/*
|
||||
* Выводим полный перечень вещей
|
||||
* продоваемых в комке по определенному
|
||||
* выбранному айтему
|
||||
*/
|
||||
$u->commisionShop($sid,"full");
|
||||
}
|
||||
?>
|
||||
</TABLE>
|
||||
</TD></TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
</FORM>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<td width="280" valign="top">
|
||||
<TABLE cellspacing="0" cellpadding="0"><TD width="100%"> </TD><TD>
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr align="right" valign="top">
|
||||
<td>
|
||||
<!-- -->
|
||||
<?= $goLis; ?>
|
||||
<!-- -->
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td nowrap="nowrap">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DEDEDE">
|
||||
<tr>
|
||||
<td bgcolor="#D3D3D3"><img src="//img.new-combats.tech/i/move/links.gif" width="9" height="7" /></td>
|
||||
<td bgcolor="#D3D3D3" nowrap><a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.9&rnd=<?= $code; ?>';" title="<?php thisInfRm('1.180.0.9',1); ?>">Центральная Площадь</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></table>
|
||||
</td></table>
|
||||
<div><br />
|
||||
<div align="right">
|
||||
<small>
|
||||
Масса: <?=$u->aves['now']?>/<?=$u->aves['max']?> <br />
|
||||
У вас в наличии: <b style="color:#339900;"><?= round($u->info['money'],2); ?> кр.</b>
|
||||
</small>
|
||||
</div>
|
||||
<br />
|
||||
<?php
|
||||
/*кнопочки*/
|
||||
|
||||
echo '
|
||||
<INPUT TYPE="button" value="Сдать вещи" onclick="location=\'?toRent=1\'">
|
||||
<INPUT TYPE="button" value="Забрать вещи" onclick="location=\'?toRent=2\'">
|
||||
';
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
<div style="background-color:#A5A5A5;padding:1"><center><B>Отделы магазина</B></center></div>
|
||||
<div style="line-height:17px;">
|
||||
<?php
|
||||
/*названия разделов (справа)*/
|
||||
$otdels_array = array (1=>'Оружие: кастеты,ножи',2=>' топоры',3=>' дубины,булавы',4=>' мечи',5=>' магические посохи',6=>'Одежда: сапоги',7=>' перчатки',8=>' рубахи',9=>' легкая броня',10=>' тяжелая броня',11=>' шлемы',12=>' наручи',13=>' пояса',14=>' поножи',15=>'Щиты',16=>'Ювелирные товары: серьги',17=>' ожерелья',18=>' кольца',19=>'Заклинания',20=>'Эликсиры');
|
||||
$i=1;
|
||||
while ($i!=-1)
|
||||
{
|
||||
if(isset($otdels_array[$i]))
|
||||
{
|
||||
if(isset($_GET['otdel']) && $_GET['otdel']==$i)
|
||||
{
|
||||
$color = 'C7C7C7';
|
||||
} else {
|
||||
$color = 'e2e0e0';
|
||||
}
|
||||
|
||||
echo '
|
||||
<A HREF="?otdel='.$i.'"><DIV style="background-color: #'.$color.'">
|
||||
'.$otdels_array[$i].'
|
||||
</A></DIV>
|
||||
';
|
||||
} else {
|
||||
$i = -2;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if(isset($_GET['otdel']) && $_GET['otdel']==1050)
|
||||
{
|
||||
$color = 'C7C7C7';
|
||||
} else {
|
||||
$color = 'e2e0e0';
|
||||
}
|
||||
echo '
|
||||
<A HREF="?otdel=1050"><DIV style="background-color: #'.$color.'">
|
||||
Прочие предметы
|
||||
</A></DIV>
|
||||
';
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</table>
|
||||
<br>
|
||||
<div id="textgo" style="visibility:hidden;"></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
695
ruletka.php
695
ruletka.php
@ -1,695 +0,0 @@
|
||||
<?php
|
||||
|
||||
die();
|
||||
|
||||
define('GAME', true);
|
||||
include_once('_incl_data/__config.php');
|
||||
include_once('_incl_data/class/__db_connect.php');
|
||||
$u = User::start();
|
||||
|
||||
if (!isset($u->bank['id'])) {
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
33|2-0-0-0-2-0,
|
||||
32|4-0-0-0-4-6,
|
||||
11|4-0-0-42-4-0,
|
||||
21|2-0-0-0-2-0,
|
||||
2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35|8-0-8-0-0-0,
|
||||
7|4-0-0-0-4-0,
|
||||
2|4-0-0-0-4-0,
|
||||
17|4-0-0-4-4-0,
|
||||
1|6-0-0-0-0-6,
|
||||
18|4-0-0-0-4-0,
|
||||
30|4-0-0-6-4-6,
|
||||
16|4-0-0-0-4-0,
|
||||
13|4-0-0-0-4-0,
|
||||
25|6-0-0-0-0-6,
|
||||
27|2-0-0-0-2-0,
|
||||
36|2-0-0-0-2-0,
|
||||
3|4-0-0-0-4-0,
|
||||
20|4-0-0-0-4-0,
|
||||
8|8-0-0-16-4-0,
|
||||
38|2-0-0-0-2-6,
|
||||
4|8-0-0-16-0-0,
|
||||
34|4-0-0-0-4-0,
|
||||
37|1-0-0-0-4-7,
|
||||
19|2-0-0-0-2-0,
|
||||
10|4-0-0-10-2-0,
|
||||
31|6-0-0-6-4-0
|
||||
*/
|
||||
|
||||
if ($u->room['name'] != 'Рулетка') {
|
||||
die();
|
||||
} else {
|
||||
|
||||
//Раздаем выйгрыши
|
||||
|
||||
|
||||
function get2str($key = '', $val = '')
|
||||
{
|
||||
$get = $_GET;
|
||||
if (is_array($key)) {
|
||||
if (count($key) > 0) {
|
||||
foreach ($key as $k => $v) {
|
||||
$get[$k] = $v;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$get[$key] = $val;
|
||||
}
|
||||
if (count($get) > 0) {
|
||||
foreach ($get as $k => $v) {
|
||||
if (empty($v)) {
|
||||
unset($get[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($get) > 0) {
|
||||
foreach ($get as $k => $v) {
|
||||
$get[$k] = $k . '=' . urlencode($v);
|
||||
}
|
||||
return '?' . implode('&', $get);
|
||||
}
|
||||
}
|
||||
|
||||
$r = '';
|
||||
$time = 74; //сек до новой игры
|
||||
$status = 0; //статус игры, 2 - крутим колесо
|
||||
$win = [
|
||||
0 => 0, //число выйгрыша
|
||||
1 => '', //линии выйгрыша
|
||||
2 => 0, //сумма выйгрыша
|
||||
3 => 0, //ставка на эту игру текущего игрока
|
||||
//ставки
|
||||
4 => '',
|
||||
//игроки которые делали ставки
|
||||
5 => '',
|
||||
];
|
||||
|
||||
|
||||
//Выделяем текущую игру, если её нет, то создаем новую
|
||||
$gid = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT * FROM `ruletka` WHERE (`end` = 0 OR `id` = "' . ((int)$_GET['id']) . '") ORDER BY `id` DESC LIMIT 1'
|
||||
)
|
||||
);
|
||||
if ($gid['time_start'] + 16 > time() || isset($_GET['bet'])) {
|
||||
$mnr = true;
|
||||
}
|
||||
$gid3 = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT * FROM `ruletka` WHERE `end` >0 AND `id` = "' . ((int)$_GET['id']) . '" ORDER BY `id` DESC LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($gid3['id'])) {
|
||||
$gid = $gid3;
|
||||
unset($gid3);
|
||||
}
|
||||
$add = false;
|
||||
if (isset($gid['id'])) {
|
||||
//Игра существует, проверяем
|
||||
$time = $gid['time_start'] - time();
|
||||
if ($time < 1) {
|
||||
//крутим колесо и заканчиваем игру + выдаем выйгрыш
|
||||
//mysql_query('UPDATE `ruletka` SET `end` = "'.time().'" WHERE `id` = "'.$gid['id'].'" LIMIT 1');
|
||||
//выводим предыдущий выйгрыш
|
||||
$win[0] = $gid['win'];
|
||||
$win[1] = $gid['win_line'];
|
||||
$win[2] = 0;
|
||||
$win[3] = 0;
|
||||
if ($gid['end'] == 0) {
|
||||
$add = true;
|
||||
}
|
||||
} else {
|
||||
//ожидаем начала игры, делаем ставки
|
||||
if (isset($_GET['bet'])) {
|
||||
$bt = $_GET['bet'];
|
||||
$good = 0;
|
||||
$i = 0;
|
||||
while ($i <= 38) {
|
||||
if ($i == $bt) {
|
||||
$good++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
/*
|
||||
Ставки и значения
|
||||
|
||||
1, ... ,36 - ставка на числа [x8]
|
||||
|
||||
2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35 - черное [x2]
|
||||
1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36 - красное [x2]
|
||||
|
||||
37 - два нуля [x36]
|
||||
38 - ноль [x36]
|
||||
|
||||
1-2-3-37-38 - потолок [x5]
|
||||
|
||||
1-2-3-4-5-6-7-8-9-10-11-12 - 1 сектор [x3]
|
||||
13-14-15-16-17-18-19-20-21-22-23-24 - 2 сектор [x3]
|
||||
25-26-27-28-29-30-31-32-33-34-35-36 - 3 сектор [x3]
|
||||
|
||||
*/
|
||||
|
||||
if ($bt == '' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '35-36' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '34-35' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '32-33' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '31-32' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '29-30' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '28-29' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '26-27' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '25-26' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '23-24' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '22-23' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '20-21' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '19-20' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '17-18' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '16-17' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '14-15' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '13-14' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '11-12' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '10-11' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '8-9' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '7-8' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '5-6' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '4-5' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '2-3' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '1-2' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '32-33-35-36' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '31-32-34-35' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '29-30-32-33' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '28-29-31-32' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '26-27-29-30' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '25-26-28-29' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '23-24-26-27' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '22-23-25-26' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '20-21-23-24' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '19-20-22-23' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '17-18-20-21' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '16-17-19-20' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '14-15-17-18' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '13-14-16-17' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '11-12-14-15' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '10-11-13-14' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '8-9-11-12' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '7-8-10-11' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '5-6-8-9' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '4-5-7-8' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '2-3-5-6' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '1-2-4-5' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '2-3-37' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '1-2-38' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '38-1' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '2-4-6-8-10-12-14-16-18-20-22-24-26-28-30-32-34-36' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '1-3-5-7-9-11-13-15-17-19-21-23-25-27-29-31-33-35' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '28-29-30-31-32-33' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '22-23-24-25-26-27' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '16-17-18-19-20-21' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '10-11-12-13-14-15' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '4-5-6-7-8-9' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '31-32-33-34-35-36' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '25-26-27-28-29-30' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '19-20-21-22-23-24' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '13-14-15-16-17-18' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '7-8-9-10-11-12' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '1-2-3-4-5-6' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '34-35-36' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '31-32-33' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '28-29-30' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '25-26-27' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '22-23-24' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '19-20-21' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '16-17-18' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '13-14-15' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '10-11-12' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '7-8-9' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '6-5-4' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '1-2-3' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '3-6-9-12-15-18-21-24-27-30-33-36' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '2-5-8-11-14-17-20-23-26-29-32-35' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '1-4-7-10-13-16-19-22-25-28-31-34' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '1-2-3-37-38' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '1-2-3-4-5-6-7-8-9-10-11-12' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '13-14-15-16-17-18-19-20-21-22-23-24' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '25-26-27-28-29-30-31-32-33-34-35-36' && $good == 0) {
|
||||
$good++;
|
||||
} elseif ($bt == '1-2-4-5' && $good == 0) {
|
||||
$good++;
|
||||
}
|
||||
$_GET['coin'] = (int)$_GET['coin'];
|
||||
if ($_GET['coin'] < 1) {
|
||||
$good = 0;
|
||||
}
|
||||
if ($_GET['coin'] > $u->bank['money2']) {
|
||||
$good = 0;
|
||||
}
|
||||
if ($good == 1) {
|
||||
$u->bank['money2'] -= ((int)$_GET['coin']);
|
||||
|
||||
$stvka = '';
|
||||
|
||||
if ($stvka == '') {
|
||||
$stvka = '<i>неизвестная зона ставки</i>';
|
||||
}
|
||||
|
||||
$cmsg = new ChatMessage();
|
||||
$cmsg->setCity($u->info['city']);
|
||||
$cmsg->setRoom($u->info['room']);
|
||||
$cmsg->setLogin('Крупье');
|
||||
$cmsg->setText("Игрок {$u->info['login']} сделал ставку {$_GET['coin']} екр на $stvka, игра №{$gid['id']}.");
|
||||
$cmsg->setType(6);
|
||||
(new Chat())->sendMsg($cmsg);
|
||||
|
||||
mysql_query(
|
||||
'UPDATE `bank` SET `money2` = ' . $u->bank['money2'] . ' WHERE `id` = "' . $u->bank['id'] . '" LIMIT 1'
|
||||
);
|
||||
mysql_query(
|
||||
'INSERT INTO `ruletka_coin` (`uid`,`login`,`money`,`time`,`game_id`,`win2`) VALUES ("' . $u->info['id'] . '","' . $u->info['login'] . '","' . $_GET['coin'] . '","' . time(
|
||||
) . '","' . $gid['id'] . '","' . $bt . '")'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$add = true;
|
||||
}
|
||||
|
||||
//обновляем ставки
|
||||
$pos = [
|
||||
0 => '2-4-6-8-10-11-13-15-17-20-22-24-26-28-29-31-33-35',
|
||||
1 => '1-3-5-7-9-12-14-16-18-19-21-23-25-27-30-32-34-36',
|
||||
2 => '1-2-3-37-38',
|
||||
3 => '1-2-3-4-5-6-7-8-9-10-11-12',
|
||||
4 => '13-14-15-16-17-18-19-20-21-22-23-24',
|
||||
5 => '25-26-27-28-29-30-31-32-33-34-35-36',
|
||||
6 => '1-4-7-10-13-16-19-22-25-28-31-34',
|
||||
7 => '2-5-8-11-14-17-20-23-26-29-32-35',
|
||||
8 => '3-6-9-12-15-18-21-24-27-30-33-36',
|
||||
9 => '1-2-3',
|
||||
10 => '6-5-4',
|
||||
11 => '7-8-9',
|
||||
12 => '10-11-12',
|
||||
13 => '13-14-15',
|
||||
14 => '16-17-18',
|
||||
15 => '19-20-21',
|
||||
16 => '22-23-24',
|
||||
17 => '25-26-27',
|
||||
18 => '28-29-30',
|
||||
19 => '31-32-33',
|
||||
20 => '34-35-36',
|
||||
21 => '1-2-3-4-5-6',
|
||||
22 => '7-8-9-10-11-12',
|
||||
23 => '13-14-15-16-17-18',
|
||||
24 => '19-20-21-22-23-24',
|
||||
25 => '25-26-27-28-29-30',
|
||||
26 => '31-32-33-34-35-36',
|
||||
27 => '4-5-6-7-8-9',
|
||||
28 => '10-11-12-13-14-15',
|
||||
29 => '16-17-18-19-20-21',
|
||||
30 => '22-23-24-25-26-27',
|
||||
31 => '28-29-30-31-32-33',
|
||||
32 => '1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18',
|
||||
33 => '19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36',
|
||||
34 => '1-3-5-7-9-11-13-15-17-19-21-23-25-27-29-31-33-35',
|
||||
35 => '2-4-6-8-10-12-14-16-18-20-22-24-26-28-30-32-34-36',
|
||||
36 => '38-1',
|
||||
37 => '1-2-38',
|
||||
38 => '2-3-37',
|
||||
39 => '32-33-35-36',
|
||||
40 => '31-32-34-35',
|
||||
41 => '29-30-32-33',
|
||||
42 => '28-29-31-32',
|
||||
43 => '26-27-29-30',
|
||||
44 => '25-26-28-29',
|
||||
45 => '23-24-26-27',
|
||||
46 => '22-23-25-26',
|
||||
47 => '20-21-23-24',
|
||||
48 => '19-20-22-23',
|
||||
49 => '17-18-20-21',
|
||||
50 => '16-17-19-20',
|
||||
51 => '14-15-17-18',
|
||||
52 => '13-14-16-17',
|
||||
53 => '11-12-14-15',
|
||||
54 => '10-11-13-14',
|
||||
55 => '8-9-11-12',
|
||||
56 => '7-8-10-11',
|
||||
57 => '5-6-8-9',
|
||||
58 => '4-5-7-8',
|
||||
59 => '2-3-5-6',
|
||||
60 => '1-2-4-5',
|
||||
61 => '1-2',
|
||||
62 => '2-3',
|
||||
63 => '4-5',
|
||||
64 => '5-6',
|
||||
65 => '7-8',
|
||||
66 => '8-9',
|
||||
67 => '10-11',
|
||||
68 => '11-12',
|
||||
69 => '13-14',
|
||||
70 => '14-15',
|
||||
71 => '16-17',
|
||||
72 => '17-18',
|
||||
73 => '19-20',
|
||||
74 => '20-21',
|
||||
75 => '22-23',
|
||||
76 => '23-24',
|
||||
77 => '25-26',
|
||||
78 => '26-27',
|
||||
79 => '28-29',
|
||||
80 => '29-30',
|
||||
81 => '31-32',
|
||||
82 => '32-33',
|
||||
83 => '34-35',
|
||||
84 => '35-36',
|
||||
];
|
||||
|
||||
function testCoin($s, $stt)
|
||||
{
|
||||
global $u, $win;
|
||||
$sp = mysql_query(
|
||||
'SELECT * FROM `ruletka_coin` WHERE `game_id` = "' . $s . '" AND `money` > 0 AND `win2` = "' . $stt . '" AND `uid` != "' . $u->info['id'] . '"'
|
||||
);
|
||||
$cr = 0;
|
||||
$am = 0;
|
||||
$usr = '';
|
||||
$lu = [];
|
||||
while ($pl = mysql_fetch_array($sp)) {
|
||||
$cr = $pl['money'];
|
||||
if (!isset($lu[$pl['uid']]) && count($lu) < 4) {
|
||||
$usr .= '-' . $pl['money'];
|
||||
$lu[$pl['uid']] = true;
|
||||
}
|
||||
$am++;
|
||||
}
|
||||
$us = 0; //Ставка игрока
|
||||
$sp = mysql_query(
|
||||
'SELECT * FROM `ruletka_coin` WHERE `game_id` = "' . $s . '" AND `money` > 0 AND `win2` = "' . $stt . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 100'
|
||||
);
|
||||
while ($pl = mysql_fetch_array($sp)) {
|
||||
$cr = $pl['money'];
|
||||
$us += $pl['money'];
|
||||
$am++;
|
||||
}
|
||||
$i = 0;
|
||||
while ($i < 4) {
|
||||
if ($i > count($lu)) {
|
||||
$usr .= '-0';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if ($am > 0) {
|
||||
$win[4] .= $stt . '|' . $cr . '-' . $us . '' . $usr . ',';
|
||||
}
|
||||
}
|
||||
|
||||
//ставки на числа
|
||||
$i = 1;
|
||||
while ($i <= 38) {
|
||||
testCoin($gid['id'], $i);
|
||||
$i++;
|
||||
}
|
||||
//комбинированные ставки
|
||||
$i = 0;
|
||||
while ($i < count($pos)) {
|
||||
testCoin($gid['id'], $pos[$i]);
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($add) {
|
||||
//создаем новую игру
|
||||
$gid2 = ['id' => 0, 'room' => $u->info['room'], 'time' => time(), 'time_start' => time() + 74, 'win' => floor(
|
||||
rand(100, 3800) / 100
|
||||
), 'win_line' => '', 'end' => 0];
|
||||
$s37 = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT `id` FROM `ruletka` WHERE `win` = "37" OR `win` = "38" AND `time` > "' . (time() - round(
|
||||
3600 / 10000 * rand(5000, 10000)
|
||||
)) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($s37['id'])) {
|
||||
$gid2['win'] = floor(rand(100, 3600) / 100);
|
||||
}
|
||||
$ins = mysql_query(
|
||||
'INSERT INTO `ruletka` (`room`,`time`,`time_start`,`win`,`win_line`) VALUES ("' . $gid2['room'] . '","' . $gid2['time'] . '","' . $gid2['time_start'] . '","' . $gid2['win'] . '","' . $gid2['win_line'] . '")'
|
||||
);
|
||||
$gid2['id'] = mysql_insert_id();
|
||||
if ($ins) {
|
||||
$gid = $gid2;
|
||||
}
|
||||
unset($gid2);
|
||||
}
|
||||
|
||||
$u_w = [0 => [], 1 => [], 2 => [], 3 => []];
|
||||
|
||||
$sm = $u->testAction('`city` = "' . $u->info['city'] . '" AND `vars` = "casino_balance" LIMIT 1', 1);
|
||||
if (!isset($sm['id'])) {
|
||||
$u->addAction(time(), 'casino_balance', 0);
|
||||
}
|
||||
|
||||
//обновляем выйгрыши
|
||||
$sp = mysql_query('SELECT * FROM `ruletka` WHERE `end` = "0" AND `time_start` <= ' . time() . '');
|
||||
while ($pl = mysql_fetch_array($sp)) {
|
||||
$end = mysql_query('UPDATE `ruletka` SET `end` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
||||
if ($end) {
|
||||
//выдаем выйгрышь
|
||||
$sp2 = mysql_query('SELECT * FROM `ruletka_coin` WHERE `end` = "0" AND `game_id` = "' . $pl['id'] . '"');
|
||||
while ($pl2 = mysql_fetch_array($sp2)) {
|
||||
$upd = mysql_query(
|
||||
'UPDATE `ruletka_coin` SET `end` = "' . time() . '" WHERE `id` = "' . $pl2['id'] . '" LIMIT 1'
|
||||
);
|
||||
if ($upd) {
|
||||
$wn = 0;
|
||||
$wn2 = 0;
|
||||
$xv = 2;
|
||||
if ($pl2['win2'] == $pl['win']) {
|
||||
$wn++;
|
||||
} else {
|
||||
$i = 0;
|
||||
$j = explode('-', $pl2['win2']);
|
||||
$xv = floor(1 + 34 / count($j));
|
||||
while ($i < count($j)) {
|
||||
if ($j[$i] == $pl['win']) {
|
||||
$wn2++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($wn > 0) {
|
||||
//перечисляем деньги [x8], если зеро то [x36]
|
||||
if ($pl['win'] > 36) {
|
||||
$nmn = ((int)$pl2['money'] * 35);
|
||||
} else {
|
||||
$nmn = ((int)$pl2['money'] * 35);
|
||||
}
|
||||
mysql_query(
|
||||
'UPDATE `bank` SET `money2` = `money2` + "' . $nmn . '" WHERE `uid` = "' . $pl2['uid'] . '" ORDER BY `useNow` DESC LIMIT 1'
|
||||
);
|
||||
} elseif ($wn2 > 0) {
|
||||
//перечисляем деньги по определенной формуле
|
||||
$nmn = ((int)$pl2['money'] * $xv);
|
||||
mysql_query(
|
||||
'UPDATE `bank` SET `money2` = `money2` + "' . $nmn . '" WHERE `uid` = "' . $pl2['uid'] . '" ORDER BY `useNow` DESC LIMIT 1'
|
||||
);
|
||||
} else {
|
||||
//проиграли
|
||||
mysql_query('UPDATE `ruletka_coin` SET `end` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
||||
mysql_query(
|
||||
'UPDATE `actions` SET `vals` = `vals` + "' . mysql_real_escape_string(
|
||||
0 + $pl2['money']
|
||||
) . '" WHERE `id` = "' . $sm['id'] . '" LIMIT 1'
|
||||
);
|
||||
}
|
||||
|
||||
if ($wn > 0 || $wn2 > 0) {
|
||||
$u->addDelo(
|
||||
1, $pl2['uid'],
|
||||
'"<font color=red>Casino.' . $u->info['city'] . '</font>": Выиграл ' . $nmn . ' еекр.',
|
||||
time(), $u->info['city'], 'Casino.' . $u->info['city'] . '', 0, 0
|
||||
);
|
||||
if (!isset($u_w[1][$pl2['uid']])) {
|
||||
$u_w[0][count($u_w[0])] = $pl2['uid'];
|
||||
$u_w[2][count($u_w[0]) - 1] = $pl2['game_id'];
|
||||
}
|
||||
$u_w[1][$pl2['uid']] += (int)$nmn;
|
||||
}
|
||||
$u_w[3][$pl2['uid']] += (int)$pl2['money'];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($u_w[0]) > 0) {
|
||||
$i = 0;
|
||||
while ($i < count($u_w[0])) {
|
||||
if ($u_w[1][$u_w[0][$i]] > 0) {
|
||||
$infu = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT
|
||||
`u`.`id`,
|
||||
`u`.`align`,
|
||||
`u`.`login`,
|
||||
`u`.`clan`,
|
||||
`u`.`level`,
|
||||
`u`.`city`,
|
||||
`u`.`online`,
|
||||
`u`.`sex`,
|
||||
`u`.`cityreg`
|
||||
FROM `users` AS `u` WHERE `u`.`id`="' . mysql_real_escape_string($u_w[0][$i]) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
|
||||
mysql_query(
|
||||
'UPDATE `actions` SET `vals` = `vals` + "' . mysql_real_escape_string(
|
||||
(0 + $u_w[3][$u_w[0][$i]]) - $u_w[1][$u_w[0][$i]]
|
||||
) . '" WHERE `id` = "' . $sm['id'] . '" LIMIT 1'
|
||||
);
|
||||
|
||||
$cmsg = new ChatMessage();
|
||||
$cmsg->setCity($u->info['city']);
|
||||
$cmsg->setRoom(389);
|
||||
$cmsg->setLogin('Крупье');
|
||||
$cmsg->setText("Игрок {$infu['login']} выиграл {$u_w[1][$u_w[0][$i]]} екр, ставка {$u_w[3][$u_w[0][$i]]} екр, игра №{$u_w[2][$i]}.");
|
||||
$cmsg->setType(6);
|
||||
(new Chat())->sendMsg($cmsg);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($gid['id'])) {
|
||||
if ($time < 0) {
|
||||
$time = 0;
|
||||
}
|
||||
//Выбираем статус игры
|
||||
if ($time > 0) {
|
||||
//делаем ставки
|
||||
$status = 1;
|
||||
$sp = mysql_query(
|
||||
'SELECT * FROM `ruletka_coin` WHERE `end` = "0" AND `uid` = "' . $u->info['id'] . '" AND `game_id` = "' . $gid['id'] . '"'
|
||||
);
|
||||
$win[3] = 0;
|
||||
while ($pl = mysql_fetch_array($sp)) {
|
||||
$win[3] += $pl['money'];
|
||||
}
|
||||
} else {
|
||||
//играем
|
||||
$status = 2;
|
||||
//выводим выйгрыш + ставку
|
||||
$sp = mysql_query(
|
||||
'SELECT * FROM `ruletka_coin` WHERE `end` > "0" AND `uid` = "' . $u->info['id'] . '" AND `game_id` = "' . $gid['id'] . '"'
|
||||
);
|
||||
$win[2] = 0;
|
||||
while ($pl = mysql_fetch_array($sp)) {
|
||||
$win[2] += $pl['money'];
|
||||
$win[3] += $pl['money'];
|
||||
$win[1] += $pl['money'];
|
||||
}
|
||||
}
|
||||
if ($win[0] > 0) {
|
||||
unset($mnr);
|
||||
}
|
||||
if (isset($mnr)) {
|
||||
$mnr = '&cash=' . floor(0 + $u->bank['money2']);
|
||||
}
|
||||
$r = 'time=' . $time . '&game=' . $gid['id'] . '' . $mnr . '&betsum=' . $win[3] . '&status=' . $status . '&players=' . $win[5] . '&bets=' . $win[4] . '&win=' . $win[0] . '&wbets=' . $win[1] . '&wmoney=' . $win[2] . '';
|
||||
echo $r;
|
||||
}
|
||||
}
|
||||
|
129
social.php
129
social.php
@ -1,129 +0,0 @@
|
||||
<?php
|
||||
|
||||
die();
|
||||
|
||||
define('GAME',true);
|
||||
include('_incl_data/__config.php');
|
||||
include('_incl_data/class/__db_connect.php');
|
||||
$u = User::start();
|
||||
//
|
||||
if(isset($u->info['id'])) {
|
||||
$mcf = mysql_fetch_array(mysql_query('SELECT * FROM `mini_actions` WHERE `uid` = "'.$u->info['id'].'" AND (`val` = "vkauth" OR `val` = "fbauth" OR `val` = "okauth") LIMIT 1'));
|
||||
if(isset($mcf['id'])) {
|
||||
die('Вы уже подтвердили одну страницу в социальной сети.');
|
||||
}
|
||||
}
|
||||
if(!isset($u->info['id'])) {
|
||||
echo 'Вы не авторизовались в игре.';
|
||||
}elseif(isset($_GET['vkconnect'])) {
|
||||
//
|
||||
require_once('vk/VK.php');
|
||||
require_once('vk/VKException.php');
|
||||
//
|
||||
$vk_config = array(
|
||||
'app_id' => '5145826',
|
||||
'api_secret' => 'V90yIzlgSglfgrnHw7Ny',
|
||||
'callback_url' => '/social.php?vkconnect',
|
||||
'api_settings' => 'offline,friends,email'
|
||||
);
|
||||
$vk = new VK\VK($vk_config['app_id'], $vk_config['api_secret']);
|
||||
//
|
||||
echo '<center style="font-size:20px;"><br><br>';
|
||||
if(isset($_GET['error']) && $_GET['error'] == 'access_denied') {
|
||||
echo 'Вы отказались привязывать свой аккаунт в социальной сети ВКонтакте.';
|
||||
}else{
|
||||
$access_token = $vk->getAccessToken($_REQUEST['code'], $vk_config['callback_url']);
|
||||
if( $access_token['user_id'] > 0 ) {
|
||||
$mcf = mysql_fetch_array(mysql_query('SELECT * FROM `mini_actions` WHERE `val` = "vkauth" AND `ok` = "'.$access_token['user_id'].'" LIMIT 1'));
|
||||
$ubn = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `id` = "'.$mcf['uid'].'" AND `banned` = 0 LIMIT 1'));
|
||||
if(!isset($ubn['id'])) {
|
||||
unset($mcf);
|
||||
}
|
||||
if(isset($mcf['id'])) {
|
||||
echo 'Ваш аккаунт уже был привязан к одному из персонажей!';
|
||||
}else{
|
||||
$bank = mysql_fetch_array(mysql_query('SELECT * FROM `bank` WHERE `uid` = "'.$u->info['id'].'" LIMIT 1'));
|
||||
//
|
||||
if(!isset($bank['id'])) {
|
||||
echo 'id игрока: '.$u->info['id'].'<br>Откройте игровой банковский счет и попробуйте снова.';
|
||||
}else{
|
||||
mysql_query('UPDATE `bank` SET `money2` = `money2` + 1, `money1` = `money1` + 150 WHERE `id` = "'.$bank['id'].'" LIMIT 1');
|
||||
mysql_query('INSERT INTO `mini_actions` (`uid`,`time`,`val`,`var`,`var2`,`ok`) VALUES (
|
||||
"'.$u->info['id'].'","'.time().'","vkauth","'.mysql_real_escape_string($access_token['email']).'",
|
||||
"'.mysql_real_escape_string($access_token['access_token']).'","'.mysql_real_escape_string($access_token['user_id']).'"
|
||||
)');
|
||||
//
|
||||
echo 'Ваш аккаунт успешно привязан! Спасибо!<br>На счет персонажа <b>'.$u->info['login'].'</b> зачислен 1 екр. и 150 кр.';
|
||||
}
|
||||
}
|
||||
}else{
|
||||
echo 'Информация не получена, попробуйте снова.';
|
||||
}
|
||||
}
|
||||
echo '<br><br>(Через 5 секунд окно автоматически закроется)';
|
||||
echo '</center>';
|
||||
echo '<script>window.opener.location.href=\'main.php?inv=1\';setTimeout("window.close();",5000);</script>';
|
||||
//
|
||||
}elseif(isset($_GET['fbconnect'])) {
|
||||
//
|
||||
require_once('vk/FB.php');
|
||||
// Пример использования класса:
|
||||
session_start();
|
||||
if (!empty($_GET['error'])) {
|
||||
// Пришёл ответ с ошибкой. Например, юзер отменил авторизацию.
|
||||
die($_GET['error']);
|
||||
} elseif (empty($_GET['code'])) {
|
||||
// Самый первый запрос
|
||||
OAuthFB::goToAuth();
|
||||
} else {
|
||||
// Пришёл ответ без ошибок после запроса авторизации
|
||||
|
||||
if (!OAuthFB::checkState($_GET['state'])) {
|
||||
die("The state does not match. You may be a victim of CSRF.");
|
||||
}
|
||||
|
||||
if (!OAuthFB::getToken($_GET['code'])) {
|
||||
die('Error - no token by code');
|
||||
}
|
||||
|
||||
$user = OAuthFB::getUser();
|
||||
if(isset($user->id)) {
|
||||
$mcf = mysql_fetch_array(mysql_query('SELECT * FROM `mini_actions` WHERE `val` = "fbauth" AND `ok` = "'.$user->id.'" LIMIT 1'));
|
||||
$ubn = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `id` = "'.$mcf['uid'].'" AND `banned` = 0 LIMIT 1'));
|
||||
if(!isset($ubn['id'])) {
|
||||
unset($mcf);
|
||||
}
|
||||
if(isset($mcf['id'])) {
|
||||
echo 'Ваш аккаунт уже был привязан к одному из персонажей!';
|
||||
}else{
|
||||
$bank = mysql_fetch_array(mysql_query('SELECT * FROM `bank` WHERE `uid` = "'.$u->info['id'].'" LIMIT 1'));
|
||||
//
|
||||
if(!isset($bank['id'])) {
|
||||
echo 'id игрока: '.$u->info['id'].'<br>Откройте игровой банковский счет и попробуйте снова.';
|
||||
}else{
|
||||
mysql_query('UPDATE `bank` SET `money2` = `money2` + 1, `money1` = `money1` + 150 WHERE `id` = "'.$bank['id'].'" LIMIT 1');
|
||||
mysql_query('INSERT INTO `mini_actions` (`uid`,`time`,`val`,`var`,`var2`,`ok`) VALUES (
|
||||
"'.$u->info['id'].'","'.time().'","fbauth","'.mysql_real_escape_string($user->id).'",
|
||||
"","'.mysql_real_escape_string($user->id).'"
|
||||
)');
|
||||
//
|
||||
echo 'Ваш аккаунт успешно привязан! Спасибо!<br>На счет персонажа <b>'.$u->info['login'].'</b> зачислен 1 екр. и 150 кр.';
|
||||
}
|
||||
}
|
||||
echo '<br><br>(Через 5 секунд окно автоматически закроется)';
|
||||
echo '</center>';
|
||||
echo '<script>window.opener.location.href=\'main.php?inv=1\';setTimeout("window.close();",5000);</script>';
|
||||
}else{
|
||||
die('Не удалось получить данные вашей странички Facebook');
|
||||
}
|
||||
/*
|
||||
* Вот и всё - мы узнали основные данные авторизованного юзера.
|
||||
* $user в этом примере состоит из двух полей: id, name.
|
||||
* Делайте с ними что угодно - регистрируйте, авторизуйте, ругайте...
|
||||
*/
|
||||
}
|
||||
//
|
||||
}else{
|
||||
echo 'Мы не работает с подобной социальной сетью.';
|
||||
}
|
||||
?>
|
87
vk/FB.php
87
vk/FB.php
@ -1,87 +0,0 @@
|
||||
<?php
|
||||
|
||||
class Utils {
|
||||
public static function redirect($uri = '') {
|
||||
header("HTTP/1.1 301 Moved Permanently");
|
||||
header("Location: ".$uri, TRUE, 302);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
class OAuthFB {
|
||||
|
||||
const APP_ID = 902955353157156; //App ID/API Key
|
||||
const APP_SECRET = '7c7540c3e593a802969be88d0a6553d4'; //App Secret
|
||||
const URL_CALLBACK = '/social.php?fbconnect'; //URL Вашего сайта, на который произойдет перенаправление
|
||||
const URL_OATH = 'httpss://www.facebook.com/dialog/oauth';
|
||||
const URL_ACCESS_TOKEN = 'httpss://graph.facebook.com/oauth/access_token';
|
||||
const URL_GET_ME = 'httpss://graph.facebook.com/me';
|
||||
|
||||
private static $token;
|
||||
public static $userId;
|
||||
public static $userData;
|
||||
|
||||
/**
|
||||
* @url httpss://developers.facebook.com/docs/reference/dialogs/oauth
|
||||
*/
|
||||
public static function goToAuth()
|
||||
{
|
||||
$_SESSION['state'] = md5(uniqid(rand(), TRUE));
|
||||
Utils::redirect(self::URL_OATH .
|
||||
'?client_id=' . sprintf('%.0f', self::APP_ID) .
|
||||
'&redirect_uri=' . urlencode(self::URL_CALLBACK) .
|
||||
"&state=" . $_SESSION['state']);
|
||||
}
|
||||
|
||||
public static function getToken($code) {
|
||||
|
||||
$url = self::URL_ACCESS_TOKEN .
|
||||
'?client_id=' . sprintf('%.0f', self::APP_ID) .
|
||||
'&redirect_uri=' . urlencode(self::URL_CALLBACK) .
|
||||
'&client_secret=' . self::APP_SECRET .
|
||||
'&code=' . $code;
|
||||
|
||||
if (!($response = @file_get_contents($url))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
parse_str($response, $result);
|
||||
|
||||
if (empty($result['access_token'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self::$token = $result['access_token'];
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Если данных недостаточно, то посмотрите что можно ещё запросить по этой ссы21321лке
|
||||
* @url httpss://developers.facebook.com/docs/graph-api/reference/user
|
||||
*/
|
||||
public static function getUser() {
|
||||
|
||||
if (!self::$token) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$url = self::URL_GET_ME . '?fields=id,email&access_token=' . self::$token;
|
||||
|
||||
if (!($user = @file_get_contents($url))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = json_decode($user);
|
||||
if (empty($user)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self::$userId = $user->id;
|
||||
return self::$userData = $user;
|
||||
}
|
||||
|
||||
public static function checkState($state) {
|
||||
return (isset($_SESSION['state']) && ($_SESSION['state'] === $state));
|
||||
}
|
||||
}
|
||||
?>
|
265
vk/VK.php
265
vk/VK.php
@ -1,265 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* The PHP class for vk.com API and to support OAuth.
|
||||
* @author Vlad Pronsky <vladkens@yandex.ru>
|
||||
* @license httpss://raw.github.com/vladkens/VK/master/LICENSE MIT
|
||||
*/
|
||||
|
||||
namespace VK;
|
||||
|
||||
class VK
|
||||
{
|
||||
/**
|
||||
* VK application id.
|
||||
* @var string
|
||||
*/
|
||||
private $app_id;
|
||||
|
||||
/**
|
||||
* VK application secret key.
|
||||
* @var string
|
||||
*/
|
||||
private $api_secret;
|
||||
|
||||
/**
|
||||
* API version. If null uses latest version.
|
||||
* @var int
|
||||
*/
|
||||
private $api_version;
|
||||
|
||||
/**
|
||||
* VK access token.
|
||||
* @var string
|
||||
*/
|
||||
private $access_token;
|
||||
|
||||
/**
|
||||
* Authorization status.
|
||||
* @var bool
|
||||
*/
|
||||
private $auth = false;
|
||||
|
||||
/**
|
||||
* Instance curl.
|
||||
* @var Resource
|
||||
*/
|
||||
private $ch;
|
||||
|
||||
const AUTHORIZE_URL = 'httpss://oauth.vk.com/authorize';
|
||||
const ACCESS_TOKEN_URL = 'httpss://oauth.vk.com/access_token';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param string $app_id
|
||||
* @param string $api_secret
|
||||
* @param string $access_token
|
||||
* @throws VKException
|
||||
*/
|
||||
public function __construct($app_id, $api_secret, $access_token = null)
|
||||
{
|
||||
$this->app_id = $app_id;
|
||||
$this->api_secret = $api_secret;
|
||||
$this->setAccessToken($access_token);
|
||||
|
||||
$this->ch = curl_init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
curl_close($this->ch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set special API version.
|
||||
* @param int $version
|
||||
* @return void
|
||||
*/
|
||||
public function setApiVersion($version)
|
||||
{
|
||||
$this->api_version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Access Token.
|
||||
* @param string $access_token
|
||||
* @throws VKException
|
||||
* @return void
|
||||
*/
|
||||
public function setAccessToken($access_token)
|
||||
{
|
||||
$this->access_token = $access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns base API url.
|
||||
* @param string $method
|
||||
* @param string $response_format
|
||||
* @return string
|
||||
*/
|
||||
public function getApiUrl($method, $response_format = 'json')
|
||||
{
|
||||
return 'httpss://api.vk.com/method/' . $method . '.' . $response_format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns authorization link with passed parameters.
|
||||
* @param string $api_settings
|
||||
* @param string $callback_url
|
||||
* @param bool $test_mode
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthorizeUrl($api_settings = '',
|
||||
$callback_url = 'httpss://api.vk.com/blank.html', $test_mode = false)
|
||||
{
|
||||
$parameters = array(
|
||||
'client_id' => $this->app_id,
|
||||
'scope' => $api_settings,
|
||||
'redirect_uri' => $callback_url,
|
||||
'response_type' => 'code'
|
||||
);
|
||||
|
||||
if ($test_mode)
|
||||
$parameters['test_mode'] = 1;
|
||||
|
||||
return $this->createUrl(self::AUTHORIZE_URL, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns access token by code received on authorization link.
|
||||
* @param string $code
|
||||
* @param string $callback_url
|
||||
* @throws VKException
|
||||
* @return array
|
||||
*/
|
||||
public function getAccessToken($code, $callback_url = 'httpss://api.vk.com/blank.html')
|
||||
{
|
||||
if (!is_null($this->access_token) && $this->auth) {
|
||||
throw new VKException('Already authorized.');
|
||||
}
|
||||
|
||||
$parameters = array(
|
||||
'client_id' => $this->app_id,
|
||||
'client_secret' => $this->api_secret,
|
||||
'code' => $code,
|
||||
'redirect_uri' => $callback_url
|
||||
);
|
||||
|
||||
$rs = json_decode($this->request(
|
||||
$this->createUrl(self::ACCESS_TOKEN_URL, $parameters)), true);
|
||||
|
||||
if (isset($rs['error'])) {
|
||||
throw new VKException($rs['error'] .
|
||||
(!isset($rs['error_description']) ?: ': ' . $rs['error_description']));
|
||||
} else {
|
||||
$this->auth = true;
|
||||
$this->access_token = $rs['access_token'];
|
||||
return $rs;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return user authorization status.
|
||||
* @return bool
|
||||
*/
|
||||
public function isAuth()
|
||||
{
|
||||
return !is_null($this->access_token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for validity access token.
|
||||
* @param string $access_token
|
||||
* @return bool
|
||||
*/
|
||||
public function checkAccessToken($access_token = null)
|
||||
{
|
||||
$token = is_null($access_token) ? $this->access_token : $access_token;
|
||||
if (is_null($token)) return false;
|
||||
|
||||
$rs = $this->api('getUserSettings', array('access_token' => $token));
|
||||
return isset($rs['response']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute API method with parameters and return result.
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @param string $format
|
||||
* @param string $requestMethod
|
||||
* @return mixed
|
||||
*/
|
||||
public function api($method, $parameters = array(), $format = 'array', $requestMethod = 'get')
|
||||
{
|
||||
$parameters['timestamp'] = time();
|
||||
$parameters['api_id'] = $this->app_id;
|
||||
$parameters['random'] = rand(0, 10000);
|
||||
|
||||
if (!array_key_exists('access_token', $parameters) && !is_null($this->access_token)) {
|
||||
$parameters['access_token'] = $this->access_token;
|
||||
}
|
||||
|
||||
if (!array_key_exists('v', $parameters) && !is_null($this->api_version)) {
|
||||
$parameters['v'] = $this->api_version;
|
||||
}
|
||||
|
||||
ksort($parameters);
|
||||
|
||||
$sig = '';
|
||||
foreach ($parameters as $key => $value) {
|
||||
$sig .= $key . '=' . $value;
|
||||
}
|
||||
$sig .= $this->api_secret;
|
||||
|
||||
$parameters['sig'] = md5($sig);
|
||||
|
||||
if ($method == 'execute' || $requestMethod == 'post') {
|
||||
$rs = $this->request(
|
||||
$this->getApiUrl($method, $format == 'array' ? 'json' : $format), "POST", $parameters);
|
||||
} else {
|
||||
$rs = $this->request($this->createUrl(
|
||||
$this->getApiUrl($method, $format == 'array' ? 'json' : $format), $parameters));
|
||||
}
|
||||
return $format == 'array' ? json_decode($rs, true) : $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Concatenate keys and values to url format and return url.
|
||||
* @param string $url
|
||||
* @param array $parameters
|
||||
* @return string
|
||||
*/
|
||||
private function createUrl($url, $parameters)
|
||||
{
|
||||
$url .= '?' . https_build_query($parameters);
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes request on link.
|
||||
* @param string $url
|
||||
* @param string $method
|
||||
* @param array $postfields
|
||||
* @return string
|
||||
*/
|
||||
private function request($url, $method = 'GET', $postfields = array())
|
||||
{
|
||||
curl_setopt_array($this->ch, array(
|
||||
CURLOPT_USERAGENT => 'new-combats.com_vk_auth',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_POST => ($method == 'POST'),
|
||||
CURLOPT_POSTFIELDS => $postfields,
|
||||
CURLOPT_URL => $url
|
||||
));
|
||||
|
||||
return curl_exec($this->ch);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
;
|
||||
|
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* The exception class for VK library.
|
||||
* @author Vlad Pronsky <vladkens@yandex.ru>
|
||||
* @license httpss://raw.github.com/vladkens/VK/master/LICENSE MIT
|
||||
*/
|
||||
|
||||
namespace VK;
|
||||
|
||||
class VKException extends \Exception { }
|
||||
|
Loading…
Reference in New Issue
Block a user