本文整理汇总了PHP中get_ip函数的典型用法代码示例。如果您正苦于以下问题:PHP get_ip函数的具体用法?PHP get_ip怎么用?PHP get_ip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_ip函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: add_comment
public function add_comment($post_id)
{
if ($this->comments_moderation == 1) {
$comment_approved = "pending";
} else {
$comment_approved = "approved";
}
$data = array('post_id' => $post_id, 'comment_author' => $this->db->escape_str($this->input->post('comment_author')), 'comment_author_email' => $this->db->escape_str($this->input->post('comment_author_email')), 'comment_author_website' => $this->db->escape_str($this->input->post('comment_author_website')), 'comment_author_ip' => get_ip(), 'comment_content' => $this->db->escape_str($this->input->post('comment_content')), 'comment_date' => time(), 'comment_agent' => $this->agent->agent_string(), 'comment_approved' => $comment_approved);
$this->db->insert($this->table_comments, $data);
}
开发者ID:otengkwame,项目名称:DhoBlog,代码行数:10,代码来源:Comments_model.php
示例17: set_login
public function set_login($id)
{
// 获取上次信息
$info = $this->get_login($id);
$this->db->set('login_ip', get_ip());
$this->db->set('login_time', time());
$this->db->set('pwd_errors', 0);
$this->db->where('id', $id);
$this->db->update($this->table);
return $this->db->affected_rows();
}
开发者ID:PoppyLi,项目名称:PCMS,代码行数:11,代码来源:acount_model.php
示例18: logs
public function logs($logstr)
{
$session_data = $this->session->all_userdata();
//print_r($session_data);
$uid = @$session_data['id'];
$this->load->helper('common');
if ($uid) {
$data = array('user_id' => $uid, 'info' => $logstr, 'actionname' => $this->uri->uri_string, 'ctime' => date("Y-m-d H:i:s"), 'ip' => get_ip());
$this->db->insert('hz_logs', $data);
}
}
开发者ID:aidear,项目名称:100event,代码行数:11,代码来源:login.php
示例19: ask
public function ask()
{
$formdata = array();
$formdata['title'] = isset($GLOBALS['title']) ? remove_xss($GLOBALS['title']) : strcut($GLOBALS['content'], 80);
$formdata['content'] = $GLOBALS['content'];
$formdata['addtime'] = SYS_TIME;
$formdata['publisher'] = $this->memberinfo['username'];
$formdata['ip'] = get_ip();
$this->db->insert('guestbook', $formdata);
MSG('您的提问已经提交,我们的专家会尽快给您回复', '?m=guestbook&f=myissue&v=listing');
}
开发者ID:haizhilin2013,项目名称:wuzhicms,代码行数:11,代码来源:myissue.php
示例20: sync
function sync()
{
$this->post_stamp = __request_timestamp__;
$this->ip_addr = get_ip();
$this->host_name = $GLOBALS['FUD_OPT_1'] & 268435456 ? "'" . addslashes(get_host($this->ip_addr)) . "'" : 'NULL';
list($this->foff, $this->length) = write_pmsg_body($this->body);
q("UPDATE phpgw_fud_pmsg SET\n\t\t\tto_list=" . strnull(addslashes($this->to_list)) . ",\n\t\t\ticon=" . strnull($this->icon) . ",\n\t\t\touser_id=" . $this->ouser_id . ",\n\t\t\tduser_id=" . $this->ouser_id . ",\n\t\t\tpost_stamp=" . $this->post_stamp . ",\n\t\t\tsubject='" . addslashes($this->subject) . "',\n\t\t\tip_addr='" . $this->ip_addr . "',\n\t\t\thost_name=" . $this->host_name . ",\n\t\t\tattach_cnt=" . (int) $this->attach_cnt . ",\n\t\t\tfldr=" . $this->fldr . ",\n\t\t\tfoff=" . (int) $this->foff . ",\n\t\t\tlength=" . (int) $this->length . ",\n\t\t\tpmsg_opt=" . $this->pmsg_opt . "\n\t\tWHERE id=" . $this->id);
if ($this->fldr == 3) {
$this->send_pmsg();
}
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:11,代码来源:pmsg.php
注:本文中的get_ip函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论