Initial commit
[2ch-be.git] / encrypt_artist.php
blobe239eb33ba98a2c7c24bd8ed2b8ee5d8618b3e20
1 <?php
2 session_start();
3 date_default_timezone_set("Asia/Tokyo");
5 function Encrypt($str, $key = "your_key") {
6 return enc_dec_wkey("encrypt", $str, $key);
8 function Decrypt($str, $key = "your_key") {
9 return enc_dec_wkey("decrypt", $str, $key);
11 function enc_dec_wkey($mode, $str, $key='') {
12 if($key==='') return $str;
13 if($mode=== "decrypt") $str = base64_decode($str);
14 $key = str_replace(chr(32),'',$key);
15 if(strlen($key) < 8) exit('key error');
16 $kl = strlen($key) < 32 ? strlen($key) : 32;
17 $k = array();
18 for ($i = 0; $i < $kl; $i++) $k[$i] = ord($key{$i}) & 0x1F;
19 $j = 0;
20 for($i = 0; $i < strlen($str); $i++) {
21 $e = ord($str{$i});
22 $str{$i} = $e & 0xE0 ? chr($e^$k[$j]): chr($e);
23 $j++;
24 $j = $j == $kl ? 0 : $j;
26 if($mode == "encrypt")
27 return base64_encode($str);
28 else
29 return $str;
32 function within_str($subject, $lsearch, $rsearch) {
33 $data = strstr($subject, $lsearch);
34 $data = str_replace($lsearch, "", $data);
35 $trim = strstr($data, $rsearch);
37 return(str_replace($trim, "", $data));
40 function loggedEmail($email, $directory){
41 $strReplaced = $email;
42 $firstChar = substr($email, 0, 1);
43 $secondChar = substr($email, 1, 1);
44 $directory = $directory.$firstChar."/".$secondChar."/".$strReplaced."/";
45 return $directory;
48 function detect_device2($value){
49 $breaker = 2;
50 $iPod = preg_match("/iPod/i", $value);
51 $iPhone = preg_match("/iPhone/i", $value);
52 $iPad = preg_match("/iPad/i", $value);
53 // $Android = stripos($value,"Android");
54 $webOS = (preg_match("/Safari/i",$value)) ? 2 : 0;
55 //do something with this information
56 $finalBreaker = $breaker+$webOS+$iPhone+$iPod+$iPad;
57 $value = array(3);
58 if($finalBreaker==3){
59 return "DONTDISPLAY";
60 }else{
61 return "PLSDISPLAY";
65 $livesitePath = "http" . (isset($_SERVER['HTTPS']) ? 's' : '')."://".$_SERVER['HTTP_HOST']."/";
66 $livesitePath2 = "http" . (isset($_SERVER['HTTPS']) ? 's' : '')."://".$_SERVER['HTTP_HOST'];
67 define('AKEY', "KungAnoAnoLang123456789");
68 define('ADB_PATH', "/home/adb/");
69 define('AFORGOT', "0._{_forgot_}_.0");