Ejemplo n.º 1
0
 public static function adicionar_contador($tabela, $id)
 {
     $db = new Mysql();
     switch ($tabela) {
         case 'NOTICIA':
             $campo_id = 'NOTICIA_CDG';
             break;
         case 'ITEM':
             $campo_id = 'ITEM_CDG';
             break;
     }
     $db->Query(' UPDATE ' . $tabela . ' SET ' . $tabela . '_VIEW = ' . $tabela . '_VIEW + 1 
                   WHERE ' . $campo_id . ' = ' . $id);
 }
Ejemplo n.º 2
0
include_once "config.inc.php";
include_once "templates/header.html";
include_once "templates/install_manager_sidebar.html";
$mysql = new Mysql();
$install = new Install();
$monitor = new NodeMonitor();
if (!@$_GET['action']) {
    echo '<div class="span10">
	' . $lang['chooseLeftSidebar'] . '
	</div>';
} elseif ($_GET['action'] == "Install") {
    if (!$_GET['ip']) {
        echo '<div class=span10>';
        echo '<h2>' . $lang['chooseInstallHost'] . '</h2>';
        $sql = "select * from ehm_hosts order by create_time desc";
        $mysql->Query($sql);
        echo '<table class="table table-striped">';
        echo '<thead>
                <tr>
                  <th>#</th>
                  <th>' . $lang['hostname'] . '</th>
                  <th>' . $lang['ipAddr'] . '</th>
                  <th>' . $lang['nodeRole'] . '</th>
                  <th>' . $lang['createTime'] . '</th>
                  <th>' . $lang['action'] . '</th>
                </tr>
                </thead>
                <tbody>';
        $i = 1;
        while ($arr = $mysql->FetchArray()) {
            echo '<tr>
Ejemplo n.º 3
0
<?php

/*
 *	@author: Tomáš Mičulka
 *	@version: 2.0
 *	@last_update: 7.1.2014 
 */
defined('IN_INNE') or die("Acces denied!");
$database = new Mysql(false);
$dataTemp = array();
$dataList = $database->handler->real_escape_string($_POST["structure"]);
$dataList = parse_str($dataList, $dataTemp);
$dataId = $database->handler->real_escape_string($_POST["id"]);
for ($counter = 1; $counter <= count($dataTemp[pos]); $counter++) {
    $database->Query("UPDATE " . TABLE_PREFIX . "pages SET pagePosition='{$counter}' WHERE pageId='" . $dataTemp[pos][$counter - 1] . "';");
}
Ejemplo n.º 4
0
	public static function AnalyzeHotelList($cityId)
	{
$logger = \Logger :: GetLogger("ctrip");
		$xml = simplexml_load_file(__DIR__ . "/hotellistdata/city" . $cityId . ".xml");

		if(!isset($xml->HotelResponse->OTA_HotelSearchRS->Properties))	return;
		$hotelList = $xml->HotelResponse->OTA_HotelSearchRS->Properties;
		
		$sqlObject = new \Mysql();
		
		$hotelIndex = 0;
		foreach($hotelList->children() as $hotel)
		{
			$hotelIndex++;
$logger->info("开始分析第" . $hotelIndex . "个酒店", __FUNCTION__);
			$hotelId = intval($hotel["HotelCode"]);
			if($cityId != intval($hotel["HotelCityCode"]))
			{
$logger->error("查询到的酒店的HotelCityCode(" . $hotel["HotelCityCode"] . ")和($cityId)不一致", __FUNCTION__);
			}
			$hotelName = strval($hotel["HotelName"]);
			$districtId = intval($hotel["AreaID"]);
			$hotelCode = intval($hotel["HotelId"]);
			if($hotelId != $hotelCode)
			{
$logger->error("查询到的酒店的HotelCode($hotelId)和HotelId($hotelCode)不一致", __FUNCTION__);
			}
			$brandId = intval($hotel["BrandCode"]);
			
			$sql = "INSERT INTO ctrip_hotel (id, city_id, name, district_id, brand_id) VALUES ($hotelId, $cityId, '$hotelName', $districtId, $brandId);";
			$sqlObject->Query($sql);
			
			if(isset($hotel->VendorMessages))
			{
				foreach($hotel->VendorMessages->children() as $message)
				{
					$infoType = intval($message["InfoType"]);
					if($infoType == 23)
					{
						$sql = "INSERT INTO ctrip_hotel_image (hotel_id, url) VALUES ($hotelId, '" . strval($message->SubSection->Paragraph->Text) . "');";
						$sqlObject->Query($sql);
					}
					else if($infoType == 1)
					{
						$sql = "INSERT INTO ctrip_hotel_description (hotel_id, description) VALUES ($hotelId, '" . strval($message->SubSection->Paragraph->Text) . "');";
						$sqlObject->Query($sql);
					}
					else
					{
$logger->error("查询到的酒店的信息(" . $infoType . "):" . strval($message->SubSection->Paragraph->Text), __FUNCTION__);
					}
				}
			}
			
			$address = strval($hotel->Address->AddressLine);
			$sql = "UPDATE ctrip_hotel SET address = '$address' WHERE id = $hotelId;";
			$sqlObject->Query($sql);
			
			$awardList = $hotel->Award; 
			for($i = 0; $i < count($awardList); $i++)
			{
				switch(strval($awardList[$i]["Provider"]))
				{
					case "HotelStarRate":
						$fieldName = "star_rate";
						break;
					case "CtripStarRate":
						$fieldName = "ctrip_star_rate";
						break;
					case "CtripRecommendRate":
						$fieldName = "ctrip_recommend_rate";
						break;
					case "CtripCommRate":
						$fieldName = "ctrip_client_rate";
						break;
					case "CommSurroundingRate":
						$fieldName = "ctrip_client_surrounding_rate";
						break;
					case "CommFacilityRate":
						$fieldName = "ctrip_client_facility_rate";
						break;
					case "CommCleanRate":
						$fieldName = "ctrip_client_clean_rate";
						break;
					case "CommServiceRate":
						$fieldName = "ctrip_client_service_rate";
						break;
					default:
$logger->error("查询到的酒店的星级(" . strval($awardList[$i]["Provider"]) . "):" . doubleval($awardList[$i]["Rating"]), __FUNCTION__);
				}
				$sql = "UPDATE ctrip_hotel SET $fieldName = " . doubleval($awardList[$i]["Rating"]) . " WHERE id = $hotelId;";
				$sqlObject->Query($sql);
			}
			
			/*未解析RelativePosition结点,因为下面一个接口有更详细的信息
			if(isset($hotel->RelativePosition))
			{
				$relativePositionList = $hotel->RelativePosition;
				for($i = 0; $i < count($relativePositionList); $i++)
				{
$logger->debug("查询到酒店距离(" . strval($relativePositionList[$i]["Name"]) . ")有" . doubleval($relativePositionList[$i]["Distance"]) . "公里:", __FUNCTION__);
$sql = "INSERT INTO ctrip_hotel_surround (hotel_id, location_type_id, location_name, distance) VALUES ($hotelId, 0, '" . strval($relativePositionList[$i]["Name"]) . "', " . doubleval($relativePositionList[$i]["Distance"]) . ");";
file_put_contents($sqlFilename, $sql . "\r\n", FILE_APPEND | LOCK_EX);
				}
			}
			*/
			
			if(isset($hotel->TPA_Extensions->Zone))
			{
				$zoneId = intval($hotel->TPA_Extensions->Zone->ZoneType["ZoneID"]);
				$zoneName = strval($hotel->TPA_Extensions->Zone->ZoneType["ZoneName"]);
				$sql = "SELECT name FROM ctrip_area_business_zone WHERE id = " . $zoneId;
				$zoneDataInDB = $sqlObject->GetOne($sql);
				if(!is_array($zoneDataInDB))
				{
					$sql = "INSERT INTO ctrip_area_business_zone (id, name, short_name, city_id) VALUES ($zoneId, '" . $zoneName . "', '" . $zoneName . "', $cityId)";
					$sqlObject->Query($sql);
				}
				else
				{
					if($zoneDataInDB["name"] != $zoneName)
					{
$logger->error("查询(" . $zoneId . ")有不一致的zoneName,数据库中的数据是:" . $zoneDataInDB["name"] . ",接口返回的是:" . $zoneName, __FUNCTION__);
					}
				}
				
				$sql = "UPDATE ctrip_hotel SET zone_id = $zoneId WHERE id = $hotelId;";
				$sqlObject->Query($sql);
			}
		}
	}
Ejemplo n.º 5
0
<?php

include_once "../../model/mysql.php";
$message = $_POST['texto'];
$message = nl2br($message);
$db = new Mysql();
$db->Query(" INSERT INTO TESTE(TEXTO,TEXTOTEXTO) VALUES('" . $message . "','" . $message . "')");
echo $message;
Ejemplo n.º 6
0
 public function EditPage($pageId, $pageContent)
 {
     $database = new Mysql(false);
     $database->Query("UPDATE " . TABLE_PREFIX . "m_text_master SET pageContent='{$pageContent}' WHERE pageId='{$pageId}';");
 }