本文整理汇总了PHP中Get::IP方法的典型用法代码示例。如果您正苦于以下问题:PHP Get::IP方法的具体用法?PHP Get::IP怎么用?PHP Get::IP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Get
的用法示例。
在下文中一共展示了Get::IP方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: time
$post = Date::format($article->time, 'Y-m-d-H-i-s');
$id = (int) time();
$parent = Request::post('parent');
$P = array('data' => $request);
$name = strip_tags($request['name']);
$email = Text::parse($request['email'], '->broken_entity');
$url = isset($request['url']) ? $request['url'] : false;
$parser = strip_tags(Request::post('content_type', $config->html_parser));
$message = $request['message'];
$field = Request::post('fields', array());
include DECK . DS . 'workers' . DS . 'task.field.1.php';
// Temporarily disallow image(s) in comment to prevent XSS
$message = strip_tags($message, '<br><img>' . ($parser === 'HTML' ? '<a><abbr><b><blockquote><code><del><dfn><em><i><ins><p><pre><span><strong><sub><sup><time><u><var>' : ""));
$message = preg_replace('#(\\!\\[.*?\\]\\(.*?\\))#', '`$1`', $message);
$message = preg_replace('#<img(\\s[^<>]*?)>#', '<img$1>', $message);
Page::header(array('Name' => $name, 'Email' => $email, 'URL' => $url, 'Status' => Guardian::happy() ? 'pilot' : 'passenger', 'Content Type' => $parser, 'Fields' => !empty($field) ? Text::parse($field, '->encoded_json') : false, 'UA' => Get::UA(), 'IP' => Get::IP()))->content($message)->saveTo(RESPONSE . DS . $post . '_' . Date::format($id, 'Y-m-d-H-i-s') . '_' . ($parent ? Date::format($parent, 'Y-m-d-H-i-s') : '0000-00-00-00-00-00') . $extension);
Notify::success(Config::speak('notify_success_submitted', $speak->comment));
if ($extension === '.hold') {
Notify::info($speak->notify_info_comment_moderation);
}
Weapon::fire('on_comment_update', array($P, $P));
Weapon::fire('on_comment_construct', array($P, $P));
if ($config->comment_notification_email) {
$mail = '<p>' . Config::speak('comment_notification', $article->url . '#' . sprintf($comment_id, Date::format($id, 'U'))) . '</p>';
$mail .= '<p><strong>' . $name . ':</strong></p>';
$mail .= $parser !== 'HTML' ? Text::parse($message, '->html') : $message;
$mail .= '<p>' . Date::format($id, 'Y/m/d H:i:s') . '</p>';
// Sending email notification ...
if (!Guardian::happy()) {
if (Notify::send($request['email'], $config->author_email, $speak->comment_notification_subject, $mail, 'comment:')) {
Weapon::fire('on_comment_notification_construct', array($request, $config->author_email, $speak->comment_notification_subject, $mail));
示例2: array
<?php
if ($config->page_type === 'article' && Request::method('post')) {
if (!isset($_POST['fields'])) {
$_POST['fields'] = array();
}
Mecha::extend($_POST['fields'], array('user_ip' => array('type' => 'hidden', 'value' => Get::IP()), 'user_agent' => array('type' => 'hidden', 'value' => Get::UA())));
// Block comment by IP address
$fucking_words = explode(',', $config->keywords_spam);
foreach ($fucking_words as $spam) {
if ($fuck = trim($spam)) {
if (Get::IP() === $fuck) {
Notify::warning($speak->notify_warning_intruder_detected . ' <strong class="text-error pull-right">' . $fuck . '</strong>');
break;
}
}
}
}