本文整理匯總了PHP中logger::getip方法的典型用法代碼示例。如果您正苦於以下問題:PHP logger::getip方法的具體用法?PHP logger::getip怎麽用?PHP logger::getip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類logger
的用法示例。
在下文中一共展示了logger::getip方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: logKill
/**
* Log a new kill.
*
* @param integer $killid
* @param string $note
*/
public static function logKill($killid, $note = null)
{
if (is_null($note)) {
$note = "IP:" . logger::getip();
}
$qry = DBFactory::getDBQuery(true);
$qry->execute("INSERT INTO kb3_log (log_kll_id, log_site," . " log_ip_address, log_timestamp) values(" . $killid . ",'" . KB_SITE . "','" . $qry->escape($note) . "', UTC_TIMESTAMP())");
}
示例2: addComment
/**
* Add a comment to a kill.
*
* The kill id is set when the Comments object is constructed.
* @param string $name The name of the comment poster.
* @param string $text The text of the comment to post.
*/
function addComment($name, $text)
{
$comment = $this->bbencode(trim($text));
$name = trim($name);
$qryP = new DBPreparedQuery();
$sql = "INSERT INTO kb3_comments (`kll_id`,`site`, `comment`,`name`,`posttime`, `ip`)\n VALUES (?, ?, ?, ?, ?, ?)";
$qryP->prepare($sql);
$site = KB_SITE;
$date = kbdate('Y-m-d H:i:s');
$ip = logger::getip();
$params = array('isssss', &$this->id_, &$site, &$comment, &$name, &$date, &$ip);
$qryP->bind_params($params);
$qryP->execute();
$id = $qryP->getInsertID();
$this->comments_[] = array('time' => kbdate('Y-m-d H:i:s'), 'name' => $name, 'comment' => $comment, 'id' => $id);
// create comment_added event
event::call('comment_added', $this);
}