本文整理汇总了PHP中helper::getip方法的典型用法代码示例。如果您正苦于以下问题:PHP helper::getip方法的具体用法?PHP helper::getip怎么用?PHP helper::getip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helper
的用法示例。
在下文中一共展示了helper::getip方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
public function insert($content)
{
$params['aid'] = isset($_SESSION['admin']['admin_id']) ? $_SESSION['admin']['admin_id'] : "0";
$params['aname'] = $_SESSION['admin']["aname"];
$params['create_time'] = time();
$params['aip'] = helper::getip();
$params['content'] = $params['aname'] . "=>" . $content;
$res = $this->dbm->single_insert($this->table, $params);
if (!empty($res['error'])) {
return;
//die('{"code":"100","msg":"系统错误"}');
}
return $res['autoid'];
}
示例2: insert
public function insert($params)
{
if (isset($params['user_id'])) {
unset($params['user_id']);
}
if (isset($params['reupass'])) {
unset($params['reupass']);
}
//初始默认数据
$params['ustate'] = 0;
$params['reg_date'] = time();
$params['reg_ip'] = helper::getip();
$params['upoint'] = 0;
$res = $this->dbm->single_insert($this->table, $params);
if ($res['autoid'] > 0) {
return res(0, $res['autoid']);
}
return res(100, $res['error']);
}
示例3: m__commentadd
function m__commentadd()
{
global $dbm, $c;
$fields = array();
if (isset($_SESSION['postdata']['comment']) && time() - $_SESSION['postdata']['comment'] < 60) {
die('{"code":"101","msg":"歇会再评论吧"}');
}
if (trim($_POST['comment']) == '') {
die('{"code":"1","msg":"发表内容不能为空"}');
}
$code = md5(strtoupper($_POST['code']));
if ($code != $_SESSION['feedback']) {
die('{"code":"140","msg":"验证码错误"}');
}
if (!isset($_POST['id']) || !is_numeric($_POST['id'])) {
die('{"code":"202","msg":"id号出错"}');
}
if (!isset($_POST['parent_id']) || !is_numeric($_POST['parent_id'])) {
die('{"code","203","msg":"上级ID出错"}');
}
$fields['info_id'] = intval($_POST['id']);
$fields['parent_id'] = intval($_POST['parent_id']);
$content = filter_words($_POST['comment']);
$fields['content'] = helper::utf8_substr($content, 0, 300);
$user = filter_words($_POST['user'], 'user');
// 匿名用户名存cookie
if (!isset($_COOKIE['uname']) && empty($_COOKIE['uname'])) {
$_COOKIE['uname'] = $user;
setcookie('uname', $user, time() + 3600, '/');
}
$fields['uname'] = helper::utf8_substr($user, 0, 10);
$fields['date_add'] = time();
$fields['ip'] = helper::getip();
if ($fields['parent_id'] != 0) {
$ress = $dbm->query_update("UPDATE " . TB_PREFIX . "comment SET son = son + 1 WHERE comment_id = '{$fields['parent_id']}'");
}
$res = $dbm->single_insert(TB_PREFIX . 'comment', $fields);
if (empty($res['error']) && empty($ress['error'])) {
$_SESSION['postdata']['comment'] = time();
die('{"code":"0","msg":"发表成功"}');
}
die('{"code":"1","msg":"发表失败:' . $ress['error'] . '"}');
}
示例4: logs
/**
* 记录文本日志,如果根目录有 logs 目录才会记录
*
* @param $logs_type 日志类型,日志文件名称
* @param $logs_txt 日志内容
*/
public static function logs($logs_type, $logs_txt)
{
// 创建缓存目录
if (!is_dir(dirname(__FILE__) . '/../logs/')) {
return;
}
try {
$fp = fopen(dirname(__FILE__) . '/../logs/' . $logs_type . '_' . date('Y-m-d') . '.log', 'a');
fwrite($fp, date('Y-m-d H:i:s') . ' ' . helper::getip() . ' ' . $logs_txt . ' ' . chr(10));
fclose($fp);
} catch (Exception $e) {
echo $e->getMessage();
}
}
示例5: m__qqbind
function m__qqbind()
{
global $dbm;
$params = array();
if (isset($_SESSION['uid']) || isset($_SESSION['uname'])) {
act_msg('index.php', "你已经登陆了");
}
if (isset($_SESSION['qq']['openid']) && isset($_GET['act']) && $_GET['act'] == 'bind') {
$_SESSION['qq']['nickname'] = isset($_SESSION['qq']['nickname']) ? helper::escape($_SESSION['qq']['nickname']) : '';
//判断用户名是否存在
$params['uname'] = checkuser($_SESSION['qq']['nickname'], $_SESSION['qq']['nickname']);
$params['upass'] = helper::password_encrypt(substr(uniqid(rand()), -6));
$params['reg_date'] = time();
$params['reg_ip'] = helper::getip();
$params['qqid'] = helper::escape($_SESSION['qq']['openid']);
$res = $dbm->single_insert(TB_PREFIX . "user_list", $params);
//清除QQ登录记录
unset($_SESSION['qq']);
if (empty($res['error']) && $res['autoid'] > 0) {
$_SESSION['uid'] = $res['autoid'];
$_SESSION['uname'] = $params['uname'];
//清除QQ登录记录
act_msg("index.php?tpl=ucenter", "登录成功!");
} else {
act_msg("index.php?tpl=index", "登录失败!");
}
}
//act_msg('index.php?tpl=index', "请登陆QQ再绑定用户");
}
示例6: m__edit
/**
* 获取编辑或添加会员
*/
function m__edit()
{
global $dbm;
check_level("E0102");
$params = array();
foreach ($_POST as $k => $v) {
$_POST[$k] = helper::escape($v, 1);
}
if (!is_numeric($_POST['user_id'])) {
die('{"code":"210","msg":"会员UID必须是数字"}');
}
// 验证会员信息是否合法
if (empty($_POST['uname'])) {
die('{"code":"210","msg":"会员名不能为空"}');
}
$rules = "/\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*/";
if (trim($_POST['uemail']) != '' && !preg_match($rules, $_POST['uemail'])) {
die('{"code":"270","msg":"请正确填写邮箱格式!"}');
}
//if (!preg_match('~^[A-Za-z][A-Za-z]*[a-z0-9_]*$~', $_POST['uname'])) die('{"code":"230","msg":"会员名必须以字母开头,只允许字母、数字、下划线"}');
$params['uname'] = $_POST['uname'];
$params['uemail'] = trim($_POST['uemail']);
$params['uphone'] = isset($_POST['uphone']) && trim($_POST['uphone']) != '' ? trim($_POST['uphone']) : '';
$params['uqq'] = isset($_POST['uqq']) && trim($_POST['uqq']) != '' ? trim($_POST['uqq']) : '';
$params['gender'] = intval($_POST['gender']);
$params['reg_ip'] = helper::getip();
$params['reg_date'] = time();
$params['ustate'] = isset($_POST['ustate']) ? intval($_POST['ustate']) : 0;
$params['upoint'] = intval($_POST['upoint']);
if (intval($_POST['user_id']) > 0) {
if (isset($_POST['upass']) && $_POST['upass'] != '') {
if (strlen($_POST['upass']) < 5 || strlen($_POST['upass']) > 20) {
die('{"code":"280","msg":"密码不符合要求,必须5到20字符"}');
}
if ($_POST['upass'] != $_POST['re_pass']) {
die('{"code":"270","msg":"两次密码不一致"}');
}
$params['upass'] = helper::password_encrypt($_POST['upass']);
}
$where = " user_id ='" . $_POST['user_id'] . "'";
$res = $dbm->single_update(TB_PREFIX . "user_list", $params, $where);
if (empty($res['error'])) {
logs("账号编辑成功,账号ID为:{$_POST['user_id']}");
die('{"code":"0","msg":"操作成功"}');
}
logs("编辑账号失败,请核实后再添加,账号ID为:{$_POST['user_id']}");
die('{"code":"280","msg":"编辑账号失败,请核实后再添加"}');
} else {
// 添加会员
$where = " uname='" . $_POST['uname'] . "'";
$a = $dbm->single_query(array('where' => $where, 'table_name' => TB_PREFIX . "user_list"));
if (count($a['list']) > 0) {
die('{"code":"260","msg":"会员名不能重复"}');
}
if (empty($_POST['upass'])) {
die('{"code":"220","msg":"密码不能为空"}');
}
if (strlen($_POST['upass']) < 5) {
die('{"code":"240","msg":"密码过于简单,必须5到20字符"}');
}
if (strlen($_POST['upass']) > 20) {
die('{"code":"250","msg":"密码超出限定的20字符长度,"}');
}
if ($_POST['upass'] != $_POST['re_pass']) {
die('{"code":"270","msg":"两次密码不一致"}');
}
$params['upass'] = helper::password_encrypt($_POST['upass']);
$res = $dbm->single_insert(TB_PREFIX . "user_list", $params);
if ($res['autoid'] > 0) {
logs("添加会员成功,会员ID为:{$_POST['uname']}");
die('{"code":"0","msg":"添加会员成功"}');
}
logs("添加会员失败,请核实后再添加,会员ID为:{$_POST['uname']}");
die('{"code":"270","msg":"添加会员失败,请核实后再添加"}');
}
}
示例7: logs
/**
* 操作日志记录
* 每进行一次操作都需要记录一次
*
* @param $content 要记录的内容
*/
function logs($content = '')
{
global $dbm;
$admin_id = isset($_SESSION['admin']['admin_id']) ? $_SESSION['admin']['admin_id'] : "0";
$params['aid'] = $admin_id;
$params['aname'] = $_SESSION['admin']["aname"];
$params['create_time'] = time();
$params['aip'] = helper::getip();
$params['content'] = $params['aname'] . "=>" . $content;
$log_res = $dbm->single_insert(TB_PREFIX . "log_list", $params);
if (!empty($log_res['error'])) {
// return ;
die('{"code":"100","msg":"系统错误"}');
}
}