Esempio n. 1
0
 private function _isValidRequest()
 {
     $isValid = false;
     if (isset($this->_username) && isset($this->_A)) {
         if (strlen($this->_A) == strlen($this->_srp->getNhex()) && isHex($this->_A)) {
             $isValid = true;
             if (isset($this->_M1)) {
                 if (strlen($this->_M1) == 40 && isHex($this->_M1)) {
                     // 40hex digits = 160bits
                     $isValid = true;
                 } else {
                     $isValid = false;
                 }
             }
         }
     }
     return $isValid;
 }
Esempio n. 2
0
*/
function isHex($string)
{
    return preg_match('/^#?+[0-9a-f]{3}(?:[0-9a-f]{3})?$/i', $string);
}
function hexToRgb($hex)
{
    $hex = ltrim(strtolower($hex), '#');
    $hex = isset($hex[3]) ? $hex : $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
    $dec = hexdec($hex);
    return array(0xff & $dec >> 0x10, 0xff & $dec >> 0x8, 0xff & $dec);
}
$size = isset($_GET['size']) ? str_replace('x', '', $_GET['size']) != '' ? $_GET['size'] : '80x20' : '80x20';
$back = isset($_GET['back']) ? isHex($_GET['back']) ? $_GET['back'] : 'ffffff' : 'ffffff';
$line = isset($_GET['line']) ? isHex($_GET['line']) ? $_GET['line'] : '1388db' : '1388db';
$fill = isset($_GET['fill']) ? isHex($_GET['fill']) ? $_GET['fill'] : 'e6f2fa' : 'e6f2fa';
$data = isset($_GET['data']) ? explode(',', $_GET['data']) : array();
list($w, $h) = explode('x', $size);
$w = floor(max(50, min(800, $w)));
$h = !strstr($size, 'x') ? $w : floor(max(20, min(800, $h)));
$t = 1.75;
$s = 4;
$w *= $s;
$h *= $s;
$t *= $s;
$salt = 'v1.0.0';
$hash = md5($salt . $_SERVER['QUERY_STRING']);
$data = count($data) < 2 ? array_fill(0, 2, $data[0]) : $data;
$count = count($data);
$step = $w / ($count - 1);
$max = max($data);