PHP
11
Вклад в тег
server {
listen 80;
server_name example.com www.example.com;
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:5000;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
server {
listen 80;
server_name example.com;
# Logs
access_log /var/log/nginx/access.log;
}
cat access.log | cut -d '"' -f3 | cut -d ' ' -f2 | sort | uniq -c | sort -rn
awk '{print $9}' access.log | sort | uniq -c | sort -rn
awk -F\" '{print $2}' access.log | awk '{print $2}' | sort | uniq -c | sort -r
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "/ajax.php",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"foo\"\r\n\r\nbar\r\n-----011000010111000001101001--\r\n",
CURLOPT_HTTPHEADER => array(
"content-type: multipart/form-data; boundary=---011000010111000001101001"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->addForm(array(
'foo' => 'bar'
), NULL);
$request->setRequestUrl('/ajax.php');
$request->setRequestMethod('POST');
$request->setBody($body);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
<?php
// Задаем пароль
$password = "iddqd";
// Берем ссылку для редиректа из ?url=*
$link = array_key_exists("url", $_GET) ? $_GET['url'] : "http://google.com";
// Проверяем сабмит формы с паролем
if (array_key_exists("password", $_POST)) {
// Проверяем введенный пароль
if (strcasecmp($_POST['password'], $password) == 0) {
// Пароль совпал, редиректим
header("Location: {$link}");
}else{
// Пароли не совпали показываем ошибку
require_once 'error.php';
}
}else{
// Показываем форму для ввода пароля
require_once 'form.php';
}
?>