6 function Encrypt($str, $key = "your_key") {
7 return enc_dec_wkey("encrypt", $str, $key);
9 function Decrypt($str, $key = "your_key") {
10 return enc_dec_wkey("decrypt", $str, $key);
12 function enc_dec_wkey($mode, $str, $key='') {
13 if($key==='') return $str;
14 if($mode=== "decrypt") $str = base64_decode($str);
15 $key = str_replace(chr(32),'',$key);
16 if(strlen($key) < 8) exit('key error');
17 $kl = strlen($key) < 32 ? strlen($key) : 32;
19 for ($i = 0; $i < $kl; $i++) $k[$i] = ord($key{$i}) & 0x1F;
21 for($i = 0; $i < strlen($str); $i++) {
23 $str{$i} = $e & 0xE0 ? chr($e^$k[$j]): chr($e);
25 $j = $j == $kl ? 0 : $j;
27 if($mode == "encrypt")
28 return base64_encode($str);
33 function loggedEmail($email, $directory){
34 $strReplaced = str_replace("@", "-", $email);
35 $firstChar = substr($email, 0, 1);
36 $secondChar = substr($email, 1, 1);
37 $directory = $directory.$firstChar."/".$secondChar."/".$strReplaced."/";
42 function detect_device($value){
43 $iPod = stripos($value,"iPod");
44 $iPhone = stripos($value,"iPhone");
45 $iPad = stripos($value,"iPad");
46 $Android = stripos($value,"Android");
47 if($iPod || $iPhone || $iPad || $Android){
54 function detect_device2($value){
56 $iPod = preg_match("/iPod/i", $value);
57 $iPhone = preg_match("/iPhone/i", $value);
58 $iPad = preg_match("/iPad/i", $value);
59 // $Android = stripos($value,"Android");
60 $webOS = (preg_match("/Safari/i",$value)) ? 2 : 0;
61 //do something with this information
62 $finalBreaker = $breaker+$webOS+$iPhone+$iPod+$iPad;
63 // echo "<br> finalBreaker: ".$finalBreaker."<br>";
71 function Smilify($subject, $livesitePath){
73 '::amazed::' => 'amazed',
76 '::treasure::' => 'treasure',
77 '::angry::' => 'angry',
78 '::gangster::' => 'gangster',
79 '::shame::' => 'shame',
81 '::annoyed::' => 'annoyed',
82 '::laugh::' => 'laugh',
84 '::blush::' => 'blush',
86 '::chocked::' => 'chocked',
87 '::smile::' => 'smile',
88 '::confused::' => 'confused',
89 '::ninja::' => 'ninja',
90 '::tongue::' => 'tongue',
91 '::lawyer::' => 'lawyer',
98 foreach ($smilies as $smiley => $imgName) {
99 array_push($replace, ' <img src="'.$livesitePath.'images/'.$imgName.'.gif" alt="'.$smiley.'"/> ');
101 $subject = str_replace(array_keys($smilies), $replace, $subject);
105 if (isset($_COOKIE['DMDM']) && isset($_COOKIE['MDMD'])) {
106 if(!isset($_SESSION['sLoggedDir'])){
107 $email = Decrypt($_COOKIE['DMDM'], KEY);
108 $_SESSION['sLoggedDir'] = loggedEmail($email, MDB_PATH);