當前位置: 首頁>>代碼示例>>PHP>>正文


PHP helper::getip方法代碼示例

本文整理匯總了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'];
 }
開發者ID:cranefly,項目名稱:crane,代碼行數:14,代碼來源:url_rewrite.model.php

示例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']);
 }
開發者ID:cranefly,項目名稱:crane,代碼行數:19,代碼來源:user.model.php

示例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'] . '"}');
}
開發者ID:cranefly,項目名稱:crane,代碼行數:43,代碼來源:comment.php

示例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();
     }
 }
開發者ID:cranefly,項目名稱:crane,代碼行數:20,代碼來源:helper.class.php

示例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再綁定用戶");
}
開發者ID:cranefly,項目名稱:crane,代碼行數:29,代碼來源:user.php

示例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":"添加會員失敗,請核實後再添加"}');
    }
}
開發者ID:cranefly,項目名稱:crane,代碼行數:79,代碼來源:user_list.php

示例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":"係統錯誤"}');
    }
}
開發者ID:cranefly,項目名稱:crane,代碼行數:21,代碼來源:function.php


注:本文中的helper::getip方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。