当前位置: 首页>>代码示例>>PHP>>正文


PHP get_ip函数代码示例

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


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

示例1: main

 protected function main()
 {
     $this->set_title(Nw::$lang['contact']['contact']);
     $this->add_css('forms.css');
     $this->set_filAriane(array(Nw::$lang['contact']['contact'] => array('')));
     $this->set_tpl('contact/contact.html');
     $this->load_lang_file('users');
     $this->add_form('contenu');
     //Si on veut envoyer le mail
     if (isset($_POST['submit'])) {
         if (empty($_POST['pseudo'])) {
             $msg_error = sprintf(Nw::$lang['contact']['error_empty'], Nw::$lang['contact']['_pseudo']);
         } elseif (empty($_POST['mail'])) {
             $msg_error = sprintf(Nw::$lang['contact']['error_empty'], Nw::$lang['contact']['_mail']);
         } elseif (empty($_POST['sujet'])) {
             $msg_error = sprintf(Nw::$lang['contact']['error_empty'], Nw::$lang['contact']['_sujet']);
         } elseif (empty($_POST['contenu'])) {
             $msg_error = sprintf(Nw::$lang['contact']['error_empty'], Nw::$lang['contact']['_contenu']);
         } elseif ($_POST['code_cap'] != $_SESSION['cap_nw']) {
             $msg_error = Nw::$lang['users']['wrong_antispam'];
         }
         if (!empty($msg_error)) {
             display_form(array('pseudo' => $_POST['pseudo'], 'mail' => $_POST['mail'], 'sujet' => $_POST['sujet'], 'contenu' => $_POST['contenu'], 'captcha' => $_POST['captcha'], 'nom' => $_POST['nom'], 'code_cap' => ''), $msg_error);
         } else {
             inc_lib('mail/email_contact');
             if (email_contact($_POST['mail'], $_POST['pseudo'], $_POST['nom'], '[Contact] ' . $_POST['sujet'], $_POST['contenu'], get_ip())) {
                 redir(Nw::$lang['contact']['redir_ok'], true, 'contact.html');
             }
         }
     } else {
         display_form(array('pseudo' => is_logged_in() ? Nw::$dn_mbr['u_pseudo'] : '', 'mail' => is_logged_in() ? Nw::$dn_mbr['u_email'] : '', 'sujet' => '', 'contenu' => '', 'captcha' => '', 'nom' => '', 'code_cap' => ''));
     }
 }
开发者ID:shiooooooookun,项目名称:Nouweo_PHP,代码行数:33,代码来源:0-contact.php

示例2: api_login

 public function api_login()
 {
     //почта
     $mail = isset($this->request->data['mail']) ? $this->request->data['mail'] : null;
     //пароль
     $password = isset($this->request->data['password']) ? $this->request->data['password'] : null;
     if ($password == null or $mail == null) {
         $status = 'error';
         response_ajax(array('error' => 'password_invalid'), $status);
         exit;
     }
     if ($mail == null) {
         $status = 'error';
         response_ajax(array('error' => 'mail_invalid'), $status);
         exit;
     }
     $hashed_pass = get_hash(Configure::read('USER_AUTH_SALT'), $password);
     $check_user = $this->User->find('count', array('conditions' => array('password' => $hashed_pass, 'mail' => $mail)));
     if ($check_user > 0) {
         //удачная авторизация
         $this->Session->write('User', $mail);
         $user_id_data = $this->User->find('first', array('conditions' => array('mail' => $mail)));
         $user_id = $user_id_data['User']['id'];
         $this->loadModel('Userauth');
         $auth_data = array('user_id' => $user_id, 'ip' => get_ip(), 'browser' => get_ua(), 'os' => get_os());
         $this->Userauth->save($auth_data);
         $this->Session->write('user_id', $user_id);
         $status = 'success';
         response_ajax(array('result' => 'login'), $status);
     } else {
         $status = 'error';
         response_ajax(array('error' => 'user_not_found'), $status);
     }
     exit;
 }
开发者ID:homoastricus,项目名称:master_project,代码行数:35,代码来源:LoginController.php

示例3: index

 public function index()
 {
     $vdata['title'] = "登录!";
     if ($this->form_validation->run('login') == FALSE) {
         $this->load->view('login', $vdata);
     } else {
         $mid = $this->uname;
         $info = $this->model->get_login($mid);
         $session = array("mid" => $mid, "uname" => $info['uname'], "nickname" => $info['nickname'], "login_ip" => get_ip(), "gid" => $info['gid']);
         $this->session->set_userdata($session);
         $this->model->set_login($mid);
         // 记住登录 1 周
         if ($this->input->post('rember')) {
             $rember_hours = $this->mcfg->get('adminer', 'rember_hours');
             if (!is_numeric($rember_hours)) {
                 $rember_hours = 72;
             }
             $_rember = md5(HMACPWD . $info['uname'] . $session['login_ip']);
             $cookie = array('name' => '_rember', 'value' => $_rember, 'expire' => 60 * 60 * $rember_hours, 'path' => $this->config->item('cookie_path'));
             $cookie2 = array('name' => '_m', 'value' => $mid, 'expire' => 60 * 60 * $rember_hours, 'path' => $this->config->item('cookie_path'));
             $this->input->set_cookie($cookie);
             $this->input->set_cookie($cookie2);
         }
         var_dump($session);
         $this->mlogs->add('login', 'manager ID ' . $this->session->userdata('mid') . ': 登录成功!');
         if ($this->input->get('url')) {
             redirect(urldecode($this->input->get('url')));
         } else {
             redirect(site_url('welcome'));
         }
     }
 }
开发者ID:PoppyLi,项目名称:PCMS,代码行数:32,代码来源:login.php

示例4: createAccount

function createAccount($pUsername, $pPassword, $pMail)
{
    global $dbc;
    // First check we have data passed in.
    if (!empty($pUsername) && !empty($pPassword) && !empty($pPassword) && !empty($pMail)) {
        $uLen = strlen($pUsername);
        $pLen = strlen($pPassword);
        // escape the $pUsername to avoid SQL Injections
        $eUsername = mysqli_real_escape_string($dbc, $pUsername);
        $sql = "SELECT username FROM nctf_accounts WHERE username = '" . $eUsername . "' LIMIT 1";
        // Note the use of trigger_error instead of or die.
        $query = mysqli_query($dbc, $sql) or trigger_error("Query Failed: " . mysql_error());
        $ip = get_ip();
        // Error checks (Should be explained with the error)
        if ($uLen <= 4 || $uLen >= 16) {
            $_SESSION['error'] = "Username must be between 5 and 11 characters.";
        } elseif ($pLen < 6) {
            $_SESSION['error'] = "Password must be longer then 6 characters.";
        } elseif (!filter_var($pMail, FILTER_VALIDATE_EMAIL)) {
            $_SESSION['error'] = "Invaild Email address.";
        } elseif (mysqli_num_rows($query) == 1) {
            $_SESSION['error'] = "Username already exists.";
        } else {
            $sql = "INSERT INTO nctf_accounts (`username`, `password`, `mail`,`register_time`,`register_ip`) VALUES ('" . $eUsername . "', '" . hashPassword($pPassword) . "','" . $pMail . "',now(),'" . $ip . "');";
            //echo $sql;
            $query = mysqli_query($dbc, $sql) or trigger_error("Query Failed: " . mysql_error());
            if ($query) {
                return true;
            }
        }
    }
    return false;
}
开发者ID:cfhb,项目名称:nctfonline,代码行数:33,代码来源:functions_list.php

示例5: add_mbr

function add_mbr($pseudo, $password, $email, $identifier = '', $valide = 0)
{
    $bf_token = 'jJ_=éZAç1l';
    $ft_token = 'ù%*àè1ç0°dezf';
    $key_alea_code_activate = md5(uniqid(mt_rand()));
    // Enregistrement de l'utilisateur dans la base de données
    Nw::$DB->query('INSERT INTO ' . Nw::$prefix_table . 'members (u_pseudo, u_alias, u_identifier, u_password, u_email, u_group, u_date_register, u_active, u_code_act, u_ip)
    VALUES(\'' . insertBD(trim($pseudo)) . '\', \'' . rewrite(trim($pseudo)) . '\', \'' . insertBD(trim($identifier)) . '\', \'' . insertBD(sha1($bf_token . trim($password) . $ft_token)) . '\', \'' . insertBD(trim($email)) . '\',
    4, NOW(), ' . intval($valide) . ', \'' . insertBD($key_alea_code_activate) . '\', \'' . get_ip() . '\')') or Nw::$DB->trigger(__LINE__, __FILE__);
    $id_new_membre = Nw::$DB->insert_id;
    $identifiant_unique = md5($id_new_membre . uniqid(rand(), true));
    $lien_activation = Nw::$site_url . 'users-32.html?mid=' . $id_new_membre . '&ca=' . $key_alea_code_activate;
    Nw::$DB->query('UPDATE ' . Nw::$prefix_table . 'members SET u_ident_unique = \'' . Nw::$DB->real_escape_string($identifiant_unique) . '\' WHERE u_id = ' . intval($id_new_membre)) or Nw::$DB->trigger(__LINE__, __FILE__);
    Nw::$DB->query('INSERT INTO ' . Nw::$prefix_table . 'members_stats (s_id_membre) VALUES(' . intval($id_new_membre) . ')') or Nw::$DB->trigger(__LINE__, __FILE__);
    inc_lib('users/mail2gd');
    mail2gd($identifiant_unique, trim($email));
    inc_lib('newsletter/add_abonnement');
    add_abonnement(trim($email), $id_new_membre);
    // Envoie d'email de validation
    if ($valide == 0) {
        $txt_mail = sprintf(Nw::$lang['users']['mail_confirm_insc'], $pseudo, Nw::$site_url, Nw::$site_name, $lien_activation, $lien_activation, $lien_activation);
        @envoi_mail(trim($email), sprintf(Nw::$lang['users']['confirm_inscription'], Nw::$site_name), $txt_mail);
    } else {
        // Le compte est confirmé, on met à jour le nbr de membres
        inc_lib('admin/gen_cachefile_nb_members');
        gen_cachefile_nb_members();
        generate_members_sitemap();
    }
    return $id_new_membre;
}
开发者ID:shiooooooookun,项目名称:Nouweo_PHP,代码行数:30,代码来源:add_mbr.php

示例6: archive_news

function archive_news($id_news)
{
    Nw::$DB->query('UPDATE ' . Nw::$prefix_table . 'news SET n_etat = 0 WHERE n_id = ' . intval($id_news)) or Nw::$DB->trigger(__LINE__, __FILE__);
    // Log
    $texte_log = sprintf(Nw::$lang['news']['log_votes_archived'], Nw::$pref['nb_votes_valid_news']);
    Nw::$DB->query('INSERT INTO ' . Nw::$prefix_table . 'news_logs (l_id_news, l_id_membre, l_action, l_texte, l_date, l_ip) VALUES(' . intval($id_news) . ', ' . intval(Nw::$dn_mbr['u_id']) . ', 10, \'' . $texte_log . '\', NOW(), \'' . get_ip() . '\')') or Nw::$DB->trigger(__LINE__, __FILE__);
}
开发者ID:shiooooooookun,项目名称:Nouweo_PHP,代码行数:7,代码来源:archive_news.php

示例7: add_alert_news

function add_alert_news($id_user, $id_news, $texte, $motif)
{
    inc_lib('bbcode/parse');
    $texte = Nw::$DB->real_escape_string(parse(htmlspecialchars(trim($texte))));
    Nw::$DB->query("INSERT INTO " . Nw::$prefix_table . "news_alerts(a_id_news, a_auteur,\n        a_ip, a_date, a_texte, a_motif)\n        VALUES(" . intval($id_news) . ", " . intval($id_user) . ", " . get_ip() . ", NOW(), \n        '" . $texte . "', " . intval($motif) . ")") or Nw::$DB->trigger(__LINE__, __FILE__);
    return Nw::$DB->insert_id;
}
开发者ID:shiooooooookun,项目名称:Nouweo_PHP,代码行数:7,代码来源:add_alert_news.php

示例8: propose_news_votes

function propose_news_votes($id)
{
    Nw::$DB->query('UPDATE ' . Nw::$prefix_table . 'news
        SET n_date = NOW(), n_last_mod = NULL, n_private = 0, n_etat = 2
        WHERE n_id = ' . intval($id)) or Nw::$DB->trigger(__LINE__, __FILE__);
    Nw::$DB->query('INSERT INTO ' . Nw::$prefix_table . 'news_logs (l_id_news, l_id_membre, l_action, l_date, l_ip) VALUES(' . intval($id) . ', ' . intval(Nw::$dn_mbr['u_id']) . ', 12, NOW(), \'' . get_ip() . '\')') or Nw::$DB->trigger(__LINE__, __FILE__);
}
开发者ID:shiooooooookun,项目名称:Nouweo_PHP,代码行数:7,代码来源:propose_news_votes.php

示例9: get_ban

/**
* For ban ips .. 
*/
function get_ban()
{
    global $banss, $lang, $tpl, $text;
    //visitor ip now
    $ip = get_ip();
    //now .. loop for banned ips
    if (is_array($banss) && !empty($ip)) {
        foreach ($banss as $ip2) {
            $ip2 = trim($ip2);
            if (empty($ip2)) {
                continue;
            }
            //first .. replace all * with something good .
            $replace_it = str_replace("*", '([0-9]{1,3})', $ip2);
            $replace_it = str_replace(".", '\\.', $replace_it);
            if ($ip == $ip2 || @preg_match('/' . preg_quote($replace_it, '/') . '/i', $ip)) {
                ($hook = kleeja_run_hook('banned_get_ban_func')) ? eval($hook) : null;
                //run hook
                kleeja_info($lang['U_R_BANNED'], $lang['U_R_BANNED']);
            }
        }
    }
    ($hook = kleeja_run_hook('get_ban_func')) ? eval($hook) : null;
    //run hook
}
开发者ID:Saleh7,项目名称:Kleeja,代码行数:28,代码来源:functions.php

示例10: index

 /**
  *  邀请注册
  */
 function index()
 {
     $uid = intval($GLOBALS['uid']);
     if (!$uid) {
         header("Location:" . WEBURL);
         exit;
     }
     $_uid = get_cookie('_uid');
     if ($_uid && is_numeric($_uid)) {
         //已经登录的用户不算成功推广的下线
         header("Location:" . WEBURL);
         exit;
     } else {
         $times = SYS_TIME + 86400 * 7;
         set_cookie('ppc_uid', $uid, $times);
         $db = load_class('db');
         $ip = get_ip();
         $db->insert('ppc', array('uid' => $uid, 'addtime' => SYS_TIME, 'ip' => $ip));
         //后台配置推广页面跳转地址
         $setting = get_cache('setting', 'ppc');
         if (empty($setting['redirect_url'])) {
             MSG('请在后台配置推广页面地址');
         }
         header("Location:" . $setting['redirect_url']);
     }
 }
开发者ID:another3000,项目名称:wuzhicms,代码行数:29,代码来源:index.php

示例11: index

 public function index()
 {
     $vdata['title'] = lang('nav_serverinfo');
     //检查环境
     $vdata['extension'] = array('gd' => array("title" => lang('ext_gd'), 'enable' => 0), 'mysql' => array("title" => "Mysql", 'enable' => 0), 'mysqli' => array("title" => "Mysqli", 'enable' => 0), 'xml' => array("title" => "XML", 'enable' => 0), 'iconv' => array("title" => "iconv", 'enable' => 0), 'json' => array("title" => "json", 'enable' => 0), 'zip' => array("title" => "Zip", 'enable' => 0), 'curl' => array("title" => "CURL", 'enable' => 0));
     foreach ($vdata['extension'] as $e => $v) {
         if (extension_loaded($e)) {
             $vdata['extension'][$e]['enable'] = 1;
         }
     }
     // TODO 检测系统服务
     $vdata['env'] = array('serverip' => array("title" => lang('env_serverip'), 'enable' => $_SERVER['SERVER_ADDR']), 'serverport' => array("title" => lang('env_serverport'), 'enable' => $_SERVER['SERVER_PORT']), 'app' => array("title" => lang('env_app'), 'enable' => " <a href='" . GLOBAL_URL . "' target='_blank'>" . GLOBAL_URL . "</a>"), 'dbtype' => array("title" => lang('env_dbtype'), 'enable' => strtoupper(DB_TYPE)), 'cache' => array("title" => lang('env_cache'), 'enable' => 0), 'upload' => array("title" => lang('env_upload'), 'enable' => 0), 'memory_limit' => array("title" => lang('memory_limit'), 'enable' => ini_get('memory_limit')), 'upload_max_filesize' => array("title" => lang('upload_max_filesize'), 'enable' => ini_get('upload_max_filesize')));
     // 加载公用文件帮助函数
     $this->load->helper('file');
     if (new_is_writeable(UPLOAD_PATH)) {
         $vdata['env']['upload']['enable'] = "OK";
     }
     // 检测缓存文件夹可写
     if (new_is_writeable(APPPATH . 'cache')) {
         $vdata['env']['cache']['enable'] = "OK";
     }
     // 当前IP
     $vdata['server']['ip'] = get_ip();
     $this->load->view('inc_header.php', $vdata);
     $this->load->view('serverinfo_index.php');
     $this->load->view('inc_footer.php');
 }
开发者ID:PoppyLi,项目名称:PCMS,代码行数:27,代码来源:serverinfo.php

示例12: create_user_event

function create_user_event($e, $t, $user)
{
    // check for logged in status, we don't want to record an admin ip address
    // on an account they just created for example
    if (!elgg_is_logged_in()) {
        $user->ip_address = get_ip();
    }
}
开发者ID:bgunn,项目名称:spam_login_filter,代码行数:8,代码来源:events.php

示例13: Add

 public static function Add($text, $type)
 {
     global $currentUser;
     $user_id = $currentUser->isLogged() ? $currentUser['id'] : null;
     $ip = get_ip();
     $timestamp = time();
     $text = db_escape($text);
     exequery("INSERT INTO logs (ip, `timestamp`, user_id, `text`, type) VALUES ('{$ip}', '{$timestamp}', {$user_id}, '{$text}', {$type})");
 }
开发者ID:pierotofy,项目名称:pierotofy.it,代码行数:9,代码来源:Log.php

示例14: maj_donnees_membre

 /**
  *  Met à jour les infos du membre connecté
  *  @author Cam
  * @param $idm     ID du membre
  *  @return void
  */
 public static function maj_donnees_membre($idm)
 {
     Nw::$DB->query('UPDATE ' . Nw::$prefix_table . 'members 
         SET u_last_visit = NOW(), u_ip = ' . get_ip() . '
         WHERE u_id = ' . intval($idm));
     if (!isset($_SESSION['last_ip']) || $_SESSION['last_ip'] != get_ip()) {
         $_SESSION['last_ip'] = get_ip();
         Nw::$DB->query("INSERT INTO " . Nw::$prefix_table . "members_ip(ip_ip,\r\n                ip_id_mbr, ip_date_begin, ip_date_last)\r\n                VALUES(" . get_ip() . ", " . intval($idm) . ", NOW(), NOW())\r\n                ON DUPLICATE KEY UPDATE ip_date_last = NOW()") or Nw::$DB->trigger(__LINE__, __FILE__);
     }
 }
开发者ID:shiooooooookun,项目名称:Nouweo_PHP,代码行数:16,代码来源:session.class.php

示例15: add_msg_list_live

function add_msg_list_live($id_live, $message)
{
    inc_lib('bbcode/parse');
    $contenu = Nw::$DB->real_escape_string(parse(htmlspecialchars(trim($message))));
    Nw::$DB->query('INSERT INTO ' . Nw::$prefix_table . 'w_live_posts (post_id_membre,
        post_id_live, post_date, post_contenu, post_ip) VALUES(' . intval(Nw::$dn_mbr['u_id']) . ', 
        ' . intval($id_live) . ', NOW(), \'' . $contenu . '\', \'' . get_ip() . '\')') or Nw::$DB->trigger(__LINE__, __FILE__);
    $id_new_post = Nw::$DB->insert_id;
    return $id_new_post;
}
开发者ID:shiooooooookun,项目名称:Nouweo_PHP,代码行数:10,代码来源:add_msg_list_live.php


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