|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /home/queenjbs/jaejoong_X/conf/ |
Upload File : |
<?
//글자자르기 함수.
function utf8_cutstr($str,$len,$tail='') {
$str=strip_tags($str); //tag 없앰
$c = substr(str_pad(decbin(ord($str{$len})),8,'0',STR_PAD_LEFT),0,2);
if ($c == '10')
for (;$c != '11' && $c{0} == 1;$c = substr(str_pad(decbin(ord($str{--$len})),8,'0',STR_PAD_LEFT),0,2));
return substr($str,0,$len) . (strlen($str)-strlen($tail) >= $len ? $tail : '');
}
function Alert_back($msg) { // 메시지를 보이고 뒤로
echo "<script>alert('$msg');history.back()</script>";
exit;
}
function Alert_msg($msg) { // 메시지를 보인다.
echo "<script>alert('$msg');</script>";
// exit; <-- 중단 하지 않도록 한다.
}
function Alert_go($msg,$url) { // 메시지를 보이고 해당 url 로 이동
echo "<script>alert('$msg');location.href='$url';</script>";
exit;
}
function Opener_close($msg) { // 메시지를 보이고 자식창을 닫는다.
echo "<script>alert('$msg');opener.document.location.reload();self.close();</script>";
exit;
}
function Gogo($url,$sec=0) { // 해당 주소로 간다.
echo "<META http-equiv='refresh' content='$sec; url=$url'>";
exit;
}
function Opener_reload_close() { // 부모창 다시읽고 자식창을 닫는다.
echo "
<script>
opener.document.location.reload();
self.close();
</script>
";
exit;
}
function Confirm_go($msg,$url,$url2) { // 사용자의 동의를 받고 해당 url 로 이동
echo "
<script>
if ( confirm('$msg') ) {
location.href='$url';
} else {
location.href='$url2';
}
</script>";
exit;
}
function Parent_go($msg,$url) { // 사용자의 동의를 받고 해당 url 로 이동
echo "
<script>
alert('$msg');
parent.location.href='$url'
</script>";
exit;
}
//브라우져 버젼체크
function getBrowser()
{
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$bname = 'Unknown';
$platform = 'Unknown';
$version= "";
//First get the platform?
if (preg_match('/linux/i', $u_agent)) { $platform = 'linux'; }
elseif (preg_match('/macintosh|mac os x/i', $u_agent)) { $platform = 'mac'; }
elseif (preg_match('/windows|win32/i', $u_agent)) { $platform = 'windows'; }
// Next get the name of the useragent yes seperately and for good reason
if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent)) { $bname = 'Internet Explorer'; $ub = "MSIE"; }
elseif(preg_match('/Firefox/i',$u_agent)) { $bname = 'Mozilla Firefox'; $ub = "Firefox"; }
elseif(preg_match('/Chrome/i',$u_agent)) { $bname = 'Google Chrome'; $ub = "Chrome"; }
elseif(preg_match('/Safari/i',$u_agent)) { $bname = 'Apple Safari'; $ub = "Safari"; }
elseif(preg_match('/Opera/i',$u_agent)) { $bname = 'Opera'; $ub = "Opera"; }
elseif(preg_match('/Netscape/i',$u_agent)) { $bname = 'Netscape'; $ub = "Netscape"; }
// finally get the correct version number
$known = array('Version', $ub, 'other');
$pattern = '#(?<browser>' . join('|', $known) .
')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
if (!preg_match_all($pattern, $u_agent, $matches)) {
// we have no matching number just continue
}
// see how many we have
$i = count($matches['browser']);
if ($i != 1) {
//we will have two since we are not using 'other' argument yet
//see if version is before or after the name
if (strripos($u_agent,"Version") < strripos($u_agent,$ub)){ $version= $matches['version'][0]; }
else { $version= $matches['version'][1]; }
}
else { $version= $matches['version'][0]; }
// check if we have a number
if ($version==null || $version=="") {$version="?";}
return array('userAgent'=>$u_agent, 'name'=>$bname, 'version'=>$version, 'platform'=>$platform, 'pattern'=>$pattern);
}
//모바일 체크
function MobileCheck() {
global $HTTP_USER_AGENT;
$MobileArray = array("iphone","lgtelecom","skt","mobile","samsung","nokia","blackberry","android","android","sony","phone");
$checkCount = 0;
for($i=0; $i<sizeof($MobileArray); $i++){
if(preg_match("/$MobileArray[$i]/", strtolower($HTTP_USER_AGENT))){ $checkCount++; break; }
}
return ($checkCount >= 1) ? "Mobile" : "Computer";
}
?>