웹마스터 팁

<?

ini_set("allow_url_fopen","1"); // 서버 설정에 따라 file() 함수의 사용이 가능하도록... [라인추가]

$throttle = "http://홈주소/throttle-me/";

$file = file($throttle); // 소스를 읽고,

$traffic = sprintf("%0.2fMB",strip_tags($file[43]) / 1024); // 44번 라인을 읽어서 태그를 없애고 MB단위로...배열은 0부터 44-1 = 43
$limit = sprintf("%0.1fMB",strip_tags(eregi_replace("M", "",$file[47]))); // 48번 라인을 읽어서 태그를 없애고 GB단위로...

// 현재트래픽/일일허용트래픽 의 형식으로 나타내자.... ex) 34.85MB/1GB
echo "<p style='background-color: white; border: 1px solid #eee; padding: 10px 0 10px 14px; margin-top: 5px; line-height: 17px; border: 1px solid #eee; text-align: left; font-size: 8pt; color: #777;'>";
echo " 현재 트래픽 : $traffic/$limit</a>";

?>

아래는 적용모습입니다(참고로 저는 파란 비즈프리 웹호스팅 사용중입니다)

1.jpg