<?php
/**********************************************************************************
Autopublicator v 1.35 Open. ????? ????? ???? 2021 aekap ITC ??????????, ?? ???????? ??? ?????? ??????????? ??? ?????????????
* ???? ?????? ????? ???????? ?????????????? ??? ????????? ? ???????????????? ?????? ?.02-3.99, ??????? ???????? ? ??????? ??? ????????????.
* ???? ???????? ????????? ?????????? ???????? $dir ? ?????????? ? ?????? ? ?????????: ?????, IP ??? ???????????? ? ? ?????? ?????????? ??????.
* ?????? ????/extension ??? ??????? ????? ???? ??????? ??? ???, ???????? ??? ??? ?? ??????????
* ? ???? ?????? ??????? ????????? ???????? ? ????? ./log.txt
* ------------ README -------------------------------------------------------------
* 1 ??? ????? ???????? ????? ???????????????
* 1.2 APP_TITLE // ????? ??????????
* 1.3 $dis_files // ???? ????? ????????? ? ?????????? ?????????? ????? ? ??????? ??????????
* 1.4 $mode // ????? ???????????? ENABLED_EXTENTIONS ??? DISABLED_EXTENTIONS)
* 1.5 $enabled_extentions // ??? ????????????? $mode = ENABLED_EXTENTIONS
* 1.6 $disabled_extentions // ??? ????????????? $mode = DISABLED_EXTENTIONS
* 2
* 2.1 ???? ?? ?????? ????????? ??? ? ???????? ?????? ????????? ?????????? ?????? ??? ??????????, ??????????? ????? EXTENSION_ENABLED ? ?????????????? ?????????? $ enabled _ extentions
* 2.2 ???? ?? ????????????? ???????? ? ????????? ?????? ????????? ?????????? ?????? ??? ??????????, ??????????? ????? EXTENSION_DISABLED ? ?????????????? ?????????? $ disabled _ extentions
*----------------------------------------------------------------------------------
* ??????????: ????? ??????/?????????, ????????????? ? ??????? $ dis _ files, ?? ????? ???????????? ? ????? ??????? EXTENSION_DISABLED ? EXTENSION_ENABLED
**********************************************************************************/
//////////// CONSTANTS ////////////////////////////////////////////////////////////
define('EXTENSION_DISABLED', 0); // ??? ????: ????????? ??? ?????????? ????? ????????????? ? $disabled_extentions
define('EXTENSION_ENABLED', 1); // ??? ???? ????????? ??? ?????????? ????? ????????????? ? $enabled_extentions
define('en', 0);
define('ru', 1);
define('cz', 2);
define('cn', 3);
define('it', 4);
define('fr', 5);
define('es', 6);
define('de', 7);
//***************** START TO CHANGE ******************************************//
// CONST //
define ('APP_TITLE', "EXTERNET MINI. Autopublicator v 1.35 Open"); // ???????? ???????? ???? ?????????? ???????? ????? ????
define('USER_PASSWORD', 19510104 ); // ????? - ????????. ????????? ??????? ???.
define('LNG_DEFAULT', en ); // ???????? ???????? ????? ??-????????? ?? ??? ????
define('LOG_FILE_DIR', '.'); // ??-????????? ????? ??? ???????? - ????????. ???????? ?? ?? ????? ??????????? ??? ?????????? ?????
define('LOG_FILE_NAME', 'log.txt'); // ??-????????? ??????? ??????? ? ?????????? VARS //
$disabled_extentions = array("exe", "com", "bat", "php", "js", "c", "h", "py", "java", "ini", "cfg");// ??????? ? ???? 0 DISABLED_EXTENTION ???????? ??? ??????? ???????? ? ?????????? ?????????? ??????????
$enabled_extentions = array("txt", "pdf", "odt", "doc","docx", "mp3","mp4", "ogg", "avi"); // ???????? ? ???? ENABLED_EXTENTION ???????? ??? ??????? ?? ?????? ? ?????????? ?????????? ??????
$dis_files = array("index.php", ".", "log.txt"); // ??????????? ?????????? ?????
$dir = "./"; // ?? ????????? ??????????? ????? ??????? ???????.
$mode = EXTENSION_DISABLED; // mode 0 ????????? ? ?????????? ??? ??????????, ????? ????????????? ? $disabled_extentions
// $mode = EXTENSION_ENABLED; // mode 1 ????????? ??? ?????????? ????? ????????????? ? $enabled_extensions
$show_open =
//***************** END TO CHANGE ******************************************/
///////////// VARIABLES /////////--------------------------------------------------
$debug = 0;
$debug1 = false; // ???/???? ???? debug.
$debug2 = false; // ???/???? ???? debug2.
$scan = []; // ????????? $dir ? ????? $scan.
$html = "<div class='container'> <div class='row'>"; // ?????? ??????? ??? ???? ????
$us = ''; // ????? ????? ??????????? ??????
$usr = ''; // ????? ????? ????????? ????????
$sub = ''; // ????? ????? ?????????? ?????
$langs_code = array('en','ru','cz','cn', 'it', 'fr', 'es', 'de');
$langs_labels = array('English', '???????', '?eský', 'Chines', 'Italian', 'French', 'Espanol', 'Deutch');
$warn_message = array('Incorrect username or/and? kaptcha','???????? ????? ?/??? ?????', 'Nesidi Logon a/nego Kaptcha', 'Incorrect username or/and? kaptcha', 'Incorrect username or/and? kaptcha', 'Incorrect username or/and? kaptcha', 'Incorrect username or/and? kaptcha', 'Incorrect username or/and? kaptcha') ;
$btn_value = array('Send', '???????','Poslat','Send','Send','Send','Send','Send');
$lbl_value = array('Password', '??????', 'Heslo', 'Password', 'Password', 'Password', 'Password', 'Password');
$usr_label = array('User', '????????????', 'U?ivátel', 'User', 'User', 'User', 'User', 'User' );
$lng = LNG_DEFAULT ; //???? ??-????????? - ??????????
/////////////// FUNCTIONS /////////////////////////////////////////////////////////
function my_name() {
return (basename(__FILE__));
}
//-----------------------------------------------------------------------------
function disabled($b) {
GLOBAL $dis_files, $disabled_extensions, $debug;
if($debug){echo("<pre>" . __LINE__ . ": ");print_r($dis_files);echo("</pre>");}
$c = false; // $c ?????????? false ??? ????????? ?? ?????????.
if(in_array($b, $dis_files)) return true; // in_array(mixed needle, array haystack, [bool strict])
if(in_array(get_extension($b), $disabled_extensions)) return true; //substr(string string, int start, [int length])
return $c; // strrpos($b, '.')
}
//-----------------------------------------------------------------------------
function get_extension($a='.htsccess'){
GLOBAL $disabled_extensions;
// extract($_REQUEST);
$posr = strrpos($a, ".") + 1;
$posl = strpos($a,".") + 1; //
$len_ = strlen($a);
if($len_- $posr){
if($posl){
return substr($a, ($posr - $len_));
}else{
return substr($a, ($posr - $len_ + 1));
}
}
return false; // substr($a, die ("Extension Not Exists"));
}
//------------------------------------------------
function get_ip_address() {
foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key)
{
if (array_key_exists($key, $_SERVER) === true) {
foreach (explode(',', $_SERVER[$key]) as $ip) {
if (filter_var($ip, FILTER_VALIDATE_IP) !== false) {
return $ip;
}else{
return "";
}
}
}
}
}
//-----------------------------------------------
function log_data($usr){
GLOBAL $debug1;
$log_mess = "\n" . date(" d.m.Y H:i ") . " || " . get_ip_address(). " || " . $usr . " || " . $_SERVER['HTTP_USER_AGENT']; //??????? ?????? ??? ????????
$log_header = " ____???? ? ?????__ || ___IP____ || ?????????? || ??????????...";
$logfile = LOG_FILE_DIR . DIRECTORY_SEPARATOR . LOG_FILE_NAME;
if($debug1) echo("<hr> index.php in " .__LINE__. " \$log_mess = $log_mess");
if (FALSE === is_dir(LOG_FILE_DIR)){mkdir(LOG_FILE_DIR); }
if((FALSE == file_exists($logfile)) || (0)) { $log_mess = $log_header . $log_mess;} // ????????? ?????? ?????????
$_t = fopen($logfile, "a");
$need_h = file($logfile); // ????????? ??????? ? ?????
if(count($need_h)%20 ==19) { $log_mess = "\n" . $log_header . $log_mess;} // ???? 19 ????? ??? ?????? ? ?????????? ?????????, ?? ????????? ????? ?????????
fwrite($_t, $log_mess);
fclose($_t);
}
////////////////// MAIN //////////////////////////////////////
extract($_REQUEST);
if (!strlen($usr)) {
$warn_message = array("UNKNOWN GUEST", "??????????? ???????E??", "UNKNOWN GUEST", "UNKNOWN GUEST", "UNKNOWN GUEST", "UNKNOWN GUEST", "UNKNOWN GUEST", "UNKNOWN GUEST");
$htm = "<html><head>
<meta http-equiv=\"refresh\" content=\"4;URL=index.php?usr=".$warn_message[$lng]."\">
<style> input{
padding:10px;
margin:10px;
font-family: Arial, Tahoma;
font-size: xx-large;
size:10;
color:#353;
}
#footer{
padding:0 10px;
text-align:center;
}
.pannel{
margin:20px;
padding-min:10px;
text-align: center;
font-size: xx-large;
border: dotted gray 2px;
}
.podskazka{
font-style: italic;
color: green;
}
</style> </head><body>
<div class='container'>";
$htm .= "<div class= 'row'>
<div class='btn-warning'>
<h4><span style='color:red;'>". $warn_message[$lng] . "</span></h4>
</div>
</div>";
echo($htm );
exit();
}
/////////////////////////////////////
log_data($usr);
$scan=scandir($dir) ;
if($debug2) {echo("<pre>"); print_r($scan);echo("</pre>"); } // ??????????? ??? ????????.
$disabled_files = my_name(); // ????????? ???????? ? ?????? ?????.
for($i=0;$i<count($scan); $i++) { // ?????? ?????????? ???????? ??-??????.
switch ($scan[$i]) { // ???????? ?????? ??? ??????????? $nadpis.
// case(".") : break; // $nadpis = "????????? ????????????"; break; // ?????? . ?? ????????? ???????????? ??? $nadpis.
case("..") : $nadpis = "<< ???????"; break; // ?????? .. ?? ????? ?? ?????????? ??? $nadpis.
default : $nadpis = $scan[$i]; break; // ??-????????? ????? ??? ?????.
}
if($i===0) {$html .= "<a href=\"javascript:history.back();\"> <div class='col-lg-12 place'> << ??????? </div> </a>"; // <a href='" . $scan[$i] . "'><div class='col-lg-12 place'>" . $nadpis . "</div></a>";
}elseif($i===1){$html .= "";
}else{
if(!disabled($scan[$i])) $html .= "<a href='" . $dir. $scan[$i] . "?lng=".$lng."&usr=".$usr."'><div class='col-lg-2 col-md-3 col-sm-4 place'>" . $nadpis . "</div></a> " ; // ???????? html ?????? ?? ???????????.
}
}
$html .= "</div></div>";
/*
<div class="card border-info mb-3" style="max-width: 20rem;">
<div class="card-header">Header</div>
<div class="card-body">
<h4 class="card-title">Info card title</h4>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
</div>
</div>
*/
?>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo(APP_TITLE)?></title>
<style>
h1,h2,h3{
color: #58a!important;
}
input{
padding:10px;
font-family: Arial, Tahoma;
font-size: xx-large;
}
#footer{
padding:0 10px;
text-align:center;
}
.pannel{
text-align: center;
font-size: xx-large;
border: dotted gray 2px;
}
.place{
padding:5px;
margin:0px;
border:thin solid #fff;
background:#dde;
color:#04a;
border-radius:3px;
text-align:center;
transition: 1s easyin;
}
.place:hover{
background-color:#ccf;
}
.gray-black{
background-color: #aaa;
color:#fff;
font-family:Arial;
padding: 0, 10px 0, 10px;
}
</style>
<script type="text/javascript">
</script>
</head>
<body>
<div class="container">
<div class="row">
<h2><?php echo(APP_TITLE)?></h2>
<?php echo($html);?>
</div>
</div>
<div class="container">
<div class="row">
<footer class="gray-black">
<footer class="gray-black" id="footer">
Internet-Mini. ???????????? ????-??????? ?????????????? . © aekap ITC 2021, web: <a href="http://aekap.c-europe.eu">aekap.c-europe.eu</a>
<br> git: <a href="https://github.com/alexeist/-Internet-Minimalism-Technology">Internet Minimalism Technology</a>
</footer>
</footer>
</div>
</div>
</body>
</html>
<?php
?>
|