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 create_csrf_field() | |
{ | |
$field_hash = hash('sha256', time().'some_salt'); | |
$hash = hash('sha256', 'some_salt'.time().rand(0,10)); | |
$_SESSION['csrf_field'] = $field_hash; | |
$_SESSION['csrf_hash'] = $hash; | |
return '<input type="hidden" name="'.$field_hash.'" value="'.$hash.'">'; | |
} |
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 | |
$url = 'http://server.com/path'; | |
$data = array('key1' => 'value1', 'key2' => 'value2'); | |
// use key 'http' even if you send the request to https://... | |
$options = array( | |
'http' => array( | |
'header' => "Content-type: application/x-www-form-urlencoded\r\n", | |
'method' => 'POST', | |
'content' => http_build_query($data), |
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
@echo off | |
echo Administrative permissions required. Detecting permissions... | |
net session >nul 2>&1 | |
if %errorLevel% == 0 ( | |
echo Success: Administrative permissions confirmed. | |
) else ( | |
echo Failure: No administrative permissions. | |
exit /B |