Cyber Anakins Lightsaber - A Minishell-based backdoor
<?php
require("design.php");
session_start();
TOP(-1);
LEFTCOLUMN();
CHANNELS();
MAINCOLUMN();
?>
<h1>Архив игр и викторин</h1>
<?php
$canEdit = AdminAuth(RIGHT_EDIT_QUIZ);
if ($canEdit)
{
print "<center style='margin:10 10 10 10'>[ <a href='#' onclick='newQuiz(); return false'>Новая викторина</a> ]</center>\n";
}
$quizPerPage = 15;
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
$mysql = mysqlopen();
$count = 0;
$result = mysqli_query($mysql, "SELECT COUNT(*) FROM libQuizs");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
if ($row = mysqli_fetch_row($result)) $count = intval($row[0]);
mysqli_free_result($result);
$videoCount = 0;
$result = mysqli_query($mysql,
"SELECT
`id`,
`name`,
`desc`,
`link`,
`video`,
`date`
FROM
libQuizs
ORDER BY
`date` DESC
LIMIT $start, $quizPerPage");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
while($row = mysqli_fetch_assoc($result))
{
$id = $row['id'];
print "<div class=quizBlock id=quiz$id>\n";
print "<div class=quizName>"._html_($row['name']);
if ($canEdit)
{
print "<img src='edit.png' class=editBtn onclick='editQuiz($id)'>";
print "<img src='del32x32.png' class=editBtn onclick='delQuiz($id)'>";
}
print "</div>\n";
print "<div class=quizDate>Дата публикации: ".SQLtoDate($row['date'])."</div>\n";
print "<table width=100%><tr><td width=1% valign=top>";
$link = $row['link'];
if (preg_match("/\?v=([^\/\&]*)/", $row['video'], $g) ||
preg_match("/\/([^\/]*)$/",$row['video'], $g))
{
print "<iframe id=video$videoCount width=320 height=200 src=\"https://www.youtube.com/embed/".$g[1]."\" frameborder=0 allowfullscreen></iframe>\n";
}
else
{
$imgFile = "quizs/$id.jpg";
if (!file_exists($imgFile)) $imgFile = "nophotoquiz.jpg";
if ($link!='')
print "<a href='$link' target=_blank><img src=\"$imgFile\" width=320 id=video$videoCount></a>";
else
print "<img src=\"$imgFile\" width=320 id=video$videoCount>";
}
print "</td>\n";
print "<td width=99% class=quizDesc>";
print "<p>"._html_p_($row['desc'])."</p>";
if ($link!='')
{
print "<br><center><input type=button value='Перейти к викторине' onclick=\"window.open('$link','_blank')\"></center>\n";
}
print "</td></tr></table>";
print "</div>\n";
$videoCount++;
}
mysqli_free_result($result);
if ($count > $quizPerPage)
{
print "<hr>\n";
print "<center>";
for($p=1, $s=0; $s < $count; $s+=$quizPerPage, $p++)
{
$cls = $s == $start ? "selpage" : "page";
print "<span class=$cls onclick='location=\"quiz.php?start=$s\"'><a href='quiz.php?start=$s'>$p</a></span> ";
}
print "</center>";
}
?>
<script>
function resizeVideo()
{
var width = window.innerWidth;
if (width > 1010) width-=250;
if (width > 700) width-=250;
width-=400;
var imgWidth = width;
if (imgWidth > 400) imgWidth = 400;
if (width > 640) width=640;
for(var i=0; i < <?php print $videoCount; ?>; i++)
{
var video = document.getElementById('video'+i);
if (video.tagName == "IFRAME")
{
video.width = width;
video.height = width * 9 / 16;
}
else
video.width = imgWidth;
}
}
resizeVideo();
window.addEventListener('resize', resizeVideo);
</script>
<?php
if ($canEdit) {
FILIALLISTINFO();
?>
<script src='admineditor.js'></script>
<script>
function openQuizDialog(json, reload)
{
var dlg = openDialogBoxWithButtons('Викторина '+json.id, 700, 500);
var tabControl = new TabControl(dlg.innerElement, 700, 400);
var page = tabControl.addTab('Общие');
var grid = createPropertyGrid(page);
var nameEditor = createEditProperty(grid, 'Название:', '100%', json.name);
var dateEditor = createDateProperty(grid, 'Дата:', json.date);
var descEditor = createMemoProperty(grid, 'Описание:', 7, json.desc);
var videoEditor = createEditProperty(grid, 'Ссылка на Youtube (если есть):', '100%', json.video);
var linkEditor = createEditProperty(grid, 'Ссылка на викторину (если есть):', '100%', json.link);
createLinkProperty(grid, 'Автор публикации:', json.author, json.authorName, editAdmin);
page = tabControl.addTab('Афиша');
createImageProperty(page, 320,320, json.poster && json.poster!='' ? "quizs/"+json.poster : '',
function(formData, onOK)
{
formData.append('action','quiz:setposter');
formData.append('id',json.id);
sendXHR('api.php', formData,
function(response)
{
onOK(response);
},
function(error)
{
errorBox(error);
});
},
function(fileName, onOK)
{
sendXHR("api.php","action=quiz:delposter&id="+json.id,
function(response)
{
onOK();
},
function(error)
{
errorBox(error);
});
});
var btn = dlg.buttonPanel.appendChild(createInput('button'));
btn.value = "OK";
btn.onclick=function()
{
var post = "action=quiz:set";
post+='&id='+json.id;
post+='&name='+encodeURIComponent(nameEditor.getValue());
post+='&date='+encodeURIComponent(dateEditor.getValue());
post+='&desc='+encodeURIComponent(descEditor.getValue());
post+='&video='+encodeURIComponent(videoEditor.getValue());
post+='&link='+encodeURIComponent(linkEditor.getValue());
var btn = this;
btn.disabled=true;
sendXHR('api.php',post,
function(response)
{
dlg.close();
location.reload();
},
function(error)
{
btn.disabled=false;
errorBox(error);
});
};
btn = dlg.buttonPanel.appendChild(createInput('button'));
btn.value="Закрыть";
btn.onclick = function()
{
dlg.close();
if (reload) location.reload();
};
nameEditor.editor.focus();
dlg.alignInScreenCenter();
}
function editQuiz(id)
{
sendXHR('api.php','action=quiz:get&id='+id,
function(response)
{
openQuizDialog(JSON.parse(response));
},
function(error)
{
errorBox(error);
});
}
function delQuiz(id)
{
yesNoDialog('Удалить данную викторину?','Удаление викторины',
function()
{
sendXHR('api.php','action=quiz:del&id='+id,
function(response)
{
var block = document.getElementById('quiz'+id);
block.parentNode.removeChild(block);
},
function(error)
{
errorBox(error);
});
});
}
function newQuiz()
{
sendXHR('api.php','action=quiz:new',
function(response)
{
openQuizDialog(JSON.parse(response), true);
},
function(error)
{
errorBox(error);
});
}
</script>
<?php } ?>
<br><br>
<?php
MIDDLECOLUMN2();
print "<center><table><tr><td>";
ACTUALLINKS('actualLinksH');
print "</tr></td></table></center>";
FAQ();
MIDDLECOLUMN();
CHANNELS("channelBlockH");
RIGHTCOLUMN();
ACTUALLINKS();
FAQ();
?>
<?php BOTTOM(); ?>
May the force be with you, always.