本文整理汇总了PHP中clientIP函数的典型用法代码示例。如果您正苦于以下问题:PHP clientIP函数的具体用法?PHP clientIP怎么用?PHP clientIP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clientIP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle_start
/**
* Do the magic
*/
function handle_start(&$event, $param)
{
global $conf;
$bans = @file($conf['cachedir'] . '/ipbanplugin.txt');
$client = clientIP(true);
if (is_array($bans)) {
foreach ($bans as $ban) {
$fields = explode("\t", $ban);
if ($fields[0] == $client) {
$text = $this->locale_xhtml('banned');
$text .= sprintf('<p>' . $this->getLang('banned') . '</p>', hsc($client), strftime($conf['dformat'], $fields[1]), hsc($fields[3]));
$title = $this->getLang('denied');
header("HTTP/1.0 403 Forbidden");
echo <<<EOT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>{$title}</title></head>
<body style="font-family: Arial, sans-serif">
<div style="width:60%; margin: auto; background-color: #fcc;
border: 1px solid #faa; padding: 0.5em 1em;">
{$text}
</div>
</body>
</html>
EOT;
exit;
}
}
}
}
示例2: userID
/**
* Current user identifier
*
* @return string
*/
public function userID()
{
if (isset($_SERVER['REMOTE_USER'])) {
return $_SERVER['REMOTE_USER'];
}
return clientIP(true);
}
示例3: __construct
/**
* Constructor.
*/
function __construct($debug, $settings)
{
global $conf;
// call parent constructor
$this->debugClass = $debug;
$this->settings = $settings;
parent::__construct();
$this->timeout = 60;
//max. 25 sec
$this->headers['If-Modified-Since'] = substr(gmdate('r', 0), 0, -5) . 'GMT';
$this->status = -1;
$this->debug = true;
if ($this->settings->cookie == null) {
$this->_debug("Has to re-authenticate request.");
if (!$this->authenticate()) {
$this->_debug("Trying other Authentication (auth.php):", auth_setup() && $this->authenticate(true) ? 'authenticated' : 'not authenticated');
// Try again.
}
$this->_debug("Using Authentication:", array('user' => $this->user, 'password' => '*****'));
} else {
$this->cookies = $this->settings->cookie;
}
$this->headers['X-Real-Ip'] = clientIP(true);
$this->headers['Accept-Encoding'] = $_SERVER['HTTP_ACCEPT_ENCODING'];
$this->headers['Accept-Charset'] = $_SERVER['HTTP_ACCEPT_CHARSET'];
$this->agent = $_SERVER['HTTP_USER_AGENT'];
}
示例4: action_index
public function action_index()
{
$this->template = 'profile';
$loginHistory = ORM::factory('User_LoginHistory')->getAll($this->user['id']);
$ipAddress = getAddressByIP(clientIP());
$currentLogin = $ipAddress['country'] . $ipAddress['area'] . $ipAddress['region'] . $ipAddress['city'] . $ipAddress['county'] . $ipAddress['isp'];
$array = array('loginHistory' => $loginHistory, 'currentLogin' => $currentLogin);
$this->data = $array;
}
示例5: __construct
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Request $request)
{
$browser = getBrowserInfo();
$this->request = $request->all();
array_set($this->request, 'name', $request->user()->name);
array_set($this->request, 'ip', clientIP());
array_set($this->request, 'browser', $browser['browser']);
array_set($this->request, 'platform', $browser['platform']);
}
示例6: handle
/**
* Handle the event.
*
* @param Events $event
* @return void
*/
public function handle(UserLoggedFailed $event)
{
//dd($event->request->user()->id);
$data = ['ip' => clientIP(), 'user' => $event->request->input('email'), 'password' => $event->request->input('password'), 'browser' => $_SERVER['HTTP_USER_AGENT']];
Mail::queue('emails.loggederror', $data, function ($message) {
$message->subject('Failed Logged In');
$message->from('no-reply@giligansrestaurant.com', 'GI App - Cashier');
$message->to('giligans.app@gmail.com');
});
}
示例7: handle
/**
* Handle the event.
*
* @param Events $event
* @return void
*/
public function handle(GoogleUserLoggedIn $event)
{
//dd($event->request->user()->id);
$data = ['ip' => clientIP(), 'user' => $event->email . ' via Google', 'lat' => '', 'lng' => '', 'browser' => $_SERVER['HTTP_USER_AGENT']];
Mail::queue('emails.loggedin', $data, function ($message) {
$message->subject('User Logged In');
$message->from('no-reply@giligansrestaurant.com', 'GI App - Cashier');
$message->to('giligans.app@gmail.com');
});
}
示例8: handle
/**
* Handle the event.
*
* @param Events $event
* @return void
*/
public function handle(UserLoggedIn $event)
{
//dd($event->request->user()->id);
$data = ['ip' => clientIP(), 'user' => $event->request['username'], 'browser' => $_SERVER['HTTP_USER_AGENT']];
Mail::send('emails.loggedin', $data, function ($message) use($data) {
$message->subject('Manager Logged In');
$message->from('no-reply@giligansrestaurant.com', 'GI App - Manager');
$message->to('giligans.app@gmail.com');
$message->to('freakyash_02@yahoo.com');
});
}
示例9: handle
/**
* Handle the event.
*
* @param Events $event
* @return void
*/
public function handle(UserChangePassword $event)
{
//dd($event->request->user()->id);
$data = ['ip' => clientIP(), 'user' => $event->request->user()->name, 'from' => $event->request->input('passwordo'), 'to' => $event->request->input('password')];
\Mail::queue('emails.change_password', $data, function ($message) {
$message->subject('User Change Password');
$message->from('no-reply@giligansrestaurant.com', 'GI App - Cashier');
$message->to('giligans.app@gmail.com');
$message->to('freakyash_02@yahoo.com');
});
}
示例10: handle
/**
* Handle the event.
*
* @param Events $event
* @return void
*/
public function handle(UserLoggedIn $event)
{
$data = ['ip' => clientIP(), 'user' => $event->request['username'], 'lat' => $event->request['lat'], 'lng' => $event->request['lng'], 'browser' => $_SERVER['HTTP_USER_AGENT']];
/*
app('pusher')->trigger('gi.cashier', 'auth', [
'title'=>'Giligan\'s Cashier',
'message'=> $data['user'].' successfully logged in at this IP: '.clientIP()
]);
*/
Mail::queue('emails.loggedin', $data, function ($message) {
$message->subject('User Logged In');
$message->from('no-reply@giligansrestaurant.com', 'GI App - Cashier');
$message->to('giligans.app@gmail.com');
});
}
示例11: saveLinkback
public function saveLinkback($type, $title, $sourceUri, $excerpt, $id)
{
$comment = array('source' => $type, 'name' => $title, 'web' => $sourceUri, 'text' => $excerpt, 'pid' => md5($id), 'page' => $id, 'subscribe' => null, 'status' => 'hidden', 'ip' => clientIP(true));
$sqlitehelper = plugin_load('helper', 'blogtng_sqlite');
$query = 'SELECT web, source FROM comments WHERE pid = ?';
$resid = $sqlitehelper->query($query, $comment['pid']);
if ($resid === false) {
return false;
}
$comments = $sqlitehelper->res2arr($resid);
foreach ($comments as $c) {
if ($c['web'] === $comment['web'] && $c['source'] === $comment['source']) {
return false;
}
}
$chelper = plugin_load('helper', 'blogtng_comments');
$chelper->save($comment);
return true;
}
示例12: updateMeta
function updateMeta($id, $parid, $lastrev, $revert = -1)
{
$meta = unserialize(io_readFile(metaFN($id, '.translateHistory'), false));
for ($i = 0; $i < count($meta['current']); $i++) {
if (!empty($meta['current'][$i]['changed'])) {
# This paragraph was not changed in the last revision,
# copy last change entry only
$meta[$lastrev][$i]['changed'] = $meta['current'][$i]['changed'];
} else {
# This paragraph has been changed, copy full entry
# and set revision pointer
$meta[$lastrev][$i] = $meta['current'][$i];
$meta['current'][$i]['changed'] = $lastrev;
}
}
$revert = intval($revert);
if ($revert < 0) {
# Saving new data, reset entry for changed paragraph
$meta['current'][$parid]['changed'] = '';
$meta['current'][$parid]['ip'] = clientIP(true);
$meta['current'][$parid]['user'] = isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] : '';
$meta['current'][$parid]['reviews'] = array();
} else {
# Reverting old revision, restore metadata of reverted page
for ($i = 0; $i < count($meta['current']); $i++) {
if (empty($meta[$revert][$i]['changed'])) {
# Paragraph last changed in the reverted
# revision
$meta['current'][$i] = $meta[$revert][$i];
$meta['current'][$i]['changed'] = $revert;
} else {
# Paragraph last changed in even earlier
# revision
$tmp = $meta[$revert][$i]['changed'];
$meta['current'][$i] = $meta[$tmp][$i];
$meta['current'][$i]['changed'] = $tmp;
}
}
}
# Save metadata
io_saveFile(metaFN($id, '.translateHistory'), serialize($meta));
io_saveFile(metaFN($id, '.translate'), serialize($meta['current']));
}
示例13: action_login
public function action_login()
{
$this->auto_render = FALSE;
if ($this->request->is_ajax()) {
$post = $this->request->post();
$success = Auth_ORM::instance()->login($post['username'], $post['password']);
if ($success) {
$loginHistory = ORM::factory('User_LoginHistory');
$loginHistory->uid = $success;
$loginHistory->ip = clientIP();
$loginHistory->userAgent = $_SERVER['HTTP_USER_AGENT'];
$loginHistory->created = time();
$loginHistory->updated = time();
$loginHistory->save();
jsonReturn(1001, '登陆成功', '/manage/dashboard/index');
} else {
jsonReturn(1800);
}
}
$this->response->body(View::factory($this->theme . 'login', array('registerUrl' => '/register', 'findPasswordUrl' => '/findPassword')));
}
示例14: addMediaLogEntry
/**
* Add's an entry to the media changelog
*
* @author Michael Hamann <michael@content-space.de>
* @author Andreas Gohr <andi@splitbrain.org>
* @author Esther Brunner <wikidesign@gmail.com>
* @author Ben Coburn <btcoburn@silicodon.net>
*/
function addMediaLogEntry($date, $id, $type = DOKU_CHANGE_TYPE_EDIT, $summary = '', $extra = '', $flags = null)
{
global $conf;
$id = cleanid($id);
if (!$date) {
$date = time();
}
//use current time if none supplied
$remote = clientIP(true);
$user = $_SERVER['REMOTE_USER'];
$strip = array("\t", "\n");
$logline = array('date' => $date, 'ip' => $remote, 'type' => str_replace($strip, '', $type), 'id' => $id, 'user' => $user, 'sum' => utf8_substr(str_replace($strip, '', $summary), 0, 255), 'extra' => str_replace($strip, '', $extra));
// add changelog lines
$logline = implode("\t", $logline) . "\n";
io_saveFile($conf['media_changelog'], $logline, true);
//global media changelog cache
io_saveFile(mediaMetaFN($id, '.changes'), $logline, true);
//media file's changelog
}
示例15: ajax_draftdel
/**
* Delete a draft
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function ajax_draftdel()
{
$id = cleanID($_REQUEST['id']);
if (empty($id)) {
return;
}
$client = $_SERVER['REMOTE_USER'];
if (!$client) {
$client = clientIP(true);
}
$cname = getCacheName($client . $id, '.draft');
@unlink($cname);
}