Update functions.inc.php
This commit is contained in:
@@ -250,6 +250,11 @@ function ec_verify($data, $signature, $key)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// verify the validity of an url
|
||||||
|
function isValidURL($url)
|
||||||
|
{
|
||||||
|
return preg_match('|^(ht)?(f)?tp(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url);
|
||||||
|
}
|
||||||
|
|
||||||
// POST data to an URL (usualy peer). The data is an array, json encoded with is sent as $_POST['data']
|
// POST data to an URL (usualy peer). The data is an array, json encoded with is sent as $_POST['data']
|
||||||
function peer_post($url, $data = [], $timeout = 60, $debug = false)
|
function peer_post($url, $data = [], $timeout = 60, $debug = false)
|
||||||
@@ -258,6 +263,9 @@ function peer_post($url, $data = [], $timeout = 60, $debug = false)
|
|||||||
if ($debug) {
|
if ($debug) {
|
||||||
echo "\nPeer post: $url\n";
|
echo "\nPeer post: $url\n";
|
||||||
}
|
}
|
||||||
|
if (!isValidURL($url)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$postdata = http_build_query(
|
$postdata = http_build_query(
|
||||||
[
|
[
|
||||||
'data' => json_encode($data),
|
'data' => json_encode($data),
|
||||||
|
|||||||
Reference in New Issue
Block a user