battles/fight.php
2018-02-13 23:13:56 +02:00

189 lines
7.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
session_start();
if (!isset($_SESSION['uid'])) {
header("Location: index.php");
}
include("config.php");
?>
<html>
<head>
<title>Ещё один БК...</title>
<meta charset="utf-8">
<script src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
function clearc() {
if (document.F1.text.value == '') {
if (confirm('Очистить окно чата?')) {
top.frames['chat'].document.all("mes").innerHTML = '';
}
} else {
document.F1.text.value = '';
}
document.F1.text.focus();
}
</script>
<?php
$my_us = db::c()->query('SELECT `enter_game`, `id` FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc();
if ($my_us['enter_game'] == 1) {
db::c()->query('UPDATE `users` SET `enter_game` = 0 WHERE `id` = ?i', $my_us['id']);
?>
<script>clearc();</script>
<? } ?>
<script type="text/javascript">
function getCookie(Name) {
var search = Name + "="
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1) {
end = document.cookie.length
}
return unescape(document.cookie.substring(offset, end))
}
}
}
var rnd = Math.random();
var delay = 12;
var redHP = 0.33;
var yellowHP = 0.66;
var TimerOn = -1;
var tkHP, maxHP;
function setHPlocal() {
if (tkHP > maxHP) {
tkHP = maxHP;
}
var sz1 = Math.round((149 / maxHP) * tkHP);
var sz2 = 150 - sz1;
if (top.frames['main'].document.all("HP")) {
top.frames['main'].document.HP1.width = sz1;
top.frames['main'].document.HP2.width = sz2;
if (tkHP / maxHP < redHP) {
top.frames['main'].document.HP1.src = 'i/1red.gif';
} else {
if (tkHP / maxHP < yellowHP) {
top.frames['main'].document.HP1.src = 'i/1yellow.gif';
} else {
top.frames['main'].document.HP1.src = 'i/1green.gif';
}
}
var s = top.frames['main'].document.all("HP").innerHTML;
top.frames['main'].document.all("HP").innerHTML = s.substring(0, s.lastIndexOf(':') + 1) + Math.round(tkHP) + "/" + maxHP;
}
tkHP = (tkHP + (maxHP / 100));
if (tkHP < maxHP) {
TimerOn = setTimeout('setHPlocal()', delay * 1000);
} else {
TimerOn = -1;
}
}
var ChatTimerID = -1;
var ChatDelay = 15;
var ChatOm = false;
var ChatSys = false;
var lid = 0;
function RefreshChat() {
var s = '&lid=' + lid;
if (ChatOm) {
s = s + '&om=1';
}
if (ChatSys) {
s = s + '&sys=1';
}
if (ChatTimerID >= 0) {
clearTimeout(ChatTimerID);
}
ChatTimerID = setTimeout('RefreshChat()', ChatDelay * 1000);
top.frames['refreshed'].location = 'ch.php?show=' + Math.random() + s;
}
var changeroom = 1;
var localroom = 1;
setInterval(function () {
if (localroom != changeroom) {
localroom = changeroom;
top.frames['online'].location = 'ch.php?online=' + Math.round(Math.random() * 100000);
}
}, 5000);
var ChatClearTimerID = -1;
var ChatClearDelay = 900;
var ChatClearSize = 10000;
function RefreshClearChat() {
if (ChatClearTimerID >= 0) {
clearTimeout(ChatClearTimerID);
}
ChatClearTimerID = setTimeout('RefreshClearChat()', ChatClearDelay * 1000);
var s = top.frames['chat'].document.all("mes").innerHTML;
if (s.length > ChatClearSize) {
var j = s.lastIndexOf('<br />', s.length - ChatClearSize);
top.frames['chat'].document.all("mes").innerHTML = s.substring(j, s.length);
}
}
function getInternetExplorerVersion() {
var rv = -1;
if (navigator.appName == 'Microsoft Internet Explorer') {
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null) {
rv = parseFloat(RegExp.$1);
}
}
if (rv == -1) {
if (navigator.userAgent.match(/Trident\/7.0.*rv.*11\.0/)) return 1;
}
if (rv == -1) {
if (navigator.appVersion.indexOf("MSIE 10") !== -1) return 1;
}
return rv;
}
var frmval = 1;
var addstyle = "";
if (getInternetExplorerVersion() != -1) {
frmval = 0;
addstyle = ' style="border-left: 1px solid #cccccc" ';
}
var user = getCookie("battle");
if ((user == null) || (user == '')) {
document.write('<BODY>Внимание! В вашем браузере отключена поддержка Cookies. Включите чтобы играть.<BR></BODY>');
} else {
document.write(
'<frameset rows="37, *, 30, 5">' +
'<frame src="top_menu.php" scrolling="no" noresize="noresize" FRAMEBORDER="0" MARGINWIDTH="0" MARGINHEIGHT="0">' +
'<frameset cols="9, *, 9">' +
'<frame src="left.html" scrolling="no" noresize="noresize" FRAMEBORDER="0" MARGINWIDTH="0" MARGINHEIGHT="0">' +
'<frameset rows="72%, *, 0">' +
'<frame name="main" src="main.php?top=' + rnd + '" style="border-bottom-width: 2px; border-bottom-style:solid; border-bottom-color:#B0B0B0">' +
'<frameset cols="*,263">' +
'<frame id="chat" name="chat" src="buttons.php?ch=' + rnd + '" scrolling="yes" FRAMEBORDER="0" MARGINWIDTH="3" MARGINHEIGHT="3">' +
'<frame name="online" src="ch.php?online=' + rnd + '" scrolling="yes" FRAMEBORDER=' + frmval + ' BORDER="0" MARGINWIDTH="3" MARGINHEIGHT="0" ' + addstyle + '>' +
'</frameset>' +
'<frame name="refreshed" scrolling="no" noresize="noresize" src="refreshed.html">' +
'</frameset>' +
'<frame src="right.html" scrolling="no" noresize="noresize" FRAMEBORDER="0" MARGINWIDTH="0" MARGINHEIGHT="0">' +
'</frameset>' +
'<frame name="bottom" scrolling="no" noresize="noresize" src="buttons.php?' + rnd + '">' +
'<frame src="bottom.html" scrolling="no" noresize="noresize" FRAMEBORDER="0" MARGINWIDTH="0" MARGINHEIGHT="0">' +
'</frameset>');
}
</script>
<meta content="MSHTML 5.00.2614.3500" name="GENERATOR"/>
</head>
<body style="text-align: center;">
<noscript><span style="color: Red;">Внимание!</span> В вашем браузере отключена поддержка JavaScript. Включите чтобы играть.</noscript>
</body>
</html>