Самый опасный code cleanup. Удалена куча старого яваскрипта.

This commit is contained in:
lopar 2018-12-13 02:30:00 +02:00
parent 03d07b0543
commit 879207f5cc

165
fight.php
View File

@ -4,142 +4,9 @@ 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>
db::c()->query('UPDATE `users` SET `enter_game` = 0 WHERE `enter_game` = 1 AND `id` = ?i', $_SESSION['uid']);
<?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);
}
}
var frmval = 1;
var addstyle = "";
var user = getCookie("battle");
if ((user == null) || (user == '')) {
document.write('<BODY>Внимание! В вашем браузере отключена поддержка Cookies. Включите чтобы играть.<BR></BODY>');
} else {
document.write(
// OLD FRAMESET
// '<frameset rows="45, *, 30">' +
// '<frame src="top_menu.php" scrolling="no" noresize="noresize" FRAMEBORDER="0" MARGINWIDTH="0" MARGINHEIGHT="0">' +
// '<frameset rows="72%, *">' +
@ -151,17 +18,29 @@ include("config.php");
// '</frameset>' +
// '<frame name="bottom" scrolling="no" noresize="noresize" src="buttons.php?' + rnd + '">' +
// '</frameset>'
'<frameset rows="45, *">' +
'<frame src="top_menu.php" scrolling="no" noresize>' +
'<frameset rows="75%, *">' +
'<frame name="main" src="main.php?top=' + rnd + '" style="border-bottom: 1px solid silver;">' +
'<frame id="chat" name="chat" src="chat.php" scrolling="yes">' +
'</frameset>' +
'</frameset>'
);
?>
<html>
<head>
<title>Окно игры</title>
<meta charset="utf-8">
<script>
if (!navigator.cookieEnabled) {
document.write('Внимание! В вашем браузере отключена поддержка Cookies. Включите чтобы играть.');
try {
window.stop();
} catch (exception) {
document.execCommand('Stop');
}
}
</script>
</head>
<body>
<frameset rows="25, *">
<frame src="top_menu.php" scrolling="no" noresize frameborder=0>
<frameset rows="75%, *">
<frame name="main" src="main.php?top=<?= mt_rand() ?>" style="border-bottom: 1px solid silver;" frameborder=0>
<frame id="chat" name="chat" src="chat.php" scrolling="yes" frameborder=0>
</frameset>
</frameset>'
</body>
</html>