Ejemplo n.º 1
0
function ip2area($ip, $type = '')
{
    $area = '';
    if (is_ip($ip)) {
        $tmp = explode('.', $ip);
        if ($tmp[0] == 10 || $tmp[0] == 127 || $tmp[0] == 192 && $tmp[1] == 168 || $tmp[0] == 172 && ($tmp[1] >= 16 && $tmp[1] <= 31)) {
            $area = 'LAN';
        } elseif ($tmp[0] > 255 || $tmp[1] > 255 || $tmp[2] > 255 || $tmp[3] > 255) {
            $area = 'Unknown';
        } else {
            require_once DT_ROOT . '/include/ip.class.php';
            $do = new ip($ip, $type);
            $area = $do->area();
        }
    }
    return $area ? $area : 'Unknown';
}
    </div>
    <div id="login-bottom"> <a href="http://127.0.0.1/hdjob/index.php/index/profile/createNewRes"><em class="fn-hide">写简历</em></a><a href="http://127.0.0.1/hdjob/index.php/register.html"><em class="fn-hide">注册</em></a> </div>
</div>
<!--right-->
<div id="banner-right"> 
    <!--city-list-->
    <div id="city-list" style="position:relative;" class="fn-clear"> <span>城市频道</span>
        <ul>
            <?php 
$db = M('city');
$citys = $db->cache(86400)->field('name,pinyin')->where('is_open=1')->limit(15)->findall();
if (is_array($citys)) {
    foreach ($citys as $city) {
        ?>
            <li <?php 
        if (strpos(ip::area(), $city['name']) !== false) {
            ?>
class="city-active"<?php 
        }
        ?>
><a href="http://127.0.0.1/hdjob/index.php/<?php 
        echo $city['pinyin'];
        ?>
"><?php 
        echo $city['name'];
        ?>
</a></li>
            <?php 
    }
}
?>