public static function request($param, $filtrar = true) { $v = Leer::get($param, $filtrar); if ($v == null) { $v = Leer::post($param, $filtrar); } return $v; }
<?php require '../require/comun.php'; //este metodo comprueba que estas atuentificado en la sesion como ROOT $sesion->administrador("../usuario/viewalta.php"); // $objeto = new Inmueble(); $id = Leer::post("id"); $titulo = LEER::post("titulo"); $descripcion = LEER::post("descripcion"); $estado = strtolower(LEER::post("estado")); $precio = (double) LEER::post("precio"); $localidad = LEER::post("localidad"); $provincia = LEER::post("provincia"); $tipo = strtolower(LEER::post("tipo")); $calle = LEER::post("superficie"); $superficie = (int) LEER::post("superficie"); $cp = (int) LEER::post("cp"); $objetivo = strtolower(LEER::post("objetivo")); //validamos y añadimos $objeto->setId($id); $objeto->setEstado($estado); $objeto->setObjetivo($objetivo); $objeto->setTipo($tipo); $objeto->setDescripcion($descripcion); if (Validar::isLongitudMinima($titulo, 6)) { $objeto->setTitulo($titulo); } else { } if (Validar::isLongitudMinima($localidad, 3)) { $objeto->setLocalidad($localidad);
if (Leer::get("p")) { $inicio = Leer::get("p"); } else { $inicio = 0; } if (Leer::post("rpp")) { $rpp = Leer::post("rpp"); } else { $rpp = 10; } $ids = array(); if (Leer::post("token")) { $tipo = strtolower(Leer::post("tipo")); $estado = strtolower(Leer::post("estado")); $voa = strtolower(Leer::post("voa")); $orden = "precio " . Leer::post("orden"); if ($voa != "") { $condicion = "tipo = '{$tipo}' AND estado= '{$estado}' AND objetivo= '{$voa}'"; $filas = $modelo->getList($inicio, $rpp, $condicion); } else { $condicion = "tipo = '{$tipo}' AND estado= '{$estado}'"; $filas = $modelo->getList($inicio, $rpp, $condicion); } foreach ($filas as $indice => $object) { $ids[] = $object->getId(); } $filasfotos = $modeloFoto->getListDe($ids); } else { $filas = $modelo->getList($inicio, $rpp); $filasfotos = $modeloFoto->getList($inicio, $rpp * 2); }
function insertDoPaypal() { $idpaypal = Leer::post("txn_id"); $idpropio = Leer::post("item_name"); $estado = Leer::post("payment_status"); $importe = Leer::post("mc_gross"); $moneda = Leer::post("mc_currency"); $emailvendedor = Leer::post("receiver_email"); $emailcomprador = Leer::post("payer_email"); $bd = new BaseDatos(); $modelopaypal = new ModeloPaypal($bd); $modeloventa = new ModeloVenta($bd); $venta = $modeloventa->get($idpropio); $paypal = new Paypal($idpaypal, $idpropio, $estado, $importe, $moneda, $emailvendedor, $emailcomprador); $modelopaypal->add($paypal); $cURL = curl_init(); curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($cURL, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($cURL, CURLOPT_URL, "https://www.sandbox.paypal.com/cgi-bin/webscr"); curl_setopt($cURL, CURLOPT_ENCODING, 'gzip'); curl_setopt($cURL, CURLOPT_BINARYTRANSFER, true); curl_setopt($cURL, CURLOPT_POST, true); $_POST['cmd'] = '_notify-validate'; curl_setopt($cURL, CURLOPT_POSTFIELDS, $_POST); curl_setopt($cURL, CURLOPT_HEADER, false); curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true); curl_setopt($cURL, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); curl_setopt($cURL, CURLOPT_FORBID_REUSE, true); curl_setopt($cURL, CURLOPT_FRESH_CONNECT, true); curl_setopt($cURL, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($cURL, CURLOPT_TIMEOUT, 60); curl_setopt($cURL, CURLINFO_HEADER_OUT, true); curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Connection: close', 'Expect: ')); $respuesta = curl_exec($cURL); $estatus = (int) curl_getinfo($cURL, CURLINFO_HTTP_CODE); file_put_contents("errores.txt", $respuesta . "\n", FILE_APPEND); file_put_contents("errores.txt", $estatus . "\n", FILE_APPEND); file_put_contents("errores.txt", strcmp($respuesta, "VERIFIED") . "\n", FILE_APPEND); if (strcmp($respuesta, "VERIFIED") == 0) { $venta->setPago("si"); $r = $modeloventa->edit($venta); } else { $venta->setPago("rev"); $r = $modeloventa->edit($venta); } curl_close($cURL); }
<?php require '../require/comun.php'; $login = Leer::post("login"); if (Validar::isLogin($login) === FALSE) { header("Location: ../index.php?er=-4"); exit; } $clave = sha1(Leer::post("key")); $bd = new BaseDatos(); $modelo = new ModeloUsuario($bd); $objeto = $modelo->login($login, $clave); if ($objeto instanceof Usuario) { $sesion->setUsuario($objeto); header("Location: ../ap-admin/panel.php"); } else { if ($objeto == -2) { header("Location: ../ap-admin?er={$r}"); } else { $sesion->destroy(); header("Location: ../index.php?er={$r}"); } }