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
Материалы для поднятия макета по вопросу | |
https://ru.stackoverflow.com/questions/1081169/sql-инъекция-формы-на-сайте/ | |
Создаём папку с проектом, и файлами в ней: | |
so | |
-nginx | |
--default.conf | |
-php | |
--Dockerfile |
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 | |
if (isset($_SESSION['id'])) { | |
header('Location: ../'); | |
exit(); | |
} | |
$message = ''; | |
if (isset($_GET['data']) && isset($_GET['a'])) { | |
$id = check($_GET['a'], "int"); |
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
package main | |
import ( | |
"image/png" | |
"os" | |
"fmt" | |
"time" | |
"net/http" | |
"log" | |
"io" |
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 | |
class ImgCompare | |
{ | |
/** @var string $bigSrc */ | |
protected $bigSrc; | |
/** @var array $haystack */ | |
protected $haystack = []; | |
/** @var array $needle */ |
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 | |
$str = trim(file_get_contents(__DIR__.'/tetris.min.js')); | |
$str = str_replace('"', "'", $str); | |
// $str = str_replace('function', '', $str); | |
$origLen = strlen($str); | |
echo "orig len: {$origLen}\n"; | |
$dictionary = str_split( |
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 | |
//$request = "CONNECT foo HTTP/1.1 | |
//bar | |
//Host: foo1 | |
// | |
//"; | |
//$pattern = '/(?P<url>(GET|PUT|DELETE|POST|CONNECT)\s+[^\s]+)\s+HTTP\/[0-9.]+.+?Host:\s+(?P<host>[^:\s]+)(:(?P<port>\d+))?\s+/s'; | |
//if (preg_match($pattern, $request, $matches) === 1) { | |
// var_dump($matches); |
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 | |
$size = 'big'; | |
$cut = __DIR__ . "/{$size}/2.png"; | |
list($cutWidth, $cutHeight) = getimagesize($cut); | |
$cutImg = imagecreatefrompng($cut); | |
$cutColorList = []; | |
for ($y = 0; $y < $cutHeight; $y++) { | |
for ($x = 0; $x < $cutWidth; $x++) { | |
$color = imagecolorat($cutImg, $x, $y); |
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 | |
// http://unicode.org/emoji/charts-beta/full-emoji-list.html | |
$src = __DIR__ . "/emoji.html"; | |
$dest = __DIR__ . "/emoji+.html"; | |
$f = fopen($dest, "w"); | |
fwrite($f, "<html><head></head><body><table>"); | |
fwrite($f, "<tr> | |
<th>#</th> |
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 | |
/* | |
* Есть n камней. 0 < n < 21. Их вес колеблется от 1 до 100 000. | |
* Нужно разложить их в две сумки, что бы разница веса между сумками была минимальная. | |
*/ | |
$rocksCount = 20; | |
$rocks = []; | |
for ($i = 0; $i < $rocksCount; $i++) { |
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
/** | |
* Алгоритм Нарайаны | |
* https://ru.wikipedia.org/wiki/%D0%90%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC_%D0%9D%D0%B0%D1%80%D0%B0%D0%B9%D0%B0%D0%BD%D1%8B | |
* @param array $arr | |
* @return array | |
*/ | |
function getNext(array $arr) | |
{ | |
// step 1 | |
// [4,4,6,5] -> j=1 (4 > 6) |
NewerOlder