1006
правок
Kekaloav (обсуждение | вклад) |
Kekaloav (обсуждение | вклад) |
||
Строка 1: | Строка 1: | ||
Строка 655: | Строка 656: | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
<?php | |||
$webroot="/var/www/html/"; | |||
$base=$webroot."base/"; | |||
function save_name($nm,$ip) | |||
{ | |||
global $base; | |||
global $webroot; | |||
$val=file_get_contents($webroot."reg.sh"); | |||
file_put_contents($base.$nm,$ip); | |||
return; | |||
}; | |||
function rettext($text,$name){ | |||
header("Content-Type: text/plain"); | |||
header("Content-Transfer-Encoding: Binary"); | |||
header("Content-Length:".strlen($text)); | |||
header("Content-Disposition: attachment; filename=\"".$name."\""); | |||
echo str_replace("\r","",$text); | |||
exit(); | |||
}; | |||
if(isset($_REQUEST['start'])) { | |||
$name=$_REQUEST['start']; | |||
$a=explode("-",$name); | |||
$val=file_get_contents($webroot."start.sh"); | |||
save_name($name,$_SERVER['REMOTE_ADDR']); | |||
rettext($val,'start.sh'); | |||
}; | |||
if(isset($_REQUEST['reg'])) { | |||
$name=$_REQUEST['reg']; | |||
$a=explode("-",$name); | |||
$val=file_get_contents($webroot."reg.sh"); | |||
save_name($name,$_SERVER['REMOTE_ADDR']); | |||
rettext($val,'reg.sh'); | |||
}; | |||
if(isset($_REQUEST['player'])) { | |||
echo "<!DOCTYPE html> | |||
<html> | |||
<head> | |||
</head> | |||
<body> | |||
<video id=\"video\" controls preload=\"auto\" controls=\"controls\" style='width:80%; height:80%; max-height:100%;' autoplay > | |||
<source src='http://".$_REQUEST['player']."/' type='video/mp4'> | |||
</video> | |||
</body> | |||
</html>"; | |||
exit(); | |||
}; | |||
?> | |||
<!DOCTYPE html><html> | |||
<head lang="ru"> | |||
<meta charset="utf-8"> | |||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |||
<meta name="viewport" content="width=device-width, initial-scale=1"> | |||
<title>Admin</title> | |||
<style> | |||
table,tr,td,th { | |||
border-collapse: collapse; | |||
text-align: left; | |||
border: 1px solid black; | |||
margin: 20px; | |||
padding: 2px; | |||
} | |||
</style> | |||
</head> | |||
<body> | |||
<table> | |||
<tr> <th>NAME</th> <th>IP</th> <th>SSH</th> </tr> | |||
<?php | |||
$dir=`ls $base`; | |||
foreach (explode("\n",$dir) as $name) { | |||
$ip=file_get_contents($base.$name); | |||
$ssh="cch://".$ip; | |||
if($name !="") | |||
{ | |||
echo "<tr> <th>$name</th> <th>$ip</th> <th><a href=\"$ssh\">SSH</a></th> </tr>\n"; | |||
}; | |||
}; | |||
?> | |||
</table> | |||
</body> | |||
</html> | |||
</syntaxhighlight> | </syntaxhighlight> | ||