Skip to content

Instantly share code, notes, and snippets.

View DrARoberts's full-sized avatar
🏠
Working from home

Dr. Simon Antony Roberts DrARoberts

🏠
Working from home
View GitHub Profile
@DrARoberts
DrARoberts / gist:d1d044ed99dec060fe3758862119884a
Created February 9, 2018 22:39
Correct Implementation of PHP cURL for also sending field type $_FILES
if (!function_exists("getURIData")) {
/* function yonkURIData()
*
* Get a supporting domain system for the API
* @author Simon Roberts (Chronolabs) simon@labs.coop
*
* @return float()
*/
function getURIData($uri = '', $timeout = 25, $connectout = 25, $post = array(), $headers = array())
@DrARoberts
DrARoberts / getINForProtectedNumber
Last active May 10, 2018 02:39
Simple Decryption Protector for Number Systems for MySQL Queries
/**
* getINForProtectedNumber()
*
* Protects an Number System with an alpha numeric stripper by replace the number of characters to be $protect and replaced
* with an alpha character from the english characters in capitals for IP Address, Phone Numbers, Addresses!
*
* Result for function is used in the following for matching store numbers in a mysql database
*
* $sql = "SELECT * FROM `cards` WHERE `number` IN ('" . implode("', '", $results['in']) . "')";
@DrARoberts
DrARoberts / protectNumbersStripper.txt
Last active May 10, 2018 02:39
Simple Encryption Protector for Number Systems
/**
* protectNumbersStripper()
*
* Protects an Number System with an alpha numeric stripper by replace the number of characters to be $protect and replaced
* with an alpha character from the english characters in capitals for IP Address, Phone Numbers, Addresses!
*
* @param string $number the number string being protected
* @param integer $protect the number of character to replace 1 - 9
* @param integer $attempted the number of random stab attempt to do replacement
* @return string
@DrARoberts
DrARoberts / function getURIData(...)
Last active May 10, 2018 02:39
cURL + PHP cURL perfect routine call for even population of $_FILES on URI Called/Polled
if (!function_exists("getURIData")) {
/* function getURIData()
*
* Get a supporting domain system for the API
* @author Simon Roberts (Chronolabs) simon@labs.coop
*
* @return float()
*/
function getURIData($uri = '', $timeout = 25, $connectout = 25, $post = array(), $headers = array())
$odds = $inner = array();
foreach($_GET as $key => $values) {
if (!isset($inner[$key])) {
$inner[$key] = $values;
} elseif (!in_array(!is_array($values)?$values:md5(json_encode($values, true)), array_keys($odds[$key]))) {
if (is_array($values)) {
$odds[$key][md5(json_encode($inner[$key] = $values, true))] = $values;
} else {
$odds[$key][$inner[$key] = $values] = "$values--$key";
}