当前位置: 首页>>代码示例>>PHP>>正文


PHP ip2int函数代码示例

本文整理汇总了PHP中ip2int函数的典型用法代码示例。如果您正苦于以下问题:PHP ip2int函数的具体用法?PHP ip2int怎么用?PHP ip2int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ip2int函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ip2int

 /**
  * Get an object from cache by IP address
  *
  * Load into cache if necessary
  *
  * @param string IP address
  * @param boolean false if you want to return false on error
  * @param boolean true if function should die on empty/null
  */
 function &get_by_ip($req_ip, $halt_on_error = false, $halt_on_empty = false)
 {
     global $DB, $Debuglog;
     if (!isset($this->ip_index[$req_ip])) {
         // not yet in cache:
         $IP = ip2int($req_ip);
         $SQL = new SQL('Get ID of IP range by IP address');
         $SQL->SELECT('aipr_ID');
         $SQL->FROM('T_antispam__iprange');
         $SQL->WHERE('aipr_IPv4start <= ' . $DB->quote($IP));
         $SQL->WHERE_and('aipr_IPv4end >= ' . $DB->quote($IP));
         $IPRange_ID = $DB->get_var($SQL->get());
         // Get object from IPRangeCache bi ID
         $IPRange = $this->get_by_ID($IPRange_ID, $halt_on_error, $halt_on_empty);
         if ($IPRange) {
             // It is in IPRangeCache
             $this->ip_index[$req_ip] = $IPRange;
         } else {
             // not in the IPRangeCache
             if ($halt_on_error) {
                 debug_die("Requested {$this->objtype} does not exist!");
             }
             $this->ip_index[$req_ip] = false;
         }
     } else {
         $Debuglog->add("Retrieving <strong>{$this->objtype}({$req_ip})</strong> from cache");
     }
     return $this->ip_index[$req_ip];
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:38,代码来源:_iprangecache.class.php

示例2: __construct

 function __construct()
 {
     parent::__construct();
     $this->load->view_path(FCPATH . 'skins/' . skin() . '/views/');
     if (!$this->input->is_cli_request()) {
         $this->output->enable_profiler($this->config->item('debug'));
         if ($this->session->userdata('logged_in')) {
             $this->db->where('id', $this->session->userdata('id'));
             if (!$this->session->userdata('hibernating')) {
                 $this->db->set('last_active', now());
             }
             $this->db->set('last_ip', ip2int($this->input->ip_address()));
             $this->db->update('users');
         }
     }
 }
开发者ID:Razican,项目名称:Space-Settler,代码行数:16,代码来源:SPS_Controller.php

示例3: bSaveEvent

 function bSaveEvent($type, $data = '')
 {
     $type = $type;
     $data = mysql_escape_string($data);
     $request = $_SERVER['REQUEST_URI'];
     $refferer = @$_SERVER['HTTP_REFERER'];
     $agent = $_SERVER['HTTP_USER_AGENT'];
     $ip = ip2int($_SERVER['REMOTE_ADDR']);
     $sessid = session_id();
     $userid = @$_SESSION['user']['id'];
     $sql = "INSERT INTO `" . DB_PREFIX . DB_TBL_EVENTS . "` ( `id` , `type` , `request` , `refferer` , `agent` , `ip` , `sessid`, `userid`, `t`, `data` ) VALUES ( '', '{$type}' , '{$request}', '{$refferer}', '{$agent}', '{$ip}', '{$sessid}', '{$userid}', NOW( ), '{$data}');";
     $sql = mysql_query($sql);
     if ($sql === false) {
         return false;
     }
     return true;
 }
开发者ID:rigidus,项目名称:cobutilniki,代码行数:17,代码来源:stat.php

示例4: support_add

function support_add($core, $user, $type, $text)
{
    // Check all the parameters
    $user = (int) $user;
    $type = $type ? 1 : 0;
    $text = $core->text->line($text);
    if (!($core->user->id && $text && $user)) {
        return false;
    }
    // Bad infoming data
    $iptext = $core->server['REMOTE_ADDR'];
    $ip = ip2int($iptext);
    $geoipdata = geoip($core, $iptext);
    if ($geoipdata) {
        if ($geoipdata['city']) {
            $geoip = $geoipdata['city'];
        } elseif ($geoipdata['region']) {
            $geoip = $geoipdata['region'];
        } elseif ($geoipdata['district']) {
            $geoip = $geoipdata['district'];
        } elseif ($geoipdata['country']) {
            $geoip = $geoipdata['country'];
        } else {
            $geoip = '';
        }
    } else {
        $geoip = '';
    }
    // Add new message to the list
    $sql = "INSERT INTO " . DB_SUPP . " SET supp_user = '{$user}', user_id = '" . $core->user->id . "', user_name = '" . $core->user->name . "', supp_type = '{$type}', supp_time = '" . time() . "', supp_read = 0, supp_text = '{$text}', supp_ip = '{$ip}', supp_geo = '{$geoip}'";
    if ($core->db->query($sql) && ($id = $core->db->lastid())) {
        // Count new messages in the list
        $cnt = $core->db->field("SELECT COUNT(*) FROM " . DB_SUPP . " WHERE supp_user = '{$user}' AND supp_type = '{$type}' AND supp_read = 0");
        $data = array('supp_last' => time(), 'supp_user' => $core->user->id, 'supp_name' => $core->user->name, 'supp_type' => $type, 'supp_notify' => 0);
        if ($type) {
            $data['supp_new'] = $cnt;
        } else {
            $data['supp_admin'] = $cnt;
        }
        $core->user->set($user, $data);
        return $id;
    } else {
        return false;
    }
    // Database error
}
开发者ID:Burick,项目名称:altercpa,代码行数:46,代码来源:support.php

示例5: FindBestMatch

function FindBestMatch($ip, $subnet_array)
{
    global $debug;
    $ip_i = ip2int($ip);
    $bestmatch = null;
    $bestmatchlen = -1;
    foreach ($subnet_array as $nm) {
        $subnet_and_mask = explode('/', $nm->ip);
        $subnet_i = ip2int($subnet_and_mask[0]);
        if (count($subnet_and_mask) == 2) {
            $mask_i = ip2int($subnet_and_mask[1]);
            if ($debug >= 60) {
                printf("DEBUG: ip = %08x sn = %08x mask = %08x\n", $ip_i, $subnet_i, $mask_i);
            }
            $v1 = $subnet_i & $mask_i;
            if ($v1 != $subnet_i) {
                //MDN:  Temporarily ignore the errors.  Could also try to correct them.
                //printf("ERROR: %s is NOT on a subnet boundary (%08x %08x/%08x)\n", $nm->ip, $v1, $subnet_i, $mask_i);
                //printf("ERROR:   difference: %d (%s %s)\n", $v1 - $subnet_i, $v1, $subnet_i);
            } elseif ($debug >= 20) {
                printf("DEBUG: %s -> %08x %08x\n", $nm->ip, $subnet_i, $subnet_i);
            }
            $bitlen = bitcount($mask_i);
            if ($debug >= 50) {
                printf("DEBUG: bitcount for %s is %d\n", $nm->ip, $bitlen);
            }
            if (($ip_i & $mask_i) == $subnet_i) {
                if ($debug >= 20) {
                    printf("DEBUG: %s matches %s\n", $ip, $nm->ip);
                }
                if ($bitlen > $bestmatchlen) {
                    $bestmatchlen = $bitlen;
                    $bestmatch = $nm;
                }
            }
        } else {
            if ($ip_i == $subnet_i) {
                $bestmatch = $nm;
                break;
            }
        }
    }
    return $bestmatch;
}
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:44,代码来源:ipcalc.php

示例6: ban_ip

function ban_ip($core, $ip, $raw = false)
{
    // Check the IP address
    if (!$raw) {
        $ip = ip2int($ip);
    }
    if (!$ip) {
        return false;
    }
    // Add or update ban times info
    $bans = $core->db->field("SELECT `times` FROM " . DB_BAN_IP . " WHERE `ip` = '{$ip}' LIMIT 1");
    if ($bans) {
        if ($bans > 9) {
            // Change status to banned
            $core->db->query("UPDATE " . DB_BAN_IP . " SET `times` = `times` + 1, `status` = 1 WHERE `ip` = '{$ip}' LIMIT 1");
        } else {
            $core->db->query("UPDATE " . DB_BAN_IP . " SET `times` = `times` + 1 WHERE `ip` = '{$ip}' LIMIT 1");
        }
    } else {
        $core->db->add(DB_BAN_IP, array('ip' => $ip, 'times' => 1));
    }
}
开发者ID:Burick,项目名称:altercpa,代码行数:22,代码来源:ban.php

示例7: tsms_PaymentIDGetAll

 function tsms_PaymentIDGetAll()
 {
     global $altercfg;
     $result = array();
     if ($altercfg['OPENPAYZ_REALID']) {
         $query = "SELECT `virtualid`,`realid` from `op_customers`;";
         $all = simple_queryall($query);
         if (!empty($all)) {
             foreach ($all as $io => $each) {
                 $result[$each['realid']] = $each['virtualid'];
             }
         }
     } else {
         //transform from IPs
         $query = "SELECT `login`,`IP` from `users`";
         $all = simple_queryall($query);
         if (!empty($all)) {
             foreach ($all as $io => $each) {
                 $result[$each['login']] = ip2int($each['IP']);
             }
         }
     }
     return $result;
 }
开发者ID:syscenter,项目名称:ubilling-sms,代码行数:24,代码来源:index.php

示例8: wpxml_import


//.........这里部分代码省略.........
                if ($author['author_age_min'] > 0) {
                    $User->set('age_min', $author['author_age_min']);
                }
                if ($author['author_age_max'] > 0) {
                    $User->set('age_max', $author['author_age_max']);
                }
                if (isset($author_created_from_country)) {
                    // User was created from this country
                    $User->set('reg_ctry_ID', $author_created_from_country);
                }
                if (!empty($author_regions['country'])) {
                    // Country
                    $User->set('ctry_ID', $author_regions['country']);
                    if (!empty($author_regions['region'])) {
                        // Region
                        $User->set('rgn_ID', $author_regions['region']);
                        if (!empty($author_regions['subregion'])) {
                            // Subregion
                            $User->set('subrg_ID', $author_regions['subregion']);
                        }
                        if (!empty($author_regions['city'])) {
                            // City
                            $User->set('city_ID', $author_regions['city']);
                        }
                    }
                }
                $User->set('source', $author['author_source']);
                $User->set_datecreated($author['author_created_ts'], true);
                $User->set('lastseen_ts', $author['author_lastseen_ts']);
                $User->set('profileupdate_date', $author['author_profileupdate_date']);
                $User->dbinsert();
                $user_ID = $User->ID;
                if (!empty($user_ID) && !empty($author['author_created_fromIPv4'])) {
                    $UserSettings->set('created_fromIPv4', ip2int($author['author_created_fromIPv4']), $user_ID);
                }
                $authors_count++;
            } else {
                // Get ID of existing user
                $user_ID = $existing_users[(string) $author['author_login']];
            }
            // Save user ID of current author
            $authors[$author['author_login']] = (string) $user_ID;
            $authors_IDs[$author['author_id']] = (string) $user_ID;
        }
        $UserSettings->dbupdate();
        echo sprintf(T_('%d records'), $authors_count) . '<br />';
    }
    /* Import categories */
    $category_default = 0;
    // Get existing categories
    $SQL = new SQL();
    $SQL->SELECT('cat_urlname, cat_ID');
    $SQL->FROM('T_categories');
    $SQL->WHERE('cat_blog_ID = ' . $DB->quote($wp_blog_ID));
    $categories = $DB->get_assoc($SQL->get());
    if (isset($xml_data['categories']) && count($xml_data['categories']) > 0) {
        echo T_('Importing the categories... ');
        evo_flush();
        load_class('chapters/model/_chapter.class.php', 'Chapter');
        load_funcs('locales/_charset.funcs.php');
        $categories_count = 0;
        foreach ($xml_data['categories'] as $cat) {
            if (empty($categories[(string) $cat['category_nicename']])) {
                $Chapter = new Chapter(NULL, $wp_blog_ID);
                $Chapter->set('name', $cat['cat_name']);
                $Chapter->set('urlname', $cat['category_nicename']);
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:67,代码来源:_wp.funcs.php

示例9: switch

             $AdminUI->disp_view('antispam/views/_antispam_tools.view.php');
             break;
     }
     break;
 case 'ipranges':
     switch ($action) {
         case 'iprange_new':
             if (!isset($edited_IPRange)) {
                 // Define new IPRange object only when it was not defined before, e.g. in action 'iprange_create'
                 $edited_IPRange = new IPRange();
             }
             // Set IP Start and End from _GET request
             $ip = param('ip', 'string', '');
             if (!empty($ip) && is_valid_ip_format($ip) && ($ip = explode('.', $ip)) && count($ip) == 4) {
                 $edited_IPRange->set('IPv4start', ip2int(implode('.', array($ip[0], $ip[1], $ip[2], 0))));
                 $edited_IPRange->set('IPv4end', ip2int(implode('.', array($ip[0], $ip[1], $ip[2], 255))));
             }
             $AdminUI->disp_view('antispam/views/_antispam_ipranges.form.php');
             break;
         case 'iprange_edit':
             $AdminUI->disp_view('antispam/views/_antispam_ipranges.form.php');
             break;
         default:
             // View list of the IP Ranges
             $AdminUI->disp_view('antispam/views/_antispam_ipranges.view.php');
             break;
     }
     break;
 case 'countries':
     $AdminUI->disp_view('regional/views/_country_list.view.php');
     break;
开发者ID:Edind304,项目名称:b2evolution,代码行数:31,代码来源:antispam.ctrl.php

示例10: zbs_UserShowProfile

/**
 * Renders user profile
 * 
 * @param string $login
 * @return string
 */
function zbs_UserShowProfile($login)
{
    $us_config = zbs_LoadConfig();
    $us_currency = $us_config['currency'];
    $userdata = zbs_UserGetStargazerData($login);
    $alladdress = zbs_AddressGetFulladdresslist();
    $allrealnames = zbs_UserGetAllRealnames();
    $contract = zbs_UserGetContract($login);
    $email = zbs_UserGetEmail($login);
    $mobile = zbs_UserGetMobile($login);
    $phone = zbs_UserGetPhone($login);
    $passive = $userdata['Passive'];
    $down = $userdata['Down'];
    //public offer mode
    if (isset($us_config['PUBLIC_OFFER'])) {
        if (!empty($us_config['PUBLIC_OFFER'])) {
            $publicOfferUrl = $us_config['PUBLIC_OFFER'];
            $contract = la_Link($publicOfferUrl, __('Public offer'), false, '');
        }
    }
    // START OF ONLINELEFT COUNTING <<
    if ($us_config['ONLINELEFT_COUNT'] != 0) {
        $userBalance = $userdata['Cash'];
        $userTariff = $userdata['Tariff'];
        $balanceExpire = zbs_GetOnlineLeftCount($login, $userBalance, $userTariff, false);
    } else {
        $balanceExpire = '';
    }
    // >> END OF ONLINELEFT COUNTING
    if ($userdata['CreditExpire'] != 0) {
        $credexpire = date("d-m-Y", $userdata['CreditExpire']);
    } else {
        $credexpire = '';
    }
    // pasive state check
    if ($passive) {
        $passive_state = __('Account frozen');
    } else {
        $passive_state = __('Account active');
    }
    //down state check
    if ($down) {
        $down_state = ' + ' . __('Disabled');
    } else {
        $down_state = '';
    }
    //hiding passwords
    if ($us_config['PASSWORDSHIDE']) {
        $userpassword = str_repeat('*', 8);
    } else {
        $userpassword = $userdata['Password'];
    }
    //payment id handling
    if ($us_config['OPENPAYZ_REALID']) {
        $paymentid = zbs_PaymentIDGet($login);
    } else {
        $paymentid = ip2int($userdata['IP']);
    }
    //payment id qr dialog
    $paymentidqr = '';
    if (isset($us_config['PAYMENTID_QR'])) {
        if ($us_config['PAYMENTID_QR']) {
            $paymentidqr = la_modal(la_img('iconz/qrcode.png', 'QR-code'), __('Payment ID'), la_tag('center') . la_img('qrgen.php?data=' . $paymentid) . la_tag('center', true), '', '300', '250');
        }
    }
    //draw order link
    if ($us_config['DOCX_SUPPORT']) {
        $zdocsLink = ' ' . la_Link('?module=zdocs', __('Draw order'), false, 'printorder');
    } else {
        $zdocsLink = '';
    }
    //tariff speeds
    if ($us_config['SHOW_SPEED']) {
        $speedOffset = 1024;
        $userSpeedOverride = zbs_SpeedGetOverride($login);
        if ($userSpeedOverride == 0) {
            $showSpeed = zbs_TariffGetSpeed($userdata['Tariff']);
        } else {
            if ($userSpeedOverride < $speedOffset) {
                $showSpeed = $userSpeedOverride . ' ' . __('Kbit/s');
            } else {
                $showSpeed = $userSpeedOverride / $speedOffset . ' ' . __('Mbit/s');
            }
        }
        $tariffSpeeds = la_TableRow(la_TableCell(__('Tariff speed'), '', 'row1') . la_TableCell($showSpeed));
    } else {
        $tariffSpeeds = '';
    }
    if ($us_config['ROUND_PROFILE_CASH']) {
        $Cash = web_roundValue($userdata['Cash'], 2);
    } else {
        $Cash = $userdata['Cash'];
    }
    $profile = la_tag('table', false, '', 'width="100%" border="0" cellpadding="2" cellspacing="3"');
//.........这里部分代码省略.........
开发者ID:l1ght13aby,项目名称:Ubilling,代码行数:101,代码来源:api.userstats.php

示例11: getUsersList


//.........这里部分代码省略.........
                 if ($contractDate) {
                     $result[$userLogin]['agreement'][0]['date'] = $contractDate;
                 }
             }
             $result[$userLogin]['account_number'] = @$allPaymentIds[$userLogin];
             // yep, this is something like Payment ID
             if (isset($allUserTags[$userLogin])) {
                 foreach ($allUserTags[$userLogin] as $tagIo => $eachTagid) {
                     $result[$userLogin]['group'][$tagIo] = $eachTagid;
                 }
             }
             $userNotes = @$allUserNotes[$userLogin];
             if ($userNotes) {
                 $result[$userLogin]['comment'] = $userNotes;
             }
             $result[$userLogin]['balance'] = $userData['Cash'];
             $result[$userLogin]['credit'] = $userData['Credit'];
             $userState = 5;
             // work
             if ($userData['Cash'] < '-' . $userData['Credit']) {
                 $userState = 1;
                 //nomoney
             }
             if ($userData['Passive'] == 1) {
                 $userState = 2;
                 // pause
             }
             if ($userData['Down'] == 1) {
                 $userState = 3;
                 // disable
             }
             if ($userData['Tariff'] == '*_NO_TARIFF_*') {
                 $userState = 4;
                 // new
             }
             $result[$userLogin]['state_id'] = $userState;
             if (isset($allRegData[$userLogin])) {
                 $result[$userLogin]['date_create'] = $allRegData[$userLogin];
                 $result[$userLogin]['date_connect'] = $allRegData[$userLogin];
             } else {
                 $result[$userLogin]['date_create'] = '';
                 $result[$userLogin]['date_connect'] = '';
             }
             $result[$userLogin]['date_activity'] = date("Y-m-d H:i:s", $userData['LastActivityTime']);
             $result[$userLogin]['traffic']['month']['up'] = $userData['U0'];
             $result[$userLogin]['traffic']['month']['down'] = $userData['D0'];
             $result[$userLogin]['discount'] = 0;
             // TODO: to many discount models at this time
             $userApartmentId = @$allAddresBindings[$userLogin];
             if ($userApartmentId) {
                 $aptData = $allAptData[$userApartmentId];
                 $result[$userLogin]['address'][0]['type'] = 'connect';
                 $result[$userLogin]['address'][0]['house_id'] = $aptData['buildid'];
                 $result[$userLogin]['address'][0]['apartment']['id'] = $userApartmentId;
                 $result[$userLogin]['address'][0]['apartment']['full_name'] = $aptData['apt'];
                 $result[$userLogin]['address'][0]['apartment']['number'] = vf($aptData['apt'], 3);
                 if ($aptData['entrance']) {
                     $result[$userLogin]['address'][0]['entrance'] = $aptData['entrance'];
                 }
                 if ($aptData['floor']) {
                     $result[$userLogin]['address'][0]['floor'] = $aptData['floor'];
                 }
             }
             $userPhoneData = @$allPhones[$userLogin];
             if (!empty($userPhoneData)) {
                 if (isset($userPhoneData['phone'])) {
                     $result[$userLogin]['phone'][0]['number'] = $userPhoneData['phone'];
                     $result[$userLogin]['phone'][0]['flag_main'] = 0;
                 }
                 if (isset($userPhoneData['mobile'])) {
                     $result[$userLogin]['phone'][1]['number'] = $userPhoneData['mobile'];
                     $result[$userLogin]['phone'][1]['flag_main'] = 1;
                 }
             }
             $userEmail = @$allEmails[$userLogin];
             if ($userEmail) {
                 $result[$userLogin]['email'][0]['address'] = $userEmail;
                 $result[$userLogin]['email'][0]['flag_main'] = 1;
             }
             $userIp = $userData['IP'];
             $userIp = ip2int($userIp);
             $result[$userLogin]['ip_mac'][0]['ip'] = $userIp;
             $nethostsData = @$allNethosts[$userData['IP']];
             if (!empty($nethostsData)) {
                 $subnetId = $nethostsData['netid'];
                 $userMac = $nethostsData['mac'];
                 $userMac = str_replace(':', '', $userMac);
                 $userMac = strtolower($userMac);
                 // mac lowercased withot delimiters
                 $result[$userLogin]['ip_mac'][0]['mac'] = $userMac;
                 $result[$userLogin]['ip_mac'][0]['ip_net'] = @$allNetworks[$subnetId]['desc'];
             }
             if (isset($this->allCfData[$userLogin])) {
                 $result[$userLogin]['additional_data'] = $this->allCfData[$userLogin];
             }
             //   die(print_r($result, true));
         }
     }
     return $result;
 }
开发者ID:l1ght13aby,项目名称:Ubilling,代码行数:101,代码来源:api.userside.php

示例12: upgrade_b2evo_tables


//.........这里部分代码省略.........
        db_drop_col('T_sessions', 'sess_hitcount');
        task_end();
        task_begin('Upgrading users table...');
        db_add_col('T_users', 'user_lastseen_ts', 'TIMESTAMP NULL AFTER user_created_datetime');
        $DB->query('UPDATE T_users SET user_lastseen_ts = ( SELECT MAX( sess_lastseen_ts ) FROM T_sessions WHERE sess_user_ID = user_ID )');
        $DB->query('UPDATE T_users SET user_profileupdate_ts = user_created_datetime WHERE user_profileupdate_ts < user_created_datetime');
        $DB->query("ALTER TABLE T_users CHANGE COLUMN user_profileupdate_ts user_profileupdate_date DATE NOT NULL DEFAULT '2000-01-01' COMMENT 'Last day when the user has updated some visible field in his profile.'");
        task_end();
        task_begin('Updating versions table...');
        db_add_col('T_items__version', 'iver_ID', 'INT UNSIGNED NOT NULL FIRST');
        $DB->query('ALTER TABLE T_items__version DROP INDEX iver_itm_ID, ADD INDEX iver_ID_itm_ID ( iver_ID , iver_itm_ID )');
        task_end();
        task_begin('Upgrading messaging contact group users...');
        db_add_foreign_key('T_messaging__contact_groupusers', 'cgu_cgr_ID', 'T_messaging__contact_groups', 'cgr_ID', 'ON DELETE CASCADE');
        task_end();
        task_begin('Creating table for a latest version of the POT file...');
        $DB->query("CREATE TABLE T_i18n_original_string (\n\t\t\tiost_ID        int(10) unsigned NOT NULL auto_increment,\n\t\t\tiost_string    varchar(10000) NOT NULL default '',\n\t\t\tiost_inpotfile tinyint(1) NOT NULL DEFAULT 0,\n\t\t\tPRIMARY KEY (iost_ID)\n\t\t) ENGINE = innodb");
        task_end();
        task_begin('Creating table for a latest versions of the PO files...');
        $DB->query("CREATE TABLE T_i18n_translated_string (\n\t\t\titst_ID       int(10) unsigned NOT NULL auto_increment,\n\t\t\titst_iost_ID  int(10) unsigned NOT NULL,\n\t\t\titst_locale   varchar(20) NOT NULL default '',\n\t\t\titst_standard varchar(10000) NOT NULL default '',\n\t\t\titst_custom   varchar(10000) NULL,\n\t\t\titst_inpofile tinyint(1) NOT NULL DEFAULT 0,\n\t\t\tPRIMARY KEY (itst_ID)\n\t\t) ENGINE = innodb DEFAULT CHARSET = utf8");
        task_end();
        task_begin('Updating Antispam IP Ranges table...');
        db_add_col('T_antispam__iprange', 'aipr_status', 'enum( \'trusted\', \'suspect\', \'blocked\' ) NULL DEFAULT NULL');
        db_add_col('T_antispam__iprange', 'aipr_block_count', 'int(10) unsigned DEFAULT 0');
        $DB->query("ALTER TABLE T_antispam__iprange CHANGE COLUMN aipr_user_count aipr_user_count int(10) unsigned DEFAULT 0");
        task_end();
        set_upgrade_checkpoint('10970');
    }
    if ($old_db_version < 10975) {
        // part 8/b trunk aka first part of "i4"
        task_begin('Creating default antispam IP ranges... ');
        $DB->query('
			INSERT INTO T_antispam__iprange ( aipr_IPv4start, aipr_IPv4end, aipr_status )
			VALUES ( ' . $DB->quote(ip2int('127.0.0.0')) . ', ' . $DB->quote(ip2int('127.0.0.255')) . ', "trusted" ),
				( ' . $DB->quote(ip2int('10.0.0.0')) . ', ' . $DB->quote(ip2int('10.255.255.255')) . ', "trusted" ),
				( ' . $DB->quote(ip2int('172.16.0.0')) . ', ' . $DB->quote(ip2int('172.31.255.255')) . ', "trusted" ),
				( ' . $DB->quote(ip2int('192.168.0.0')) . ', ' . $DB->quote(ip2int('192.168.255.255')) . ', "trusted" )
			');
        task_end();
        set_upgrade_checkpoint('10975');
    }
    if ($old_db_version < 11000) {
        // part 8/c trunk aka first part of "i4"
        task_begin('Adding new countries...');
        // IGNORE is needed for upgrades from DB version 9970 or later
        $DB->query('INSERT IGNORE INTO T_regional__country ( ctry_code, ctry_name, ctry_curr_ID ) VALUES ( \'ct\', \'Catalonia\', \'2\' )');
        task_end();
        task_begin('Upgrading message thread statuses table...');
        db_add_col('T_messaging__threadstatus', 'tsta_thread_leave_msg_ID', 'int(10) unsigned NULL DEFAULT NULL');
        task_end();
        task_begin('Upgrading Item Settings...');
        // Convert item custom fields to custom item settings ( move custom fields from T_items__item table to T_items__item_settings table )
        $query = "INSERT INTO T_items__item_settings( iset_item_ID, iset_name, iset_value ) ";
        for ($i = 1; $i <= 8; $i++) {
            // For each custom fields:
            if ($i > 1) {
                $query .= ' UNION';
            }
            $field_name = $i > 5 ? 'varchar' . ($i - 5) : 'double' . $i;
            $query .= " SELECT post_ID, 'custom_" . $field_name . "', post_" . $field_name . "\n\t\t\t\t\t\t\tFROM T_items__item WHERE post_" . $field_name . " IS NOT NULL";
        }
        $DB->query($query);
        for ($i = 1; $i <= 5; $i++) {
            // drop custom double columns from items tabe
            db_drop_col('T_items__item', 'post_double' . $i);
        }
开发者ID:Edind304,项目名称:b2evolution,代码行数:67,代码来源:_functions_evoupgrade.php

示例13: stg_show_fulluserlistOld


//.........这里部分代码省略.........
                if ($alter_conf['ONLINE_LAT']) {
                    $user_lat = wf_TableCell(date("Y-m-d H:i:s", $eachuser['LastActivityTime']));
                } else {
                    $user_lat = '';
                }
                //online check
                if ($alter_conf['DN_ONLINE_DETECT']) {
                    if (file_exists(DATA_PATH . 'dn/' . $eachuser['login'])) {
                        $online_flag = 1;
                        $trueonline++;
                    } else {
                        $online_flag = 0;
                    }
                    $online_cell = wf_TableCell(web_bool_star($online_flag, true), '', '', 'sorttable_customkey="' . $online_flag . '"');
                } else {
                    $online_cell = '';
                    $online_flag = 0;
                }
                if ($alter_conf['ONLINE_LIGHTER']) {
                    $lighter = 'onmouseover="this.className = \'row2\';" onmouseout="this.className = \'row3\';" ';
                } else {
                    $lighter = '';
                }
                //user linking indicator
                if ($alter_conf['USER_LINKING_ENABLED']) {
                    //is user child?
                    if (isset($alllinkedusers[$eachuser['login']])) {
                        $corporate = wf_Link('?module=corporate&userlink=' . $alllinkedusers[$eachuser['login']], web_corporate_icon(), false);
                    } else {
                        $corporate = '';
                    }
                    //is  user parent?
                    if (isset($allparentusers[$eachuser['login']])) {
                        $corporate = wf_Link('?module=corporate&userlink=' . $allparentusers[$eachuser['login']], web_corporate_icon('Corporate parent'), false);
                    }
                } else {
                    $corporate = '';
                }
                //fast cash link
                if ($fastcash) {
                    $financelink = wf_Link('?module=addcash&username=' . $eachuser['login'] . '#profileending', wf_img('skins/icon_dollar.gif', __('Finance operations')), false);
                } else {
                    $financelink = '';
                }
                $result .= wf_tag('tr', false, 'row3', $lighter);
                $result .= wf_tag('td', false);
                $result .= wf_Link('?module=traffstats&username=' . $eachuser['login'], web_stats_icon(), false);
                $result .= $financelink;
                $result .= wf_Link('?module=userprofile&username=' . $eachuser['login'], web_profile_icon(), false);
                $result .= $corporate;
                $result .= @$alladdress[$eachuser['login']];
                $result .= wf_tag('td', true);
                $result .= wf_TableCell(@$allrealnames[$eachuser['login']]);
                $result .= wf_TableCell($eachuser['IP'], '', '', 'sorttable_customkey="' . ip2int($eachuser['IP']) . '"');
                $result .= wf_TableCell($eachuser['Tariff']);
                $result .= $user_lat;
                $result .= wf_TableCell($act);
                $result .= $online_cell;
                $result .= wf_TableCell(stg_convert_size($tinet), '', '', 'sorttable_customkey="' . $tinet . '"');
                $result .= wf_TableCell(round($eachuser['Cash'], 2));
                $result .= wf_TableCell(round($eachuser['Credit'], 2));
                $result .= wf_tag('tr', true);
            }
        }
        if ($alter_conf['DN_ONLINE_DETECT']) {
            $true_online_counter = wf_TableCell(__('Users online') . ' ' . $trueonline);
        } else {
            $true_online_counter = null;
        }
        $result .= wf_tag('table', true);
        $footerCells = wf_TableCell(__('Total') . ': ' . $ucount);
        $footerCells .= wf_TableCell(__('Active users') . ' ' . ($ucount - $inacacount) . ' / ' . __('Inactive users') . ' ' . $inacacount);
        $footerCells .= $true_online_counter;
        $footerCells .= wf_TableCell(__('Traffic') . ': ' . stg_convert_size($totaltraff));
        $footerCells .= wf_TableCell(__('Total') . ': ' . round($tcash, 2));
        $footerCells .= wf_TableCell(__('Credit total') . ': ' . $tcredit);
        $footerRows = wf_TableRow($footerCells, 'row1');
        $result .= wf_TableBody($footerRows, '100%', '0');
        //extended filters again
        if ($alter_conf['ONLINE_FILTERS_EXT']) {
            $filtercode = wf_tag('script', false, '', 'language="javascript" type="text/javascript"');
            $filtercode .= '
            //<![CDATA[
            function showfilter() {
            var onlinefilters = {
		btn: false,
          	col_' . (4 + $act_offset) . ': "select",
               ' . $true_online_selector . '
		btn_text: ">"
               }
                setFilterGrid("onlineusers",0,onlinefilters);
             }
            //]]>';
            $filtercode .= wf_tag('script', true);
        } else {
            $filtercode = '';
        }
        $result .= $filtercode;
        return $result;
    }
开发者ID:l1ght13aby,项目名称:Ubilling,代码行数:101,代码来源:index.php

示例14: neworder

function neworder($core, $data, $file = false)
{
    $sid = (int) $data['site'];
    $spc = (int) $data['from'];
    $fid = (int) $data['flow'];
    $oid = (int) $data['offer'];
    $tgt = (int) $data['target'];
    $iptext = $data['ip'];
    $ip = ip2int($iptext);
    $name = $data['name'] ? $core->text->line($data['name']) : 'Без Воображения';
    $ind = (int) $data['index'];
    $area = $core->text->line($data['area']);
    $city = $core->text->line($data['city']);
    $street = $core->text->line($data['street']);
    $addr = $core->text->line($data['addr']);
    if ($addr == 'Уточнить по телефону') {
        $addr = '';
    }
    if ($addr == 'Адрес узнать по телефону') {
        $addr = '';
    }
    $comm = $core->text->line($data['comm']);
    $phone = (string) trim(preg_replace('#[^0-9]+#i', '', $data['phone']));
    $pres = $data['present'] > 0 ? (int) $data['present'] : 0;
    $cnt = $data['count'] > 0 ? (int) $data['count'] : 1;
    $more = $data['more'] > 0 ? (int) $data['more'] : 0;
    $dsc = $data['discount'] > 0 && $data['discount'] < 100 ? (int) $data['discount'] : 0;
    $cntr = $data['country'] ? strtolower(substr($core->text->link($data['country']), 0, 2)) : false;
    $dlvr = $data['delivery'] > 0 ? (int) $data['delivery'] : 1;
    $exti = (int) $data['exti'];
    $extu = $exti ? preg_replace('#[^0-9A-Za-z\\_\\-\\.]+#i', '', $data['extu']) : 0;
    $exts = $exti ? preg_replace('#[^0-9A-Za-z\\_\\-\\.]+#i', '', $data['exts']) : 0;
    $utmi = (int) $data['utmi'];
    $utmc = (int) $data['utmc'];
    $utms = (int) $data['utms'];
    $items = is_array($data['items']) ? serialize($data['items']) : '';
    $meta = $data['meta'] ? addslashes(serialize(unserialize(stripslashes($data['meta'])))) : '';
    $addr1 = $core->text->line($data['addr1']);
    $addr2 = $core->text->line($data['addr2']);
    $addr3 = $core->text->line($data['addr3']);
    if ($addr1) {
        $addr .= ', ' . $addr1;
    }
    if ($addr2) {
        $addr .= ', ' . $addr2;
    }
    if ($addr3) {
        $addr .= ', ' . $addr3;
    }
    if (!($oid && ($offer = $core->wmsale->get('offer', $oid)))) {
        return 'offer';
    }
    $site = $sid ? $core->wmsale->get('site', $sid) : false;
    $flow = $fid ? $core->wmsale->get('flow', $fid) : false;
    $ext = $exti ? $core->wmsale->get('ext', $exti) : false;
    $status = $data['status'] ? (int) $data['status'] : 1;
    if ($status == 1) {
        $status = $offer['offer_payment'] == 1 ? 0 : 1;
    }
    $userid = $flow ? $flow['user_id'] : ($ext ? $ext['user_id'] : false);
    if ($userid && $core->user->get($userid, 'user_ban')) {
        return 'security';
    }
    if ($phone) {
        // Name and address
        $name = mb_ucwords($name);
        if (!$ind) {
            if (preg_match('#^([0-9]+)#i', $addr, $ind)) {
                $ind = $ind[1];
                $ad = preg_split('#[\\s,\\.]+#i', $addr, 2);
                $addr = trim($ad[1], ' ,');
            } else {
                $ind = '';
            }
        }
        // Price, presents and discounts
        if ($data['items']) {
            $price = $cnt = 0;
            $vars = $core->wmsale->get('vars', $offer['offer_id']);
            foreach ($vars as &$v) {
                if ($data['items'][$v['var_id']]) {
                    $cnt += $data['items'][$v['var_id']];
                    $price += $data['items'][$v['var_id']] * $v['var_price'];
                }
            }
            unset($v, $vars);
        } else {
            $price = $cnt * $offer['offer_price'];
        }
        if ($dsc) {
            $price = ceil($price * ((100 - $dsc) / 100));
        }
        if ($pres) {
            $price += $core->lang['presentp'][$pres];
        }
        if ($more) {
            $price += $more;
        }
        if ($offer['offer_delivery']) {
            $price += $core->lang['deliverp'][$dlvr];
//.........这里部分代码省略.........
开发者ID:Burick,项目名称:altercpa,代码行数:101,代码来源:add.php

示例15: hit_iprange_status

/**
 * Get status code of IP range by IP address
 *
 * @param string IP address in format xxx.xxx.xxx.xxx
 * @return string Status value as it is stored in DB
 */
function hit_iprange_status($IP_address)
{
    global $DB, $hit_iprange_statuses_cache;
    $IP_address = ip2int($IP_address);
    if (!is_array($hit_iprange_statuses_cache)) {
        // Initialize it only first time
        $SQL = new SQL();
        $SQL->SELECT('aipr_status AS status, aipr_IPv4start AS start, aipr_IPv4end AS end');
        $SQL->FROM('T_antispam__iprange');
        $hit_iprange_statuses_cache = $DB->get_results($SQL->get());
    }
    // Use this empty value for IPs without detected ranges in DB
    $ip_range_status = '';
    // Find status in the cache
    foreach ($hit_iprange_statuses_cache as $hit_iprange_status) {
        if ($IP_address >= $hit_iprange_status->start && $IP_address <= $hit_iprange_status->end) {
            // IP is detected in this range
            $ip_range_status = $hit_iprange_status->status;
            break;
        }
    }
    return $ip_range_status;
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:29,代码来源:_stats_view.funcs.php


注:本文中的ip2int函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。