function get_ip_place_md5() { $cip = get_ip_place(); $cip = md5($cip); return $cip; }
<?php require_once './globalVar.php'; echo get_ip_place(); require_once './api/OperatorFileText.php'; $fileUtil = new file(); $ipFile = $app_path . "/ipFile.ptp"; $fileUtil->writetofile($ipFile, 'aaa;aaaaa' . ';', true);
function _siteweather() { $ip = get_ip_place(); $area_query = $GLOBALS['db']->query("select id from " . tname('area') . " where flag=3 and name='" . trim($ip[3]) . "'"); $area_row = array(); $area_row = $GLOBALS['db']->fetch_array($area_query); if (empty($area_row)) { //查询省份是否存在 $area_qu = $GLOBALS['db']->query("select id from " . tname('area') . " where flag=2 and name='" . trim($ip[2]) . "'"); $area_sheng = array(); $area_sheng = $GLOBALS['db']->fetch_array($area_qu); if (empty($area_sheng)) { $area_date = array(); $area_date['name'] = trim($ip[2]); $area_date['fatherid'] = 1; $area_date['flag'] = 2; $area_fid = $this->area->InsertData($area_date); } else { $area_fid = $area_sheng['id']; } $area_date = array(); $area_date['name'] = trim($ip[3]); $area_date['fatherid'] = $area_fid; $area_date['flag'] = 3; $area_id = $this->area->InsertData($area_date); } else { $area_id = $area_row['id']; } if (!empty($_REQUEST['areaid'])) { $area_qu = $GLOBALS['db']->query("select id from " . tname('area') . " where id=" . $_REQUEST['areaid']); $area = array(); $area = $GLOBALS['db']->fetch_array($area_qu); if (!empty($area)) { $area_id = $_REQUEST['areaid']; } } $query = $GLOBALS['db']->query("select we.*,ar.name from " . tname('weather') . " as we," . tname('area') . " as ar where ar.id=we.areaid and areaid=" . $area_id); $weatherRow = array(); $weatherRow = $GLOBALS['db']->fetch_array($query); if (empty($weatherRow) || $weatherRow['updated'] < date("Y-m-d 00:00:00")) { $weather = _cityweather($row['name']); $htm1 = strip_tags($weather[1], "<br><img>"); $htm2 = strip_tags($weather[2], "<br><img>"); $htm3 = strip_tags($weather[3], "<br><img>"); $data['areaid'] = $area_id; $data['jtitle'] = change_htm(str_replace("<img ", "<img height='30' ", $htm1)); $data['mtitle'] = change_htm(str_replace("<img ", "<img height='30' ", $htm2)); $data['htitle'] = change_htm(str_replace("<img ", "<img height='30' ", $htm3)); $data['updated'] = date("Y-m-d H:i:s"); if (!is_array($weatherRow) || empty($weatherRow)) { $ids = $this->weather->InsertData($data); } elseif ($row['updated'] < date("Y-m-d 00:00:00")) { $ids = $this->weather->UpdateData($data, 'and id=' . $weatherRow['id']); } $query = $GLOBALS['db']->query("select* from " . tname('weather') . " where areaid=" . $area_id); $weatherRow = array(); $weatherRow = $GLOBALS['db']->fetch_array($query); } return $weatherRow; }