function resultToJsonObject($result) { $row = $result->fetch_assoc(); if ($row) { encodeData($row); setContentTypeJson(); echo json_encode($row); } else { setStatus(404, "Not Found"); } }
function encodeData(&$data) { if (!is_null($data)) { //Procedemos a codificar cada valor. foreach ($data as $key => $value) { if (!is_array($value)) { if (!is_numeric($value)) { $data[$key] = base64_encode(utf8_encode($value)); } } else { encodeData($data[$key]); } } } }
$checkedTodos = ""; if ($_POST["status_ativo"] == "sim") { if ($opcoes <> " AND (") {$opcoes .= " OR ";} $opcoes .= "status = 'ativo' " ; $checkedAtivo = " checked";} if ($_POST["status_inativo"]== "sim") { if ($opcoes <> " AND (") {$opcoes .= " OR ";} $opcoes .= "status = 'inativo'"; $checkedInativo = " checked";} if ($_POST["status_vendido"]== "sim") { if ($opcoes <> " AND (") {$opcoes .= " OR ";} $opcoes .= "status = 'vendido'"; $checkedVendido = " checked";} if ($_POST["status_sucata"] == "sim") { if ($opcoes <> " AND (") {$opcoes .= " OR ";} $opcoes .= "status = 'sucata'" ; $checkedSucata = " checked";} if ($_POST["status_roubado"]== "sim") { if ($opcoes <> " AND (") {$opcoes .= " OR ";} $opcoes .= "status = 'roubado'"; $checkedRoubado = " checked";} if($opcoes <> " AND (") { $opcoes .= ")"; } else { $opcoes = ""; } } if (($buscarE<>"") and ($buscarD=="")) { //echo "A"; $SQL = "SELECT * FROM veiculos WHERE (placa LIKE '%$buscarE%' OR marca LIKE '%$buscarE%' OR modelo LIKE '%$buscarE%' OR motor LIKE '%$buscarE%' OR chassi LIKE '%$buscarE%' OR renavan LIKE '%$buscarE%')" . $opcoes . " ORDER BY status ASC, marca ASC, modelo ASC"; } else if (($buscarD<>"") and ($buscarE=="")) { //echo "B"; $buscarDenc = encodeData($buscarD); $SQL = "SELECT * FROM veiculos WHERE (data_aquisicao = '$buscarDenc' OR data_cadastro = '$buscarDenc')" . $opcoes . " ORDER BY status ASC, data_aquisicao DESC"; } else if (($buscarD<>"") and ($buscarE<>"")) { //echo "C"; $SQL = "SELECT * FROM veiculos WHERE ((placa LIKE '%$buscarE%' OR marca LIKE '%$buscarE%' OR modelo LIKE '%$buscarE%' OR motor LIKE '%$buscarE%' OR chassi LIKE '%$buscarE%' OR renavan ) AND (data_aquisicao = '$buscarD' OR data_cadastro = '$buscarD'))" . $opcoes . " ORDER BY status ASC, marca ASC, modelo ASC"; } else { //echo "D"; if( $opcoes == "") { $SQL = "SELECT * FROM veiculos ORDER BY marca ASC, modelo ASC"; } else { $SQL = "SELECT * FROM veiculos WHERE cod_veiculo <> 'zero' ".$opcoes."ORDER BY marca ASC, modelo ASC"; } } //echo $SQL; ?> <table width="100%" border="0" cellspacing="3" cellpadding="0">
?> '; } }//FIM SUCCESS });//FIM AJAX }else{ return false; } } return false; } function lista_av_hj(){ var data_busca = '<?php echo encodeData($_GET['busca_d']); ?> '; var t = $.ajax({ type: "POST", url: "ajax/escala_eventual_hj.php", data: "d="+data_busca, success: function(xml){ var numLinhas = $(xml).find("numLinhas").text()*1; var linha_tabela = ''; if( numLinhas > 0 ){
$data = isset($_POST['data']) ? $_POST['data'] : $_GET['data']; $data = str_replace("\\\"", "\"", $data); $serializer = new SerializeRulesTaskSetting(); if (!DEV_MODE) { // SewebarConnect $id = 'VdcuecAZZEa5MTVm6E7huA'; $data = array('guid' => $id, 'content' => $serializer->serializeRules($data)); // save LM task $LM_import_path = './temp/4ft_task_' . date('md_His') . '.pmml'; $LM_import = new DOMDocument('1.0', 'UTF-8'); $LM_import->loadXML($data['content'], LIBXML_NOBLANKS); $LM_import->save($LM_import_path); // run task $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://lmcloud.vse.cz/SewebarConnect/Task/Pool"); curl_setopt($ch, CURLOPT_POSTFIELDS, encodeData($data)); curl_setopt($ch, CURLOPT_VERBOSE, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); $response = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); // save LM result $LM_export_path = './temp/4ft_result_' . date('md_His') . '.pmml'; $LM_export = new DOMDocument('1.0', 'UTF-8'); $LM_export->loadXML($response, LIBXML_NOBLANKS); $LM_export->save($LM_export_path); } else { // localhost dev env $LM_import_path = './temp/4ft_task_' . date('md_His') . '.pmml'; $LM_import = new DOMDocument('1.0', 'UTF-8');
$discriminacao7 = strtoupper($discriminacao7); $discriminacao8 = strtoupper($discriminacao8); $ab_discriminacao1 = strtoupper($ab_discriminacao1); $ab_discriminacao2 = strtoupper($ab_discriminacao2); $ab_discriminacao3 = strtoupper($ab_discriminacao3); $observacoes = strtoupper($observacoes); $v_marca = strtoupper($v_marca); $v_modelo = strtoupper($v_modelo); $v_placa = strtoupper($v_placa); $v_certificado = strtoupper($v_certificado); //CONFIGURA AS DATAS INSERIDAS $data_emissao = encodeData($data_emissao); $vencimento1 = encodeData($vencimento1); $vencimento2 = encodeData($vencimento2); $data_desc = encodeData($desc_3); //Troca virgula por ponto $frete1 = str_replace(',', '.', $frete1); $frete2 = str_replace(',', '.', $frete2); $frete3 = str_replace(',', '.', $frete3); $frete4 = str_replace(',', '.', $frete4); $frete5 = str_replace(',', '.', $frete5); $frete6 = str_replace(',', '.', $frete6); $frete7 = str_replace(',', '.', $frete7); $frete8 = str_replace(',', '.', $frete8); $ab_frete1 = str_replace(',', '.', $ab_frete1); $ab_frete2 = str_replace(',', '.', $ab_frete2); $ab_frete3 = str_replace(',', '.', $ab_frete3);
private function resolveService($service, $params, $conn) { try { //Ejecutamos la acción del controlador $response = baseController::execute($service['controller'], $params); //Comprobamos si es necesario ejecutar una tarea posterior if (isset($service['task_before_send'])) { //recogemos el nombre de la tarea. $task = $service['task_before_send']; if ($task == "attachUser") { //la información. $data = $response["task_before_send_data"]; $this->clients[$conn] = $data; } else { if ($task == "detachUser") { $this->clients->detach($conn); } else { if ($task == "requireUsersStatus") { $contactos = $response["response_message"]["data"]["msg"]; $ids = array_map(function ($contacto) { return $contacto["idRepresentado"]; }, $contactos); foreach ($this->clients as $connection) { $user = $this->clients[$connection]; //Buscamos si existe el usuario. $idx = array_search($user["id"], $ids); if (is_numeric($idx)) { $response["response_message"]["data"]["msg"][$idx]["status"] = "conectado"; } } } } } } //Codificamos los datos de la respuesta. encodeData($response["response_message"]['data']['msg']); //Enviamos la respuesta al emisor. $this->send($conn, json_encode($response["response_message"])); //Si el servicio debe notificar a otros clientes if ($service['throw_event']) { //Obtenemos los targets $targets = $response["event_message"]["targets"]; //Los eliminamos del evento unset($response["event_message"]["targets"]); if (is_array($targets) && sizeof($targets)) { //recogemos ids parra facilitar búsqueda. $ids = array_map(function ($target) { return $target["id"]; }, $targets); //recorremos usuarios conectados. foreach ($this->clients as $connection) { $user = $this->clients[$connection]; //Buscamos si existe el usuario. $idx = array_search($user["id"], $ids); if (is_numeric($idx)) { //existe, le notificamos el evento. $this->send($connection, json_encode(array_merge($response["event_message"], $targets[$idx]))); } } } } } catch (Exception $e) { echo $e->getMessage(); } }
$sql1 .= "celular = '".$FR_celular."', "; $sql1 .= "status_func = '".$FR_status_func."', "; $sql1 .= "hr_saida = '".$FR_hr_saida."', "; $sql1 .= "hr_entrada = '".$FR_hr_entrada."', "; $sql1 .= "hr_intervalo = '".$FR_hr_intervalo."', "; $sql1 .= "nextel = '".$FR_nextel."' "; //$sql1 .= "cod_usu"; $sql2 . '".$FR_nextel."' "; $sql .= $sql1." WHERE cod_func = '$FR_cod_func'"; $resultado = mysql_query($sql) or die(mysql_error()); $codigo_funcionario = $FR_cod_func; if(isset($_SESSION['dependentes_func'])){ if(count($_SESSION['dependentes_func']) > 0){ foreach($_SESSION['dependentes_func'] as $banco){ if($banco[1] != ''){ $sqlBanco = "INSERT INTO funcionarios_dependentes (id_func,grau_dependente,data_nasc, nr_registro, local) VALUES ('". $codigo_funcionario ."','". $banco[0] ."','". encodeData($banco[1]) ."','". $banco[2] ."','". $banco[3] ."');"; $resBanco = mysql_query($sqlBanco); } } } } ?> <script type="text/javascript"> window.location = "rh_funcionario_ver.php"; </script>
function encodeData2($str = '') { return addslashes(encodeData($str)); // adding double }
/*02*/ $FR_marca = $_POST["marca"]; $sql .= "marca = '$FR_marca', "; // 02 /*03*/ $FR_modelo = $_POST["modelo"]; $sql .= "modelo = '$FR_modelo', "; // 03 /*04*/ $FR_ano_m = $_POST["ano_m"]; $sql .= "ano_modelo = '$FR_ano_m', "; // 04 /*05*/ $FR_ano_f = $_POST["ano_f"]; $sql .= "ano_fabricacao = '$FR_ano_f', "; // 05 /*06*/ $FR_motor = $_POST["motor"]; $sql .= "motor = '$FR_motor', "; // 06 /*07*/ $FR_chassi = $_POST["chassi"]; $sql .= "chassi = '$FR_chassi', "; // 07 /*08*/ $FR_renavan = $_POST["renavan"]; $sql .= "renavan = '$FR_renavan', "; // 08 /*09*/ $FR_acessorios = $_POST["acessorios"]; $sql .= "acessorios = '$FR_acessorios', "; // 09 /*10*/ $FR_lotacao = $_POST["lotacao"]; $sql .= "lotacao = '$FR_lotacao', "; // 10 /*11*/ $FR_eventual = $_POST["eventual"]; $sql .= "eventual = '$FR_eventual', "; // 11 /*12*/ $FR_status = $_POST["status"]; $sql .= "status = '$FR_status', "; // 12 /*13*/ $FR_dt_sts = encodeData($_POST["data_status"]); $sql .= "data_status = '$FR_dt_sts', "; // 13 /*14*/ $FR_obs_status = $_POST["obs_status"]; $sql .= "obs_status = '$FR_obs_status', "; // 14 /*15*/ $FR_aqui = encodeData($_POST["aquisicao"]); $sql .= "data_aquisicao = '$FR_aqui', "; // 15 /*16*/ $FR_obs = $_POST["obs"]; $sql .= "obs = '$FR_obs', "; // 16 /*17*/ $FR_cad = encodeData($_POST["cadastro"]); $sql .= "data_cadastro = '$FR_cad', "; // 17 /*18*/ $FR_alt = date("Y-m-d"); $sql .= "data_alteracao = '$FR_alt', "; // 18 /*19*/ $FR_cod_usu = $cod_usu; $sql .= "cod_usu = '$FR_cod_usu'"; // 19 $sql .= " WHERE cod_veiculo = '$FR_cod'"; $resultado = mysql_query($sql) or die(mysql_error()); } /* se o status é "ROUBADO" ou "VENDIDO" ou "SUCATA" torna "NÃO USADO" o status do prefixo à que este veículo pertencia e insere uma nova movimentação no histórico referente a este prefixo */ if (($FR_status=="vendido")||($FR_status=="sucata")||($FR_status=="roubado")) { $b_veiculo_antigo = mysql_query("SELECT * FROM prefixo WHERE cod_veiculo = '$FR_cod'");
<?php // data encoding function encodeData($array) { $data = ""; foreach ($array as $key => $value) { $data .= "{$key}=" . urlencode($value) . '&'; } return $data; } // prepare data $id = 'VdcuecAZZEa5MTVm6E7huA'; $data = encodeData(array('guid' => $id, 'content' => file_get_contents('./barboraForLMImport.pmml'))); // register MB $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://lmcloud.vse.cz/SewebarConnect/DataDictionary/Import'); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_VERBOSE, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); $response = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); echo $response;
<?php // data encoding function encodeData($array) { $data = ""; foreach ($array as $key => $value) { $data .= "{$key}=" . urlencode($value) . '&'; } return $data; } // prepare data $data = encodeData(array('type' => 'AccessConnection')); // register MB $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://lmcloud.vse.cz/SewebarConnect/Application/Register'); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_VERBOSE, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); $response = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); preg_match('*id="([a-zA-Z0-9_]{1,})"*', $response, $matches); $id = $matches[1]; echo $id;
//window.alert('<?php echo $_GET["occasion"]; ?> \n<?php echo $_SESSION["occasion"]; ?> \n<?php echo addslashes($_SESSION["occasion"]); ?> '); <?php if (isset($_SESSION["boxtype"])) { echo "jQuery('#box-type').val('" . $_SESSION["boxtype"] . "');updateVals();\n"; } if (isset($_SESSION["occasion"])) { echo "jQuery('#occasion').val(\"" . encodeData($_SESSION["occasion"]) . "\");updateVals();\n"; } //if(isset($_SESSION["cardcolor"])){ echo "jQuery('#card-color').val('" . $_SESSION["cardcolor"] . "');updateVals(); jQuery( '.product-image' ).css('background-image', 'url(" . do_shortcode('[site_url]') . "/wp-content/themes/flatterbox/images/" . $_SESSION["boxtype"] . "-" . $_SESSION["boxcolor"] . "-" . $_SESSION["cardcolor"] . ".png)');var tempBackground = jQuery('.product-image').css('background-image');selectedBoxImage = tempBackground.replace('url(','').replace(')','');\n"; } if (isset($_SESSION['cardcolor'])) { echo 'updateVals();jQuery(".product-image" ).css("background-image", "url("+selectedColorImg+")");'; } if (isset($_SESSION["boxprice"])) { echo "jQuery('#card-count').val('" . $_SESSION["boxprice"] . "');updateVals();selectCount = jQuery( '#card-count option:selected' ).val();jQuery('#price-dollar').html(selectCount);\n"; } ?> function getQry(obj) { var queryString = unescape(location.search); if (!queryString) { return '';
if ($services[$service]['token_required']) { //Comprobamos si el token de sesión está presente en la petición. if ($token) { //decodificamos el token de sesión. $token = json_decode(base64_decode($token)); if (!is_null($params)) { if (!is_array($params)) { $params = (array) json_decode($params, true); } $params = $encode ? decodeParams($params) : $params; } //Ejecutamos la acción del controlador $response = baseController::execute($services[$service]['controller'], $params); //Codificamos los datos de la respuesta. if ($encode) { encodeData($response["response_message"]['data']['msg']); } //Enviamos respuesta echo json_encode($response["response_message"]); } else { echo json_encode(array("error" => true, "data" => "Acceso no permitido")); } } } else { echo json_encode(array("error" => true, "data" => "Servicio no disponible")); } } else { header($_SERVER['SERVER_PROTOCOL'] . " 500 Internal Error", true, 500); } } else { header($_SERVER['SERVER_PROTOCOL'] . " 400 Bad Request", true, 400);
} function encodeData($data) { $dia = substr($data, 0, 2); $mes = substr($data, 3, 2); $ano = substr($data, 6, 4); $data_retorno = $ano . '-' . $mes . '-' . $dia; return $data_retorno; } if (isset($_SESSION["verifica"])) { if (isset($_POST['data1'])) { $i = 1; while (isset($_POST['data' . $i])) { $data = $_POST['data' . $i]; if ($data) { $data = encodeData($data); } $id_func = $_POST['id_nome_busca']; $j = $i * 10; foreach ($_POST['inicio' . $i] as $qualquer) { if ($data != '--') { $texto[$j] = "INSERT INTO funcionarios_horas VALUES (null,'{$id_func}','{$data}',"; } $j++; } $j = $i * 10; foreach ($_POST['inicio' . $i] as $key => $value) { if ($value) { $valor = HoraToInt($value); $texto[$j] = $texto[$j] . "'{$value}:00',"; } else {