Title | The Love Codes (PHP) |
Permission | rw-r--r-- |
Author | fuxnbums |
Date and Time | 2:19 PM |
Category | PHP |
Share |
/**
* The PHP Love Codes
*
* @version 1.00
* @author Christian Ditaputratama
* Code is poetry, just for fun coding purpose. ;p
*
* based algorithm from DigitalDoener (Andreas W.) digitaldoener.de
* Compatibility: with any platform, you only need php.
*
* Usage :
* $my_love = new love('your name','your soulmate');
* echo $my_love->showLove();
*/
class love {
// change author name will make $admire won't work. =(
const AUTHOR = "DitatompeL";
private $admire = array(
// please do not change any value below T___T
'yKN38PLMvvt9qW3mTIKPCQ==', 'IwWOBr7jvOaiKUVmxWGoYA==',
'EQhqNNLvP7nFHFiSEabmIg==', 'oY7QcpqNzFA2B/M0GbDn+g==',
'W0XdFk51XGX5XJzPezm2yhm8X7LZsiutny1q/bsJnrJ//FPLzIpKYgrHvFryFCaI',
'W0XdFk51XGX5XJzPezm2yvrECQq9rAQbLjdzmcSXAdLqKtwIsKElhiax5TfA4d4z',
'BGMF9t0put0VK9zMvH4jndVjdL+V+rd08Q9PTRNqb1MDEc4yVVfJuxe2ekWUxTFk',
'ZS9IiyhqTtG+ICJF7Mpwo6DhFRmkx+FcdecLeYDGZd/gpjrBd6BYQJciEoPCEfPj'
);
protected $me = "";
protected $you = "";
private $whispers = array();
function __construct( $me=NULL, $you=NULL ) {
$this->couple = strtolower(preg_replace("/[^A-Za-z]+/", "", $me . $you));
if ( strlen( $this->couple ) <= 2 )
$this->bull("No one is known for this kind of object.");
else
$this->relationship($this->make_it_mean_something($this->couple));
}
public function make_it_mean_something($together) {
$initialMagic = count_chars($together);
for( $kiss=97; $kiss<=122; $kiss++ ) {
if( $initialMagic[$kiss] == TRUE ) {
$intensity = strlen($initialMagic[$kiss]);
if ( $intensity < 2 ) {
$kisses[] = $initialMagic[$kiss];
}
else
for( $hug=0; $hug<$intensity; $hug++ )
$kisses[] = substr($initialMagic[$kiss],$hug,1);
}
}
while ( ($hotnessFactor = count($kisses)) > 2 ) {
$continuousImprovement = ceil($hotnessFactor/2);
for( $change=0; $change<$continuousImprovement; $change++ ) {
$intimacy = array_shift($kisses) + array_shift($kisses);
$sex = strlen($intimacy);
if ( $sex < 2 )
$physicalTouch[] = $intimacy;
else
for( $touch=0; $touch<$sex; $touch++ )
$physicalTouch[] = substr($intimacy,$touch,1);
}
$progress = count($physicalTouch);
for($affection=0; $affection<$progress; $affection++)
$kisses[] = $physicalTouch[$affection];
array_splice($physicalTouch,0);
}
return !in_array($this->secret_love($this->couple), $this->admire) ? $kisses[0].$kisses[1] : 100;
}
private function bull($sh1t=NULL) {
if( !is_null($sh1t) )
$this->whispers[] = $sh1t;
return;
}
public function showLove() {
$newLine = php_sapi_name() == "cli" ? '\n' : '
';
return implode($newLine, $this->whispers);
}
public function relationship($score) {
$scoreWhisp = 'Score ' . $score;
if ( $score <= 30 )
$this->bull( $scoreWhisp . '. OMG! Go out and find someone else. lol');
elseif ( $score >= 31 && $score <= 60 )
$this->bull( $scoreWhisp . '. Not bad dude! Renew your spirit. Spend time in nature together.');
elseif ( $score >= 61 && $score <= 80 )
$this->bull( $scoreWhisp . '. Good! Keep your focus on what is right and good with your couple.');
elseif ( $score >= 81 && $score <= 99 )
$this->bull( $scoreWhisp . '. Great! Your relationship is suitable each another! Keep it up!');
else
$this->bull( $scoreWhisp . '. PERFECT relationship! Cute couple!');
}
private function secret_love($theHappyCouple=NULL) {
if( is_null($theHappyCouple) ){
$this->bull('Cannot encrypt your love relationship string =(');
return $theHappyCouple;
}
$V_size = mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_ECB);
$mrs_V = mcrypt_create_iv($V_size, MCRYPT_RAND);
$P_size = mcrypt_get_key_size(MCRYPT_CAST_256, MCRYPT_MODE_ECB);
$mr_P = substr(self::AUTHOR,0,$P_size);
return base64_encode(mcrypt_encrypt(MCRYPT_CAST_256, $mr_P, $theHappyCouple, MCRYPT_MODE_ECB, $mrs_V));
}
}
?>
* The PHP Love Codes
*
* @version 1.00
* @author Christian Ditaputratama
* Code is poetry, just for fun coding purpose. ;p
*
* based algorithm from DigitalDoener (Andreas W.) digitaldoener.de
* Compatibility: with any platform, you only need php.
*
* Usage :
* $my_love = new love('your name','your soulmate');
* echo $my_love->showLove();
*/
// change author name will make $admire won't work. =(
const AUTHOR = "DitatompeL";
private $admire = array(
// please do not change any value below T___T
'yKN38PLMvvt9qW3mTIKPCQ==', 'IwWOBr7jvOaiKUVmxWGoYA==',
'EQhqNNLvP7nFHFiSEabmIg==', 'oY7QcpqNzFA2B/M0GbDn+g==',
'W0XdFk51XGX5XJzPezm2yhm8X7LZsiutny1q/bsJnrJ//FPLzIpKYgrHvFryFCaI',
'W0XdFk51XGX5XJzPezm2yvrECQq9rAQbLjdzmcSXAdLqKtwIsKElhiax5TfA4d4z',
'BGMF9t0put0VK9zMvH4jndVjdL+V+rd08Q9PTRNqb1MDEc4yVVfJuxe2ekWUxTFk',
'ZS9IiyhqTtG+ICJF7Mpwo6DhFRmkx+FcdecLeYDGZd/gpjrBd6BYQJciEoPCEfPj'
);
protected $me = "";
protected $you = "";
private $whispers = array();
function __construct( $me=NULL, $you=NULL ) {
$this->couple = strtolower(preg_replace("/[^A-Za-z]+/", "", $me . $you));
if ( strlen( $this->couple ) <= 2 )
$this->bull("No one is known for this kind of object.");
else
$this->relationship($this->make_it_mean_something($this->couple));
}
public function make_it_mean_something($together) {
$initialMagic = count_chars($together);
for( $kiss=97; $kiss<=122; $kiss++ ) {
if( $initialMagic[$kiss] == TRUE ) {
$intensity = strlen($initialMagic[$kiss]);
if ( $intensity < 2 ) {
$kisses[] = $initialMagic[$kiss];
}
else
for( $hug=0; $hug<$intensity; $hug++ )
$kisses[] = substr($initialMagic[$kiss],$hug,1);
}
}
while ( ($hotnessFactor = count($kisses)) > 2 ) {
$continuousImprovement = ceil($hotnessFactor/2);
for( $change=0; $change<$continuousImprovement; $change++ ) {
$intimacy = array_shift($kisses) + array_shift($kisses);
$sex = strlen($intimacy);
if ( $sex < 2 )
$physicalTouch[] = $intimacy;
else
for( $touch=0; $touch<$sex; $touch++ )
$physicalTouch[] = substr($intimacy,$touch,1);
}
$progress = count($physicalTouch);
for($affection=0; $affection<$progress; $affection++)
$kisses[] = $physicalTouch[$affection];
array_splice($physicalTouch,0);
}
return !in_array($this->secret_love($this->couple), $this->admire) ? $kisses[0].$kisses[1] : 100;
}
private function bull($sh1t=NULL) {
if( !is_null($sh1t) )
$this->whispers[] = $sh1t;
return;
}
public function showLove() {
$newLine = php_sapi_name() == "cli" ? '\n' : '
';
return implode($newLine, $this->whispers);
}
public function relationship($score) {
$scoreWhisp = 'Score ' . $score;
if ( $score <= 30 )
$this->bull( $scoreWhisp . '. OMG! Go out and find someone else. lol');
elseif ( $score >= 31 && $score <= 60 )
$this->bull( $scoreWhisp . '. Not bad dude! Renew your spirit. Spend time in nature together.');
elseif ( $score >= 61 && $score <= 80 )
$this->bull( $scoreWhisp . '. Good! Keep your focus on what is right and good with your couple.');
elseif ( $score >= 81 && $score <= 99 )
$this->bull( $scoreWhisp . '. Great! Your relationship is suitable each another! Keep it up!');
else
$this->bull( $scoreWhisp . '. PERFECT relationship! Cute couple!');
}
private function secret_love($theHappyCouple=NULL) {
if( is_null($theHappyCouple) ){
$this->bull('Cannot encrypt your love relationship string =(');
return $theHappyCouple;
}
$V_size = mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_ECB);
$mrs_V = mcrypt_create_iv($V_size, MCRYPT_RAND);
$P_size = mcrypt_get_key_size(MCRYPT_CAST_256, MCRYPT_MODE_ECB);
$mr_P = substr(self::AUTHOR,0,$P_size);
return base64_encode(mcrypt_encrypt(MCRYPT_CAST_256, $mr_P, $theHappyCouple, MCRYPT_MODE_ECB, $mrs_V));
}
}
?>
ditatompel [at] devilzc0de . org