• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ip函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ip函数的典型用法代码示例。如果您正苦于以下问题:PHP ip函数的具体用法?PHP ip怎么用?PHP ip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ip函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: avatar

 public function avatar()
 {
     if ($_POST['dosubmit']) {
         $_POST['id'] = $this->_userid;
         if (!$this->dao->create($_POST)) {
             $this->error($this->dao->getError());
         }
         $this->dao->update_time = time();
         $this->dao->last_ip = ip();
         $result = $this->dao->save();
         if (false !== $result) {
             if ($_POST['aid']) {
                 foreach ($_POST['aid'] as $r) {
                     $aids[] = intval($r);
                 }
                 $Attachment = M('Attachment');
                 $aids = implode(',', $aids);
                 $data['userid'] = $this->_userid;
                 $data['catid'] = 0;
                 $data['status'] = '1';
                 $Attachment->where("aid in (" . $aids . ")")->save($data);
             }
             $this->success(L('do_success'));
         } else {
             $this->error(L('do_error'));
         }
         exit;
     }
     $yourphp_auth_key = sysmd5(C('ADMIN_ACCESS') . $_SERVER['HTTP_USER_AGENT']);
     $yourphp_auth = authcode('0-1-0-1-jpeg,jpg,png,gif-0.2-0', 'ENCODE', $yourphp_auth_key);
     $this->assign('yourphp_auth', $yourphp_auth);
     $this->display();
 }
开发者ID:bossyuetao,项目名称:yuephp,代码行数:33,代码来源:IndexAction.class.php


示例2: check_ip

 /**
  * 
  * IP禁止判断接口,供外部调用 ...
  */
 public function check_ip()
 {
     $ip_array = array();
     //当前IP
     $ip = ip();
     //加载IP禁止缓存
     $ipbanned_cache = getcache('ipbanned', 'commons');
     if (!empty($ipbanned_cache)) {
         foreach ($ipbanned_cache as $data) {
             $ip_array[$data['ip']] = $data['ip'];
             //是否是IP段
             if (strpos($data['ip'], '*')) {
                 $ip_min = $this->convert_ip("min", $data['ip']);
                 $ip_max = $this->convert_ip("max", $data['ip']);
                 $result = $this->ipforbidden($ip, $ip_min, $ip_max);
                 if ($result == 0 && $data['expires'] > SYS_TIME) {
                     //被封
                     showmessage('你在IP禁止段内,所以禁止你访问');
                 }
             } else {
                 //不是IP段,用绝对匹配
                 if ($ip == $data['ip'] && $data['expires'] > SYS_TIME) {
                     showmessage('IP地址绝对匹配,禁止你访问');
                 }
             }
         }
     }
 }
开发者ID:ahmatjan,项目名称:huluphp,代码行数:32,代码来源:ipbanned_model.class.php


示例3: info

function info($data, $top)
{
    global $protocols;
    echo ' ', ip($data, 12), ' > ', ip($data, 16), ' protocol=';
    if (!isset($protocols[$data[9]])) {
        echo 'unknown(', $data[9], ')';
        return;
    }
    echo $protocols[$data[9]];
    if ($data[9] == 1) {
        // ICMP
        info_icmp(array_slice($data, 20));
        if ($data[9] == 1 && $data[20] == 3) {
            // ICMP Destination Unreachable
            echo "\n\tdata: ";
            // Print into on the contained packet
            info(array_slice($data, 28), false);
        }
    } else {
        if ($data[9] == 6) {
            // TCP
            info_tcp(array_slice($data, 20));
        } else {
            if ($data[9] == 17) {
                // UDP
                info_udp(array_slice($data, 20));
            }
        }
    }
}
开发者ID:dinamic,项目名称:php-net-tools,代码行数:30,代码来源:icmpdump.php


示例4: checklogin

 public function checklogin()
 {
     $seccode = md5($_POST['seccode']);
     if ($_SESSION['verify'] !== $seccode) {
         $this->error(L('VERIFYERROR'), 'index');
     }
     $username = $_POST['username'];
     $pwd = md5($_POST['password']);
     $DB = M('admin');
     $list = $DB->where("user='" . $username . "'")->find();
     if ($list) {
         if ($pwd != $list['pwd']) {
             $this->error(L('LogError'), 'index');
         }
         $_SESSION['USER'] = $username;
         $_SESSION['STATUS'] = true;
         $_SESSION['LANGID'] = 1;
         $logtime = time();
         $logip = ip();
         $data = array('logtime' => $logtime, 'logip' => $logip);
         $DB->where(array('id' => $list['id']))->save($data);
         $this->redirect('Index/index');
     } else {
         $this->error(L('LogError'), 'index');
     }
 }
开发者ID:rust1989,项目名称:cms,代码行数:26,代码来源:LoginAction.class.php


示例5: gravalog

function gravalog($numero, $texto, $pagina = null, $linha = null, $contexto = null)
{
    $ddf = fopen(DIR_LOGS . "/" . date('Y.M.d') . ".log", 'a');
    if ($ddf) {
        $datalog = date('d.m.Y H:i:s');
        $txt = "::[" . $datalog . "]--|" . ip() . "|----------------------\n";
        $txt .= "(" . $numero . ") " . $texto . "\n";
        if (!is_null($pagina)) {
            $txt .= "Pagina: " . $pagina . "\n";
        }
        if (!is_null($linha)) {
            $txt .= "Linha: " . $linha . "\n";
        }
        $txt .= "\n";
        if (PROFILER) {
            if (class_exists("Console")) {
                $e = new ErrorException($texto, 0, $numero, $pagina, $linha);
                Console::logError($e, $texto);
            }
        }
        if (fwrite($ddf, $txt)) {
            return true;
            if (DEBUG) {
                alert('Arquivo gravado com sucesso', false);
            }
        }
    } else {
        if (DEBUG) {
            alert('Erro ao gravar arquivo', false);
        }
    }
    fclose($ddf);
}
开发者ID:patrix,项目名称:oraculum,代码行数:33,代码来源:logs.php


示例6: post

 function post($nickname, $message)
 {
     global $prefs;
     if ($this->banned(ip())) {
         return false;
     }
     if (!$this->validate($message, $prefs['messageLength'])) {
         return false;
     }
     if (!$this->validate($nickname, $prefs['nicknameLength'])) {
         return false;
     }
     $message = trim(clean($message));
     $nickname = trim(clean($nickname));
     if ($message == '') {
         return false;
     }
     if ($nickname == '') {
         return false;
     }
     $timestamp = ts();
     $message = $this->censor($message);
     $nickname = $this->censor($nickname);
     $post = array('nickname' => $nickname, 'message' => $message, 'timestamp' => $timestamp, 'admin' => $this->admin, 'uid' => md5($timestamp . ' ' . $nickname), 'adminInfo' => array('ip' => ip()));
     $s = $this->storage->open(true);
     $s['posts'][] = $post;
     if (sizeof($s['posts']) > $prefs['history']) {
         $this->truncate($s['posts']);
     }
     $s['info']['latestTimestamp'] = $post['timestamp'];
     $this->storage->close($s);
     $this->postProcess($post);
     return $post;
 }
开发者ID:ericmuyser,项目名称:bndb,代码行数:34,代码来源:yshout.class.php


示例7: save_data

 /**
  * 信息保存到附件表的数据组装
  */
 public function save_data()
 {
     if (empty($this->res_data)) {
         return false;
     }
     /*图片信息保存到数据*/
     $pic_data['realname'] = $this->res_data['client_name'];
     $pic_data['filename'] = $this->res_data['file_name'];
     $pic_data['fileext'] = $this->res_data['file_ext'];
     $base_path = str_replace('\\', '/', FCPATH);
     $pic_data['filepath'] = str_replace($base_path, '', $this->res_data['full_path']);
     $pic_data['filesize'] = $this->res_data['file_size'];
     $pic_data['img_spec'] = $this->res_data['image_width'] . 'x' . $this->res_data['image_height'];
     $pic_data['shop_id'] = $this->shop_id;
     $pic_data['aclass_id'] = $this->class_id;
     $pic_data['isadmin'] = $this->isadmin;
     $pic_data['upload_ip'] = ip();
     $pic_data['upload_time'] = time();
     $pic_data['sts'] = $this->sts;
     if (!isset($this->CI)) {
         $this->CI =& get_instance();
     }
     $this->CI->load->model('m_uploadfile_model');
     $id = $this->CI->m_uploadfile_model->save_uploadfile($pic_data);
     return $id;
 }
开发者ID:zydj333,项目名称:hualiangcaifu,代码行数:29,代码来源:iupload_lib.php


示例8: gravalog

function gravalog($numero, $texto, $pagina = null, $linha = null, $contexto = null)
{
    $ddf = fopen(DIR_LOGS . date('Y.M.d') . ".log", 'a');
    if ($ddf) {
        $datalog = date('d.m.Y H:i:s');
        $txt = "::[" . $datalog . "]--|" . ip() . "|----------------------\n";
        $txt .= "(" . $numero . ") " . $texto . "\n";
        if (!is_null($pagina)) {
            $txt .= "Pagina: " . $pagina . "\n";
        }
        if (!is_null($linha)) {
            $txt .= "Linha: " . $linha . "\n";
        }
        $txt .= "\n";
        if (fwrite($ddf, $txt)) {
            return true;
            if (DEBUG) {
                alert('Arquivo gravado com sucesso', false);
            }
        }
    } else {
        if (DEBUG) {
            alert('Erro ao gravar arquivo', false);
        }
    }
    fclose($ddf);
}
开发者ID:RivaldoGuimaraes,项目名称:kap-learning,代码行数:27,代码来源:logs.php


示例9: login

 /**
  * 登录
  * @param $username
  * @param $password
  * @param $checkcode
  * @return array
  */
 public function login($username, $password, $checkcode)
 {
     $msg = array('status' => false, 'msg' => '请认真输入');
     if (!isset($_SESSION['code']) || strtolower($checkcode) != $_SESSION['code']) {
         $msg['status'] = false;
         $msg['msg'] = '验证码错误';
         unset($_SESSION['code']);
         return $msg;
     }
     $user = $this->where('username', $this->addslashes($username))->select()->query();
     if (!empty($user)) {
         if (md5($password . $user[0]['encrypt']) != $user[0]['password']) {
             $msg['status'] = false;
             $msg['msg'] = '密码错误';
         } else {
             $msg['status'] = true;
             $_SESSION['adminuser'] = $user[0]['username'];
             $_SESSION['loginKey'] = $this->loginkey($user[0]['username'], $user[0]['password']);
             $update = array('lastloginip' => ip(), 'lastlogintime' => time());
             $this->where('username', $this->addslashes($username))->update($update);
         }
         unset($_SESSION['code']);
         return $msg;
     } else {
         $msg = array('status' => false, 'msg' => '用户名错误');
         unset($_SESSION['code']);
         return $msg;
     }
 }
开发者ID:pgfeng,项目名称:ssy.9icode.club,代码行数:36,代码来源:adminModel.php


示例10: validate_ip

function validate_ip($ip)
{
    if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false) {
        return false;
    }
    self::$ip = $ip;
    return true;
}
开发者ID:pasindujw,项目名称:CSEgrades,代码行数:8,代码来源:ipDetect.php


示例11: write

 public function write($sessID, $sessData = '')
 {
     $ip = ip();
     $username = cookie('username') ? cookie('username') : '';
     $groupid = cookie('groupid') ? intval(cookie('groupid')) : 4;
     $sessiondata = array('sessionid' => $sessID, 'userid' => intval(cookie('userid')), 'username' => $username, 'ip' => $ip, 'lastvisit' => time(), 'groupid' => $groupid, 'data' => '');
     return $this->dao->add($sessiondata, '', true);
 }
开发者ID:bossyuetao,项目名称:yuephp,代码行数:8,代码来源:Online.class.php


示例12: host

 public static function host()
 {
     $host = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : null;
     if (is_null($host) || $host == "") {
         $host = ip();
     }
     return $host;
 }
开发者ID:patrix,项目名称:oraculum,代码行数:8,代码来源:HTTP.php


示例13: currentCityInfo

 function currentCityInfo()
 {
     $geoObj = bpBase::loadAppClass('geoObj', 'geo', 1);
     $ipGeo = $geoObj->getGeoByIP(ip());
     if (!$ipGeo) {
         $geo_db = bpBase::loadModel('geo_model');
         $defaultChildLocation = $geo_db->getDefaultChildLocation();
         $ipGeo = $defaultChildLocation;
     }
     echo '{"city":[{"name":"' . $ipGeo->name . '","id":"' . $ipGeo->id . '","geoindex":"' . $ipGeo->geoindex . '"}]}';
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:11,代码来源:widget.php


示例14: __construct

	function __construct() {
		pc_base::load_app_func('global');
		$this->vote = pc_base::load_model('vote_subject_model');//投票标题
		$this->vote_option = pc_base::load_model('vote_option_model');//投票选项
		$this->vote_data = pc_base::load_model('vote_data_model'); //投票统计的数据模型
		$this->username = param::get_cookie('_username');
		$this->userid = param::get_cookie('_userid'); 
		$this->ip = ip();
		
		$siteid = isset($_GET['siteid']) ? intval($_GET['siteid']) : get_siteid();
  		define("SITEID",$siteid);
 	}
开发者ID:hxzyzz,项目名称:ddc,代码行数:12,代码来源:index.php


示例15: login

 function login()
 {
     if (isset($_GET['dosubmit'])) {
         $username = trim($this->input->post('username'));
         $password = trim($this->input->post('password'));
         $code = trim($this->input->post('code'));
         $login_url = $this->admin_url . 'main_index/index/login';
         $this->load->model('a_system_model');
         $r = $this->a_system_model->get_one(array('username' => $username, 'sts' => 0), $this->tb_admini);
         //if ($this->session->userdata('adlogin_verifycode') != strtolower($code)) {//判断验证码
         //$this->showmessage('error',lang('com_verifycode_error'),$login_url);
         //}
         if (!$r) {
             $this->showmessage('goback', lang('password_error'), $login_url);
         }
         $password = md5(md5($password . $r['encrypt']));
         $maxloginfailedtimes = 5;
         $logintime = time() - 7200;
         $rtime = $this->a_system_model->get_one(array('username' => $username, 'isadmin' => 1, 'logintime >' => $logintime), $this->tb_times);
         //			if($rtime && $rtime['times'] > $maxloginfailedtimes) {
         //				$this->showmessage('error',lang('com_login_maxtimes_error'),$login_url);
         //			}
         if ($r['password'] != $password) {
             $ip = ip();
             if ($rtime && $rtime['times'] < $maxloginfailedtimes + 1) {
                 $times = $maxloginfailedtimes - intval($rtime['times']);
                 $this->a_system_model->update_set(array('username' => $username), array('ip' => $ip, 'isadmin' => 1, 'data_set' => array('times' => 'times+1')), $this->tb_times);
             } else {
                 $this->a_system_model->del(array('username' => $username, 'isadmin' => 1), 'sys_times');
                 $this->a_system_model->add(array('username' => $username, 'ip' => $ip, 'isadmin' => 1, 'logintime' => time(), 'times' => 1), $this->tb_times);
                 $times = $maxloginfailedtimes;
             }
             if ($times >= 3) {
                 //密码输入错误小于3次时提示
                 $this->showmessage('error', lang('com_login_error'), $login_url);
             } else {
                 $com_login_error = lang('com_login_times_error');
                 $com_login_error = cc_str_replace($com_login_error, array('times' => $times));
                 $this->showmessage('error', $com_login_error, $login_url);
             }
         }
         $this->a_system_model->del(array('username' => $username, 'isadmin' => 1), $this->tb_times);
         $last_login_time = empty($r['this_login_time']) ? time() : $r['this_login_time'];
         $loghash = random(6, 'abcdefghigklmnopqrstuvwxwyABCDEFGHIGKLMNOPQRSTUVWXWY0123456789');
         $this->a_system_model->update(array('id' => $r['id']), array('last_login_ip' => ip(), 'last_login_time' => $last_login_time, 'this_login_time' => time()), $this->tb_admini);
         $ses_data = array('admin_user_id' => $r['id'], 'admin_username' => $username, 'admin_role_id' => $r['role_id'], 'admin_area_id' => $r['areaids'], 'admin_login' => 'logined', 'loghash' => $loghash);
         $this->session->set_userdata($ses_data);
         redirect($this->admin_url . 'main_index/index/?loghash=' . $loghash);
     }
     $this->cismarty->display('login.html');
 }
开发者ID:zydj333,项目名称:hualiangcaifu,代码行数:51,代码来源:main_index.php


示例16: write

 public function write($id, $data)
 {
     $uid = isset($_SESSION['userid']) ? $_SESSION['userid'] : 0;
     $roleid = isset($_SESSION['roleid']) ? $_SESSION['roleid'] : 0;
     $m = defined('M') ? M : '';
     $c = defined('C') ? C : '';
     $a = defined('A') ? A : '';
     if (strlen($data) > 255) {
         $data = '';
     }
     $ip = ip();
     $sessiondata = array('sessionid' => $id, 'userid' => $uid, 'roleid' => $roleid, 'lastvisit' => SYS_TIME, 'ip' => $ip, 'm' => $m, 'c' => $c, 'a' => $a, 'data' => $data);
     return $this->db->insert($sessiondata, 1, 1);
 }
开发者ID:iquanxin,项目名称:march,代码行数:14,代码来源:session.cls.php


示例17: submit

 public function submit()
 {
     $formid = isset($_REQUEST['formid']) ? intval($_REQUEST['formid']) : false;
     $form = model('form')->where('formid', $formid)->getOne();
     if ($form['checkcode'] == 1) {
         if (!isset($_REQUEST['checkcode'])) {
             $status = array('status' => 'false', 'msg' => '需要验证码!');
         }
     } else {
         if ($_REQUEST['checkcode'] != $_SESSION['code']) {
             $status = array('status' => 'false', 'msg' => '验证码不正确!');
             return $this->Freturn($status);
         }
         if (empty($form)) {
             $status = array('status' => 'false', 'msg' => '请仔细检查表单是否存在!');
             return $this->Freturn($status);
         }
         $this->formname = $formname = $form['formname'];
         $this->formid = $formid;
         $formField = unserialize($form['formsetting']);
         $ip = ip();
         $lastsubmitform = model('form_content')->where('fid', $formid)->where('time>' . (time() - 20))->getOne();
         if (!empty($lastsubmitform)) {
             $status = array('status' => false, 'msg' => '对不起,您已经提交过' . $formname . '了!');
             return $this->Freturn($status);
         }
         if (!$formid) {
             $status = array('status' => false, 'msg' => '参数不完整,缺少formid!');
             return $this->Freturn($status);
         } else {
             unset($form);
             foreach ($formField as $field) {
                 if (!isset($_REQUEST[$field])) {
                     $status = array('status' => false, 'msg' => '参数' . $field . '不存在!');
                     return $this->Freturn($status);
                 } else {
                     $form[$field] = $_REQUEST[$field];
                 }
             }
             $form = serialize($form);
         }
         $insert = array('fid' => $formid, 'time' => time(), 'value' => $form, 'ip' => ip());
         if (model('form_content')->insert($insert)) {
             $status = array('status' => true, 'msg' => $formname . '提交成功了!');
         } else {
             $status = array('status' => false, 'msg' => '出现未知错误!');
         }
     }
     return $this->Freturn($status);
 }
开发者ID:pgfeng,项目名称:ssy.9icode.club,代码行数:50,代码来源:FormController.php


示例18: agent

function agent($o = false)
{
    if ($o) {
        ob_start();
    }
    foreach ($_SERVER as $key => $val) {
        $server[strtolower($key)] = trim(strip_tags($val));
    }
    ksort($server);
    ?>
<table class='server'><?php 
    foreach ($server as $key => $val) {
        ?>
<tr><?php 
        ?>
<th><?php 
        echo $key;
        ?>
</th><?php 
        ?>
<td><?php 
        echo $val;
        ?>
</td><?php 
        ?>
</tr><?php 
    }
    ?>
	<tr><th>ip</th><td><?php 
    echo ip();
    ?>
</td></tr>
	<tr><th>ipv4</th><td><?php 
    echo ipmore($ip)["IPv4"];
    ?>
</td></tr>
	<tr><th>ipv6</th><td><?php 
    echo ipmore($ip)["IPv6"];
    ?>
</td></tr>
	<?php 
    ?>
</table><?php 
    if ($o) {
        $r = ob_get_contents();
        ob_end_clean();
        return $r;
    }
}
开发者ID:matthewmorrone1,项目名称:aquaponics,代码行数:49,代码来源:api.php


示例19: Register

function Register($data)
{
    $data['password'] = md5($data['password']);
    $data['create_at'] = now();
    $data['update_at'] = now();
    $data['create_ip'] = ip();
    $userid = db_new("user", $data);
    if ($userid) {
        $userinfo = GetInfo($userid);
        $token = Crypt3Des::encrypt(json_encode($userinfo), $GLOBALS['keys']);
        return ErrorCode::CODE("1002", array("token" => urlencode($token)));
    } else {
        return ErrorCode::CODE("1003");
    }
}
开发者ID:sanshilei,项目名称:password,代码行数:15,代码来源:user.php


示例20: savegbform

function savegbform()
{
    global $db;
    $title = Html2Text($_POST["title"]);
    $content = HtmlReplace($_POST["content"]);
    $fileurl = HtmlReplace($_POST["fileurl"]);
    $replyid = intval($_POST["replyid"]);
    if (empty($title) || empty($content)) {
        header("location:./");
        exit;
    } else {
        $array = array('title' => $title, 'content' => $content, 'fileurl' => $fileurl, 'replyid' => $replyid, 'addtime' => time(), 'ip' => ip());
        $db->insert("ve123_guestbook", $array);
        header("location:./");
    }
}
开发者ID:tanny2015,项目名称:DataStructure,代码行数:16,代码来源:index.php



注:本文中的ip函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ip2area函数代码示例发布时间:2022-05-15
下一篇:
PHP ioncube_loader_version函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap