diff --git a/include/common.php b/include/common.php index 3c41e9d..5b37060 100644 --- a/include/common.php +++ b/include/common.php @@ -1,6 +1,11 @@ diff --git a/include/footer.php b/include/footer.php index c3b1624..611e5ae 100644 --- a/include/footer.php +++ b/include/footer.php @@ -2,90 +2,134 @@ 作者: D.Young Github:https://github.com/5iux/5iux.github.io 二开: LyLme Github:https://github.com/lylme/lylme_spage --> - - + - + + + + + + + \ No newline at end of file diff --git a/include/function.php b/include/function.php new file mode 100644 index 0000000..55363f8 --- /dev/null +++ b/include/function.php @@ -0,0 +1,294 @@ +att = array(); + if($mail->send($to , $From , $sub , $msg, $Nickname)) { + return true; + } else { + return $mail->log; + } +} +function daddslashes($string, $force = 0, $strip = FALSE) { + !defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc()); + if(!MAGIC_QUOTES_GPC || $force) { + if(is_array($string)) { + foreach($string as $key => $val) { + $string[$key] = daddslashes($val, $force, $strip); + } + } else { + $string = addslashes($strip ? stripslashes($string) : $string); + } + } + return $string; +} + +function strexists($string, $find) { + return !(strpos($string, $find) === FALSE); +} + +function dstrpos($string, $arr) { + if(empty($string)) return false; + foreach((array)$arr as $v) { + if(strpos($string, $v) !== false) { + return true; + } + } + return false; +} + +function checkmobile() { + $useragent = strtolower($_SERVER['HTTP_USER_AGENT']); + $ualist = array('android', 'midp', 'nokia', 'mobile', 'iphone', 'ipod', 'blackberry', 'windows phone'); + if((dstrpos($useragent, $ualist) || strexists($_SERVER['HTTP_ACCEPT'], "VND.WAP") || strexists($_SERVER['HTTP_VIA'],"wap"))){ + return true; + }else{ + return false; + } +} + +function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) { + $ckey_length = 4; + $key = md5($key ? $key : ENCRYPT_KEY); + $keya = md5(substr($key, 0, 16)); + $keyb = md5(substr($key, 16, 16)); + $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : ''; + $cryptkey = $keya.md5($keya.$keyc); + $key_length = strlen($cryptkey); + $string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string; + $string_length = strlen($string); + $result = ''; + $box = range(0, 255); + $rndkey = array(); + for($i = 0; $i <= 255; $i++) { + $rndkey[$i] = ord($cryptkey[$i % $key_length]); + } + for($j = $i = 0; $i < 256; $i++) { + $j = ($j + $box[$i] + $rndkey[$i]) % 256; + $tmp = $box[$i]; + $box[$i] = $box[$j]; + $box[$j] = $tmp; + } + for($a = $j = $i = 0; $i < $string_length; $i++) { + $a = ($a + 1) % 256; + $j = ($j + $box[$a]) % 256; + $tmp = $box[$a]; + $box[$a] = $box[$j]; + $box[$j] = $tmp; + $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256])); + } + if($operation == 'DECODE') { + if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) { + return substr($result, 26); + } else { + return ''; + } + } else { + return $keyc.str_replace('=', '', base64_encode($result)); + } +} + +function random($length, $numeric = 0) { + $seed = base_convert(md5(microtime().$_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35); + $seed = $numeric ? (str_replace('0', '', $seed).'012340567890') : ($seed.'zZ'.strtoupper($seed)); + $hash = ''; + $max = strlen($seed) - 1; + for($i = 0; $i < $length; $i++) { + $hash .= $seed{mt_rand(0, $max)}; + } + return $hash; +} +function getSetting($k, $force = false){ + global $DB,$CACHE; + if($force) return $setting[$k] = $DB->get_row("SELECT v FROM web_config WHERE k='$k' limit 1"); + $cache = $CACHE->get($k); + return $cache[$k]; +} + +function saveSetting($k, $v){ + $v = daddslashes($v); + return mysqli_query($GLOBALS['con'],"UPDATE `lylme_config` SET `v` = '$v' WHERE `lylme_config`.`k` = '$k';"); +} + +function showmsg($content = '未知的异常',$type = 4,$back = false) +{ +switch($type) +{ +case 1: + $panel="success"; +break; +case 2: + $panel="info"; +break; +case 3: + $panel="warning"; +break; +case 4: + $panel="danger"; +break; +} + +echo '
+
+

提示信息

+
+
'; +echo $content; + +if ($back) { + echo '
<< 返回上一页'; +} +else + echo '
<< 返回上一页'; + +echo '
+
'; +exit; +} +function sysmsg($msg = '未知的异常',$die = true) { + ?> + + + + + + 站点提示信息 + + + + 站点提示信息'; + echo $msg; ?> + + + \ No newline at end of file diff --git a/include/head.php b/include/head.php index 05fb999..a87787f 100644 --- a/include/head.php +++ b/include/head.php @@ -2,12 +2,12 @@ - + - 上网导航 - LyLme Spage - - - + <?php echo $conf['title']?> + + + @@ -22,34 +22,5 @@ - + \ No newline at end of file diff --git a/include/member.php b/include/member.php new file mode 100644 index 0000000..2688ae2 --- /dev/null +++ b/include/member.php @@ -0,0 +1,12 @@ + \ No newline at end of file