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

PHP get_remote_address函数代码示例

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

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



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

示例1: logout

 public function logout($id, $token)
 {
     global $lang_login;
     if ($this->user->is_guest || !isset($id) || $id != $this->user->id || !isset($token) || $token != feather_hash($this->user->id . feather_hash(get_remote_address()))) {
         header('Location: ' . get_base_url());
         exit;
     }
     // Remove user from "users online" list
     DB::for_table('online')->where('user_id', $this->user->id)->delete_many();
     // Update last_visit (make sure there's something to update it with)
     if (isset($this->user->logged)) {
         DB::for_table('users')->where('id', $this->user->id)->find_one()->set('last_visit', $this->user->logged)->save();
     }
     feather_setcookie(1, feather_hash(uniqid(rand(), true)), time() + 31536000);
     redirect(get_base_url(), $lang_login['Logout redirect']);
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:16,代码来源:login.php


示例2: escrow_publish_topic_problem

function escrow_publish_topic_problem($post_info)
{
    global $forum_db, $db_type, $forum_config, $lang_common;
    if ($return != null) {
        return;
    }
    // Add the topic
    $query = array('INSERT' => 'poster, subject, posted, last_post, last_poster, forum_id, visibility', 'INTO' => 'topics', 'VALUES' => '\'' . $forum_db->escape($post_info['poster']) . '\', \'' . $forum_db->escape($post_info['subject']) . '\', ' . $post_info['posted'] . ', ' . $post_info['posted'] . ', \'' . $forum_db->escape($post_info['poster']) . '\', ' . $post_info['forum_id'] . ', ' . $post_info['visibility']);
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $new_tid = $forum_db->insert_id();
    // Create the post ("topic post")
    $query = array('INSERT' => 'poster, poster_id, poster_ip, message, posted, topic_id', 'INTO' => 'posts', 'VALUES' => '\'' . $forum_db->escape($post_info['poster']) . '\', ' . $post_info['poster_id'] . ', \'' . $forum_db->escape(get_remote_address()) . '\', \'' . $forum_db->escape($post_info['message']) . '\', ' . $post_info['posted'] . ', ' . $new_tid);
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $new_pid = $forum_db->insert_id();
    // Update the topic with last_post_id and first_post_id
    $query = array('UPDATE' => 'topics', 'SET' => 'last_post_id=' . $new_pid . ', first_post_id=' . $new_pid, 'WHERE' => 'id=' . $new_tid);
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
    return $new_tid;
}
开发者ID:torepublicStartpageCode,项目名称:torepublic2,代码行数:19,代码来源:reportproblem.php


示例3: get_user_nav_menu_items

function get_user_nav_menu_items()
{
    global $db, $luna_config, $luna_user;
    $items = array();
    if ($luna_user['is_guest']) {
        $items['guest'] = array('register' => array('url' => 'register.php', 'title' => __('Register', 'luna')), 'login' => array('url' => '#', 'title' => __('Login', 'luna')));
    } else {
        if ($luna_user['is_admmod']) {
            $items['backstage'] = array('url' => 'backstage/', 'title' => __('Backstage', 'luna'));
        }
        // Check for new notifications
        $result = $db->query('SELECT COUNT(id) FROM ' . $db->prefix . 'notifications WHERE viewed = 0 AND user_id = ' . $luna_user['id']) or error('Unable to load notifications', __FILE__, __LINE__, $db->error());
        $num_notifications = intval($db->result($result));
        $items['notifications'] = array('url' => $luna_config['o_notification_flyout'] ? '#' : 'notifications.php', 'title' => $num_notifications > 0 ? __('Notifications', 'luna') : __('No new notifications', 'luna'), 'num' => $num_notifications, 'flyout' => 1 == $luna_config['o_notification_flyout']);
        if ($luna_config['o_pms_enabled'] == '1' && $luna_user['g_pm'] == '1' && $luna_user['use_pm'] == '1') {
            // Check for new messages
            $result = $db->query('SELECT COUNT(id) FROM ' . $db->prefix . 'messages WHERE showed=0 AND show_message=1 AND owner=' . $luna_user['id']) or error('Unable to check the availibility of new messages', __FILE__, __LINE__, $db->error());
            $num_new_pm = intval($db->result($result));
            $items['inbox'] = array('url' => 'inbox.php', 'title' => 'Inbox', 'num' => $num_new_pm);
        }
        $items['user'] = array('profile' => array('url' => 'profile.php?id=' . $luna_user['id'], 'title' => __('Profile', 'luna')), 'settings' => array('url' => 'settings.php', 'title' => __('Settings', 'luna')), 'help' => array('url' => 'help.php', 'title' => __('Help', 'luna')), 'logout' => array('url' => 'login.php?action=out&id=' . $luna_user['id'] . '&csrf_token=' . luna_hash($luna_user['id'] . luna_hash(get_remote_address())), 'title' => __('Logout', 'luna')));
    }
    return $items;
}
开发者ID:BogusCurry,项目名称:Luna,代码行数:24,代码来源:general_functions.php


示例4: generate_cached_search_query

function generate_cached_search_query($search_id, &$show_as)
{
    global $forum_db, $db_type, $forum_user, $forum_config;
    $return = ($hook = get_hook('sf_fn_generate_cached_search_query_start')) ? eval($hook) : null;
    if ($return != null) {
        return $return;
    }
    $ident = $forum_user['is_guest'] ? get_remote_address() : $forum_user['username'];
    $query = array('SELECT' => 'sc.search_data', 'FROM' => 'search_cache AS sc', 'WHERE' => 'sc.id=' . $search_id . ' AND sc.ident=\'' . $forum_db->escape($ident) . '\'');
    ($hook = get_hook('sf_fn_generate_cached_search_query_qr_get_cached_search_data')) ? eval($hook) : null;
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    if ($row = $forum_db->fetch_assoc($result)) {
        $search_data = unserialize($row['search_data']);
        $search_results = $search_data['search_results'];
        $sort_by = $search_data['sort_by'];
        $sort_dir = $search_data['sort_dir'];
        $show_as = $search_data['show_as'];
        unset($search_data);
    } else {
        return false;
    }
    // If there are no posts, we don't need to execute the query
    if (empty($search_results)) {
        return false;
    }
    switch ($sort_by) {
        case 1:
            $sort_by_sql = $show_as == 'topics' ? 't.poster' : 'p.poster';
            break;
        case 2:
            $sort_by_sql = 't.subject';
            break;
        case 3:
            $sort_by_sql = 't.forum_id';
            break;
        default:
            $sort_by_sql = $show_as == 'topics' ? 't.posted' : 'p.posted';
            ($hook = get_hook('sf_fn_generate_cached_search_query_qr_cached_sort_by')) ? eval($hook) : null;
            break;
    }
    if ($show_as == 'posts') {
        $query = array('SELECT' => 'p.id AS pid, p.poster AS pposter, p.posted AS pposted, p.poster_id, p.message, p.hide_smilies, t.id AS tid, t.poster, t.subject, t.first_post_id, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.forum_id, f.forum_name', 'FROM' => 'posts AS p', 'JOINS' => array(array('INNER JOIN' => 'topics AS t', 'ON' => 't.id=p.topic_id'), array('INNER JOIN' => 'forums AS f', 'ON' => 'f.id=t.forum_id')), 'WHERE' => 'p.id IN(' . $search_results . ')', 'ORDER BY' => $sort_by_sql . ' ' . $sort_dir);
        ($hook = get_hook('sf_fn_generate_cached_search_query_qr_get_cached_hits_as_posts')) ? eval($hook) : null;
    } else {
        $query = array('SELECT' => 't.id AS tid, t.poster, t.subject, t.first_post_id, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.sticky, t.forum_id, f.forum_name', 'FROM' => 'topics AS t', 'JOINS' => array(array('INNER JOIN' => 'forums AS f', 'ON' => 'f.id=t.forum_id')), 'WHERE' => 't.id IN(' . $search_results . ')', 'ORDER BY' => $sort_by_sql . ' ' . $sort_dir);
        // With "has posted" indication
        if (!$forum_user['is_guest'] && $forum_config['o_show_dot'] == '1') {
            $query['SELECT'] .= ', p.poster_id AS has_posted';
            $query['JOINS'][] = array('LEFT JOIN' => 'posts AS p', 'ON' => '(p.poster_id=' . $forum_user['id'] . ' AND p.topic_id=t.id)');
            // Must have same columns as in prev SELECT
            $query['GROUP BY'] = 't.id, t.poster, t.subject, t.first_post_id, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.sticky, t.forum_id, f.forum_name, p.poster_id';
            ($hook = get_hook('sf_fn_generate_cached_search_query_qr_get_has_posted')) ? eval($hook) : null;
        }
        ($hook = get_hook('sf_fn_generate_cached_search_query_qr_get_cached_hits_as_topics')) ? eval($hook) : null;
    }
    ($hook = get_hook('sf_fn_generate_cached_search_query_end')) ? eval($hook) : null;
    return $query;
}
开发者ID:heiswayi,项目名称:ishare-plus,代码行数:58,代码来源:search_functions.php


示例5: array

                if ($_SESSION['GPG_MESSAGE'] == $_POST['req_CLEARTEXT'] || $_SESSION['GPG_CIPHERTEXT'] == 'SORRY, YOUR PUBKEY IS FAULTY') {
                    // Remove this user's guest entry from the online list
                    $query = array('DELETE' => 'online', 'WHERE' => 'ident=\'' . $forum_db->escape(get_remote_address()) . '\'');
                    ($hook = get_hook('li_login_qr_delete_online_user')) ? eval($hook) : null;
                    $forum_db->query_build($query) or error(__FILE__, __LINE__);
                    $expire = $save_pass ? time() + 1209600 : time() + $forum_config['o_timeout_visit'];
                    forum_setcookie($cookie_name, base64_encode($user_id . '|' . $form_password_hash . '|' . $expire . '|' . sha1($salt . $form_password_hash . forum_hash($expire, $salt))), $expire);
                    ($hook = get_hook('li_login_pre_redirect')) ? eval($hook) : null;
                    $_SESSION = array();
                    $_SESSION['NOT_BOT'] = 1;
                    redirect(FORUM_ROOT . "search.php?action=show_new");
                }
            } else {
                $_SESSION['GPG_VERIFICATION_REQUIRED'] = 0;
                // Remove this user's guest entry from the online list
                $query = array('DELETE' => 'online', 'WHERE' => 'ident=\'' . $forum_db->escape(get_remote_address()) . '\'');
                ($hook = get_hook('li_login_qr_delete_online_user')) ? eval($hook) : null;
                $forum_db->query_build($query) or error(__FILE__, __LINE__);
                $expire = $save_pass ? time() + 1209600 : time() + $forum_config['o_timeout_visit'];
                forum_setcookie($cookie_name, base64_encode($user_id . '|' . $form_password_hash . '|' . $expire . '|' . sha1($salt . $form_password_hash . forum_hash($expire, $salt))), $expire);
                ($hook = get_hook('li_login_pre_redirect')) ? eval($hook) : null;
                $_SESSION = array();
                $_SESSION['NOT_BOT'] = 1;
                redirect(FORUM_ROOT . "search.php?action=show_new");
            }
        }
    }
} else {
    if ($action == 'out') {
        if ($forum_user['is_guest'] || !isset($_GET['id']) || $_GET['id'] != $forum_user['id']) {
            header('Location: ' . forum_link($forum_url['index']));
开发者ID:torepublicStartpageCode,项目名称:torepublic2,代码行数:31,代码来源:login.php


示例6: array

        }
    }
    if ($panther_config['p_allow_dupe_email'] == '0') {
        $data = array(':email' => $email);
        $ps = $db->select('users', 1, $data, 'email=:email');
        if ($ps->rowCount()) {
            $errors[] = $lang_prof_reg['Dupe email'];
        }
    }
    if (empty($errors)) {
        // Insert the new user into the database. We do this now to get the last inserted ID for later use
        $now = time();
        $initial_group_id = $random_pass == 0 ? $panther_config['o_default_user_group'] : PANTHER_UNVERIFIED;
        $password_hash = panther_hash($password1 . $password_salt);
        // Add the user
        $insert = array('username' => $username, 'group_id' => $initial_group_id, 'password' => $password_hash, 'salt' => $password_salt, 'email' => $email, 'email_setting' => $panther_config['o_default_email_setting'], 'timezone' => $panther_config['o_default_timezone'], 'dst' => $panther_config['o_default_dst'], 'language' => $panther_config['o_default_lang'], 'style' => $panther_config['o_default_style'], 'registered' => $now, 'registration_ip' => get_remote_address(), 'last_visit' => $now);
        $db->insert('users', $insert);
        $new_uid = $db->lastInsertId($db->prefix . 'users');
        if ($random_pass == '1') {
            $info = array('subject' => array('<board_title>' => $panther_config['o_board_title']), 'message' => array('<base_url>' => get_base_url(), '<username>' => $username, '<password>' => $password1, '<login_url>' => panther_link($panther_url['login'])));
            $mail_tpl = $mailer->parse(PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/mail_templates/welcome.tpl', $info);
            $mailer->send($email, $mail_tpl['subject'], $mail_tpl['message']);
        }
        // Regenerate the users info cache
        if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
            require PANTHER_ROOT . 'include/cache.php';
        }
        generate_users_info_cache();
        redirect(panther_link($panther_url['admin_maintenance']), $lang_admin_maintenance['User created message']);
    }
}
开发者ID:mtechnik,项目名称:pantherforum,代码行数:31,代码来源:maintenance.php


示例7: error

                     $db->query('UPDATE ' . $db->prefix . 'topics SET has_poll=' . $poll_id . ' WHERE id=' . $new_tid) or error('Unable to update topic for poll', __FILE__, __LINE__, $db->error());
                 }
             }
         }
         // hcs AJAX POLL MOD END
         if (!$pun_user['is_guest']) {
             // To subscribe or not to subscribe, that ...
             if ($pun_config['o_subscriptions'] == 1 && $_POST['subscribe'] == 1) {
                 $db->query('INSERT INTO ' . $db->prefix . 'subscriptions (user_id, topic_id) VALUES(' . $pun_user['id'] . ' ,' . $new_tid . ')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
             }
             // Create the post ("topic post")
             $db->query('INSERT INTO ' . $db->prefix . 'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\'' . $db->escape($username) . '\', ' . $pun_user['id'] . ', \'' . get_remote_address() . '\', \'' . $db->escape($message) . '\', \'' . $hide_smilies . '\', ' . $_SERVER['REQUEST_TIME'] . ', ' . $new_tid . ')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
         } else {
             // Create the post ("topic post")
             $email_sql = $pun_config['p_force_guest_email'] == 1 || $email ? '\'' . $db->escape($email) . '\'' : 'NULL';
             $db->query('INSERT INTO ' . $db->prefix . 'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id) VALUES(\'' . $db->escape($username) . '\', \'' . get_remote_address() . '\', ' . $email_sql . ', \'' . $db->escape($message) . '\', \'' . $hide_smilies . '\', ' . $_SERVER['REQUEST_TIME'] . ', ' . $new_tid . ')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
         }
         $new_pid = $db->insert_id();
         // Update the topic with last_post_id
         $db->query('UPDATE ' . $db->prefix . 'topics SET last_post_id=' . $new_pid . ' WHERE id=' . $new_tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
         update_search_index('post', $new_pid, $message, $subject);
         update_forum($fid);
     }
 }
 generate_rss();
 $uploaded = 0;
 $upload_result = process_uploaded_files($fid ? $new_tid : $tid, $new_pid, $uploaded);
 // If the posting user is logged in, increment his/her post count
 // MERGE POSTS BEGIN
 if (!$pun_user['is_guest']) {
     if ($uploaded) {
开发者ID:tipsun91,项目名称:punbb-mod,代码行数:31,代码来源:post.php


示例8: get_remote_address

     \'' . get_remote_address() . '\',
     \'' . $smilies . '\',
     \'0\',
     \'0\',
     \'' . $_SERVER['REQUEST_TIME'] . '\',
     \'0\'
     )') or error('Unable to send message', __FILE__, __LINE__, $db->error());
     // Save an own copy of the message
     if (isset($_POST['savemessage'])) {
         $db->query('INSERT INTO ' . $db->prefix . 'messages (owner, subject, message, sender, sender_id, sender_ip, smileys, showed, status, posted, popup) VALUES(
         \'' . $pun_user['id'] . '\',
         \'' . $db->escape($subject) . '\',
         \'' . $db->escape($message) . '\',
         \'' . $db->escape($user) . '\',
         \'' . $id . '\',
         \'' . get_remote_address() . '\',
         \'' . $smilies . '\',
         \'1\',
         \'1\',
         \'' . $_SERVER['REQUEST_TIME'] . '\',
         \'1\'
         )') or error('Unable to send message', __FILE__, __LINE__, $db->error());
     }
 } else {
     wap_message($lang_pms['No user']);
 }
 $topic_redirect = intval($_POST['topic_redirect']);
 $from_profile = intval(@$_POST['from_profile']);
 if ($from_profile) {
     wap_redirect('profile.php?id=' . $from_profile);
 } else {
开发者ID:tipsun91,项目名称:punbb-mod,代码行数:31,代码来源:message_send.php


示例9: trim

         // Load the "new_pm" template
         $mail_tpl = trim(file_get_contents(PUN_ROOT . 'lang/' . $pun_user['language'] . '/mail_templates/new_pm.tpl'));
         // The first row contains the subject
         $first_crlf = strpos($mail_tpl, "\n");
         $mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
         $mail_message = trim(substr($mail_tpl, $first_crlf));
         $mail_subject = str_replace('<board_title>', $pun_config['o_board_title'], $mail_subject);
         $mail_message = str_replace('<sender>', $pun_user['username'], $mail_message);
         $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'] . ' ' . $lang_common['Mailer'], $mail_message);
     }
     foreach ($destinataires as $dest) {
         $db->query('INSERT INTO ' . $db->prefix . 'messages (owner, subject, message, sender, sender_id, sender_ip, smileys, showed, status, posted) VALUES(\'' . $dest['id'] . '\', \'' . $db->escape($p_subject) . '\', \'' . $db->escape($p_message) . '\', \'' . $db->escape($pun_user['username']) . '\', \'' . $pun_user['id'] . '\', \'' . get_remote_address() . '\', \'' . $smilies . '\', \'0\', \'0\', \'' . time() . '\' )') or error('Impossible d\'envoyer le message.', __FILE__, __LINE__, $db->error());
         $new_mp = $db->insert_id();
         // Save an own copy of the message
         if ($save == 1) {
             $db->query('INSERT INTO ' . $db->prefix . 'messages (owner, subject, message, sender, sender_id, sender_ip, smileys, showed, status, posted) VALUES(\'' . $pun_user['id'] . '\', \'' . $db->escape($p_subject) . '\', \'' . $db->escape($p_message) . '\', \'' . $db->escape($dest['username']) . '\', \'' . $dest['id'] . '\', \'' . get_remote_address() . '\', \'' . $smilies . '\', \'1\', \'1\', \'' . time() . '\' )') or error('Impossible de sauvegarder le message dans le dossier des messages envoyés', __FILE__, __LINE__, $db->error());
         }
         // E-mail notification
         if ($pun_config['o_pms_notification'] == '1' && $dest['notify_mp'] == 1) {
             $mail_message = str_replace('<pm_url>', $pun_config['o_base_url'] . '/pms_list.php?mid=' . $new_mp, $mail_message);
             pun_mail($dest['email'], $mail_subject, $mail_message);
         }
     }
     if ($from_profile != '') {
         redirect('profile.php?id=' . $from_profile, $lang_pms['Sent redirect']);
     } elseif ($tid != '') {
         redirect('viewtopic.php?id=' . $tid, $lang_pms['Sent redirect']);
     } else {
         redirect('pms_list.php', $lang_pms['Sent redirect']);
     }
 }
开发者ID:neofutur,项目名称:MyBestBB,代码行数:31,代码来源:pms_send.php


示例10: write

 /**
  * @see parent::write()
  */
 function write($session_id, $data)
 {
     $client = self::$client;
     $address = get_remote_address();
     $user_id = CAppUI::$instance->user_id;
     $user_ip = $address["remote"] ? inet_pton($address["remote"]) : null;
     $new_hash = md5($data);
     $key = $this->getKey($session_id);
     // If session is to be updated
     if ($this->data_hash || $this->data_hash !== $new_hash) {
         $session = array("user_id" => $user_id, "user_ip" => $user_ip, "data" => $data);
         $client->set($key, serialize($session), $this->lifetime);
     } else {
         $client->expire($key, $this->lifetime);
     }
     return true;
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:20,代码来源:CRedisSessionHandler.class.php


示例11: get_extensions

     // Check note_pm
     $note_pm = 'Subject: ' . $pm_subject . "\n\n" . 'Message:' . "\n\n" . $pm_message;
 } else {
     $note_pm = '';
 }
 ($hook = get_extensions('warn_after_validation')) ? eval($hook) : null;
 if (empty($errors)) {
     $expiration = $expiration != '0' ? $now + $expiration : 0;
     $insert = array('user_id' => $user_id, 'type_id' => $warning_type, 'post_id' => $post_id, 'title' => $warning_type == 0 ? $warning_title : '', 'points' => $warning_points, 'date_issued' => $now, 'date_expire' => $expiration, 'issued_by' => $panther_user['id'], 'note_admin' => $admin_note, 'note_post' => isset($message) ? $message : '', 'note_pm' => $note_pm);
     $db->insert('warnings', $insert);
     // If private messaging system is enabled
     if ($panther_config['o_private_messaging'] == '1') {
         $insert = array('subject' => $pm_subject, 'poster' => $panther_user['username'], 'poster_id' => $panther_user['id'], 'num_replies' => 0, 'last_post' => $now, 'last_poster' => $panther_user['username']);
         $db->insert('conversations', $insert);
         $new_tid = $db->lastInsertId($db->prefix . 'conversations');
         $insert = array('poster' => $panther_user['username'], 'poster_id' => $panther_user['id'], 'poster_ip' => get_remote_address(), 'message' => $pm_message, 'hide_smilies' => 0, 'posted' => $now, 'topic_id' => $new_tid);
         $db->insert('messages', $insert);
         $new_pid = $db->lastInsertId($db->prefix . 'messages');
         $update = array('first_post_id' => $new_pid, 'last_post_id' => $new_pid);
         $data = array(':tid' => $new_tid);
         $db->update('conversations', $update, 'id=:tid', $data);
         $insert = array('topic_id' => $new_tid, 'user_id' => $user_id);
         $db->insert('pms_data', $insert);
         $insert = array('topic_id' => $new_tid, 'user_id' => $panther_user['id'], 'viewed' => 1, 'deleted' => 1);
         $db->insert('pms_data', $insert);
         $data = array(':id' => $user_id);
         $db->run('UPDATE ' . $db->prefix . 'users SET num_pms=num_pms+1 WHERE id=:id', $data);
         if ($pm_notify == '1') {
             $info = array('message' => array('<username>' => $username, '<sender>' => $panther_user['username'], '<message>' => $pm_message, '<pm_title>' => $subject, '<message_url>' => panther_link($panther_url['pms_topic'], array($new_pid))));
             $mail_tpl = $mailer->parse(PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/mail_templates/new_pm.tpl', $info);
             $mailer->send($email, $mail_tpl['subject'], $mail_tpl['message']);
开发者ID:mtechnik,项目名称:pantherforum,代码行数:31,代码来源:warnings.php


示例12: pun_csrf_token

function pun_csrf_token()
{
    global $pun_user;
    static $token;
    if (!isset($token)) {
        $token = pun_hash($pun_user['id'] . $pun_user['password'] . pun_hash(get_remote_address()));
    }
    return $token;
}
开发者ID:HawesDomingue,项目名称:mechanic-watson,代码行数:9,代码来源:functions.php


示例13: message

     } else {
         message(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
     }
     // Prune "old" search results
     $old_searches = array();
     $result = $db->query('SELECT ident FROM ' . $db->prefix . 'online') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
     if ($db->num_rows($result)) {
         while ($row = $db->fetch_row($result)) {
             $old_searches[] = '\'' . $db->escape($row[0]) . '\'';
         }
         $db->query('DELETE FROM ' . $db->prefix . 'search_cache WHERE ident NOT IN(' . implode(',', $old_searches) . ')') or error('Unable to delete search results', __FILE__, __LINE__, $db->error());
     }
     // Fill an array with our results and search properties
     $temp = serialize(array('search_ids' => serialize($search_ids), 'num_hits' => $num_hits, 'sort_by' => $sort_by, 'sort_dir' => $sort_dir, 'show_as' => $show_as, 'search_type' => $search_type));
     $search_id = mt_rand(1, 2147483647);
     $ident = $luna_user['is_guest'] ? get_remote_address() : $luna_user['username'];
     $db->query('INSERT INTO ' . $db->prefix . 'search_cache (id, ident, search_data) VALUES(' . $search_id . ', \'' . $db->escape($ident) . '\', \'' . $db->escape($temp) . '\')') or error('Unable to insert search results', __FILE__, __LINE__, $db->error());
     if ($search_type[0] != 'action') {
         $db->end_transaction();
         $db->close();
         // Redirect the user to the cached result page
         header('Location: search.php?search_id=' . $search_id);
         exit;
     }
 }
 $forum_actions = array();
 // If we're on the new posts search, display a "mark all as read" link
 if (!$luna_user['is_guest'] && $search_type[0] == 'action' && $search_type[1] == 'show_new') {
     $forum_actions[] = '<a href="misc.php?action=markread">' . __('Mark as read', 'luna') . '</a>';
 }
 // Fetch results to display
开发者ID:BogusCurry,项目名称:Luna,代码行数:31,代码来源:search.php


示例14: luna_csrf_token

function luna_csrf_token()
{
    global $luna_user;
    return luna_hash($luna_user['id'] . luna_hash(get_remote_address()));
}
开发者ID:KristopherGBaker,项目名称:Luna,代码行数:5,代码来源:functions.php


示例15: luna_csrf_token

function luna_csrf_token()
{
    global $luna_user;
    static $token;
    if (!isset($token)) {
        return luna_hash($luna_user['id'] . $luna_user['password'] . luna_hash(get_remote_address()));
    }
}
开发者ID:istrwei,项目名称:Luna,代码行数:8,代码来源:functions.php


示例16: array

 }
 $replace = array($panther_user['username'], get_title($panther_user), strip_tags($panther_config['o_board_title']), strip_tags($panther_config['o_board_desc']), '[email]' . $panther_config['o_admin_email'] . '[/email]', '[email]' . $panther_config['o_webmaster_email'] . '[/email]', '[email]' . $panther_user['email'] . '[/email]', $panther_user['num_posts'], '[url]' . $panther_user['url'] . '[/url]', $panther_user['realname']);
 $search = array('{username}', '{user_title}', '{board_title}', '{board_desc}', '{admin_email}', '{webmaster_email}', '{user_email}', '{user_posts}', '{website}', '{location}', '{real_name}');
 $data = $update = array();
 $moderation['reply_message'] = str_replace($search, $replace, $moderation['reply_message']);
 if ($moderation['close'] != '2') {
     $update['closed'] = $moderation['close'];
 }
 if ($moderation['stick'] != '2') {
     $update['sticky'] = $moderation['stick'];
 }
 if ($moderation['archive'] != '2') {
     $update['archived'] = $moderation['archive'];
 }
 if ($moderation['reply_message'] != '') {
     $insert = array('poster' => $panther_user['username'], 'poster_id' => $panther_user['id'], 'poster_ip' => get_remote_address(), 'message' => $moderation['reply_message'], 'hide_smilies' => 0, 'posted' => time(), 'topic_id' => $tid);
     $db->insert('posts', $insert);
     $new_pid = $db->lastInsertId($db->prefix . 'posts');
     require PANTHER_ROOT . 'include/search_idx.php';
     update_search_index('post', $new_pid, $moderation['reply_message']);
 }
 if ($moderation['move'] != '0') {
     $update['forum_id'] = $moderation['move'];
     if ($moderation['leave_redirect'] == '1') {
         // Fetch info for the redirect topic
         $data = array(':id' => $tid);
         $ps = $db->select('topics', 'poster, subject, posted, last_post, forum_id', $data, 'id=:id');
         $moved_to = $ps->fetch();
         // Create the redirect topic
         $insert = array('poster' => $moved_to['poster'], 'subject' => $moderation['add_start'] . $moved_to['subject'] . $moderation['add_end'], 'posted' => $moved_to['posted'], 'last_post' => $moved_to['last_post'], 'moved_to' => $tid, 'forum_id' => $moved_to['forum_id']);
         $db->insert('topics', $insert);
开发者ID:mtechnik,项目名称:pantherforum,代码行数:31,代码来源:moderate.php


示例17: insert_default_users

 public static function insert_default_users($username, $password, $email, $language, $style)
 {
     global $db, $db_type;
     $now = time();
     $db->start_transaction();
     // Insert guest and first admin user
     $db->query('INSERT INTO ' . $db->prefix . 'users (group_id, username, password, email) VALUES(3, \'' . $db->escape(__('Guest', 'luna')) . '\', \'' . $db->escape(__('Guest', 'luna')) . '\', \'' . $db->escape(__('Guest', 'luna')) . '\')') or error('Unable to add guest user. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
     $db->query('INSERT INTO ' . $db->prefix . 'users (group_id, username, password, email, language, style, num_posts, last_post, registered, registration_ip, last_visit) VALUES(1, \'' . $db->escape($username) . '\', \'' . luna_hash($password) . '\', \'' . $email . '\', \'' . $db->escape($language) . '\', \'' . $db->escape($style) . '\', 1, ' . $now . ', ' . $now . ', \'' . $db->escape(get_remote_address()) . '\', ' . $now . ')') or error('Unable to add administrator user. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
     $db->end_transaction();
 }
开发者ID:KristopherGBaker,项目名称:Luna,代码行数:10,代码来源:luna_install.php


示例18: error

    }
    // Check that the username (or a too similar username) is not already registered
    $result = $db->query('SELECT username FROM ' . $db->prefix . 'users WHERE username=\'' . $db->escape($username) . '\' OR username=\'' . $db->escape(preg_replace('/[^\\w]/', '', $username)) . '\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
    if ($db->num_rows($result)) {
        $busy = $db->result($result);
        message_backstage(__('Someone is already registered with the username', 'luna') . ' ' . luna_htmlspecialchars($busy) . '. ' . __('The username you entered is too similar. The username must differ from that by at least one alphanumerical character (a-z or 0-9). Please choose a different username.', 'luna'));
    }
    $timezone = '0';
    $language = $luna_config['o_default_lang'];
    $email_setting = intval(1);
    // Insert the new user into the database. We do this now to get the last inserted id for later use.
    $now = time();
    $intial_group_id = $_POST['random_pass'] == '0' ? $luna_config['o_default_user_group'] : LUNA_UNVERIFIED;
    $password_hash = luna_hash($password);
    // Add the user
    $db->query('INSERT INTO ' . $db->prefix . 'users (username, group_id, password, email, email_setting, php_timezone, language, style, registered, registration_ip, last_visit) VALUES(\'' . $db->escape($username) . '\', ' . $intial_group_id . ', \'' . $password_hash . '\', \'' . $email1 . '\', ' . $email_setting . ', ' . $timezone . ' , \'' . $language . '\', \'' . $luna_config['o_default_style'] . '\', ' . $now . ', \'' . get_remote_address() . '\', ' . $now . ')') or error('Unable to create user', __FILE__, __LINE__, $db->error());
    $new_uid = $db->insert_id();
    // Must the user verify the registration?
    if ($_POST['random_pass'] == '1') {
        // Validate e-mail
        require LUNA_ROOT . 'include/email.php';
        // Load the "welcome" template
        $mail_tpl = trim(__('Subject: Welcome to <board_title>!

Thank you for registering in the forums at <base_url>. Your account details are:

Username: <username>
Password: <password>

Login at <login_url> to activate the account.
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:30,代码来源:tools.php


示例19: load_admin_nav


//.........这里部分代码省略.........
    print luna_htmlspecialchars($luna_user['username']);
    ?>
 </span><?php 
    echo draw_user_avatar($luna_user['id'], true, 'avatar');
    ?>
 <span class="fa fa-fw fa-angle-down"></span>
					</a>
					<ul class="dropdown-menu">
						<li><a href="../profile.php?id=<?php 
    echo $luna_user['id'];
    ?>
"><?php 
    _e('Profile', 'luna');
    ?>
</a></li>
						<li><a href="../settings.php?id=<?php 
    echo '' . $luna_user['id'];
    ?>
"><?php 
    _e('Settings', 'luna');
    ?>
</a></li>
						<li class="divider"></li>
						<li><a href="../help.php"><?php 
    _e('Help', 'luna');
    ?>
</a></li>
						<li><a href="http://getluna.org"><?php 
    _e('Support', 'luna');
    ?>
</a></li>
						<li class="divider"></li>
						<li><a href="../login.php?action=out&amp;id=<?php 
    echo '' . $luna_user['id'] . '&amp;csrf_token=' . luna_hash($luna_user['id'] . luna_hash(get_remote_address()));
    ?>
"><?php 
    _e('Logout', 'luna');
    ?>
</a></li>
					</ul>
				</li>
			</ul>
		</div>
	</div>
</nav>
<div class="jumbotron jumboheader">
	<div class="container">
		<div class="row">
			<h2 class="hidden-xs">
				<?php 
    echo $page_title;
    if ($luna_config['o_update_ring'] > 1) {
        echo '<span class="pull-right" style="font-size: 70%;">Core ' . Version::FORUM_CORE_VERSION . '</span>';
    }
    ?>
			</h2>
			<?php 
    if ($section == 'backstage') {
        ?>
			<ul class="nav nav-tabs" role="tablist">
				<li<?php 
        if ($page == 'index') {
            echo ' class="active"';
        }
        ?>
><a href="index.php"><span class="fa fa-fw fa-tachometer"></span><span class="hidden-xs"> <?php 
开发者ID:BogusCurry,项目名称:Luna,代码行数:67,代码来源:backstage_functions.php


示例20: array

             $update = array('group_id' => $panther_user['g_promote_next_group']);
             $data = array('id' => $panther_user['id']);
             $db->update('users', $update, 'id=:id', $data);
         }
     } else {
         $update = array('last_post' => $now);
         $data = array(':id' => $panther_user['id']);
         $db->update('users', $update, 'id=:id', $data);
     }
     // Topic tracking stuff...
     $tracked_topics = get_tracked_topics();
     $tracked_topics['topics'][$new_tid] = time();
     set_tracked_topics($tracked_topics);
 } else {
     $update = array('last_post' => $now);
     $data = array(':ident' => get_remote_address());
     $db->update('online', $update, 'ident=:ident', $data);
 }
 ($hook = get_extensions('post_after_posted')) ? eval($hook) : null;
 if ($add_poll) {
     $redirect = panther_link($panther_url['poll_add'], array($new_tid));
 }
 switch (true) {
     case $fid && $topic_approve == '0':
         $redirect_lang = $lang_post['Topic moderation redirect'];
         if (!isset($redirect)) {
             $redirect = panther_link($panther_url['forum'], array($cur_posting['id'], url_friendly($subject)));
         }
         break;
     case $tid && $post_approve == '0':
         $redirect_lang = $lang_post['Post moderation redirect'];
开发者ID:mtechnik,项目名称:pantherforum,代码行数:31,代码来源:post.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_remote_file函数代码示例发布时间:2022-05-15
下一篇:
PHP get_remote_addr函数代码示例发布时间: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