This code allows you make preview-pictures for input without uploading this pictures on server. Detail info on english
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prgrsbr($oneStep, $maxSteps){ | |
$percent = $oneStep / $maxSteps * 100; | |
$width = $percent * 10; // CSS property. 1% = 10px / 100% = 1000px | |
echo '<div style="width:1000px;height:40px;border:1px solid black;"><div style="width:'.$width.'px;height:40px;line-height:40px;background-color:green;text-align:center">'.$percent.'%</div></div>'; | |
} | |
$iMax = 10000; | |
for ($i = 1; $i <= $iMax; $i++) { | |
prgrsbr($i, $iMax); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// функция для безопасности строк | |
function safestr($str){ | |
$str = trim($str); | |
$str = stripslashes($str); | |
$str = htmlspecialchars($str); | |
return $str; | |
} | |
// проверка корректности полученных данных | |
function testFields($fields){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$R = 6371; // Earth radius in km | |
$dLat = (($q[0] - $p[0]) * pi() / 180); | |
$dLon = (($q[1] - $p[1]) * pi() / 180); | |
$a = sin($dLat / 2) * sin($dLat / 2) + | |
cos($p[0] * pi() / 180) * cos($q[0] * pi() / 180) * | |
sin($dLon / 2) * sin($dLon / 2); | |
$c = 2 * atan2(sqrt($a), sqrt(1 - $a)); | |
return $R * $c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach (scandir(_FOLDER) as $xmlFile) { | |
if (!is_dir(_FOLDER . $xmlFile)) { | |
$xml = simplexml_load_file(_FOLDER . $xmlFile); | |
$array = json_decode(json_encode($xml), true); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize | |
$context = Bitrix\Main\Context::getCurrent(); | |
$server = $context->getServer(); | |
$server_array = $server->toArray(); | |
// Скармливаем URL. Установить GET-параметры | |
$server_array['REQUEST_URI'] = $_SERVER['REQUEST_URI'] . $type . implode('&', $str); | |
$server->set($server_array); | |
$context->initialize(new Bitrix\Main\HttpRequest($server, array(), array(), array(), $_COOKIE), $context->getResponse(), $server); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match)) { | |
$video_id = $match[1]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_URI} ^/index$ [OR] | |
RewriteCond %{REQUEST_URI} ^/index[.]+(\w+)$ | |
RewriteRule . / [R=301,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo 'Document root: '.$_SERVER['DOCUMENT_ROOT'].'<br>'; | |
echo 'Полный путь к скрипту и его имя: '.$_SERVER['SCRIPT_FILENAME'].'<br>'; | |
echo 'Имя скрипта: '.$_SERVER['SCRIPT_NAME']; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- FAVICON --> | |
<link rel="icon" type="image/png" href="/favicon.png" /> | |
<!-- for apple main style--> | |
<!--link rel="apple-touch-icon" href="apple-touch-favicon.png"/--> | |
<!-- for apple precomposed--> | |
<link rel="apple-touch-icon-precomposed" href="/apple-touch-favicon.png"/> |
NewerOlder