Jump to content

JerryTellez

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by JerryTellez

  1. Thank you, it turns out strict mode got enabled in MariaDB after update, after disabling it through terminal and restarting sql it now saved data correctly. I will also follow the suggestions made to improve the code!
  2. Im not a PHP expert, quite new, It is a reservation system, it was previously built on 5.6 and the server owner just decided to updated to MariaDB 10 and PHP 7.3 without giving a notice. The Mysqli errors have been fixed and all the queries should be connected correctly, However there is this persistent issue that was not present before the update, clients try to make a One Way reservation (Value 1 in $id_traslado) but the data is not sent and stored in the DB so admins can see the reservation, but if clients do a Round Trip reservation (Value 2 in $id_traslado) it works perfectly. I dont get any errors in the error log but I cannot seem to find the issue. This is the file where clients submit their info, the $iGuardo checks if a reservation was succesfully saved and should send a 1 value. <?php $Total = 0; if($_POST['idTarifa']!=0){ $dt = new reg_DeTarifas($_POST['idTarifa']); $reg_Paquetes = new reg_Paquetes($dt->getId_paquete()); $reg_Traslados = new reg_Traslados($dt->getId_traslado()); $reg_Aeropuertos = new reg_Aeropuertos($dt->getId_lugar_origen()); $reg_Lugares = new reg_Lugares($dt->getId_lugar_destino()); if ($dt->getId_paquete() == 1) { $Total = ($dt->getCosto())*($_POST['iPasajeros']); } } $mr = new reg_MaResevaciones(); $mr->setNombre($_POST['TxtNombre']); $mr->setPaterno($_POST['TxtPaterno']); $mr->setDireccion($_POST['TxtDireccion']); $mr->setCiudad($_POST['TxtCiudad']); $mr->setEstado($_POST['TxtEstado']); $mr->setCP($_POST['TxtCP']); $mr->setPais($_POST['TxtPais']); $mr->setTelefono($_POST['TxtTelefono']); $mr->setCelular($_POST['TxtCelular']); $mr->setCorreo($_POST['TxtEmail']); $mr->setId_tarifa($_POST['idTarifa']); $mr->setOtherAirport($_POST['SAirport']); $mr->setIdPaquete($_POST['idPaquete']); $mr->setIdTraslado($_POST['idTraslado']); $mr->setIdHotel($_POST['idHotel']); $mr->setAerolinea($_POST['TxtAerolinea']); $mr->setNo_vuelo($_POST['TxtNoVuelo']); $HoraFormateada = date('H:i:s', strtotime($_POST['TxtHora'])); if(isset($_POST['TxtNoches'])){ $TxtNoches = $_POST['TxtNoches'];} else{ $TxtNoches = 0;} if(isset($_POST['TxtFechaSalida'])){ $TxtFechaSalida = $_POST['TxtFechaSalida'];} else{ $TxtFechaSalida = null;} if(isset($_POST['TxtAerolineaSalida'])){ $TxtAerolineaSalida = $_POST['TxtAerolineaSalida'];} else{ $TxtAerolineaSalida = '';} if(isset($_POST['TxtNoVueloSalida'])){ $TxtNoVueloSalida = $_POST['TxtNoVueloSalida'];} else{ $TxtNoVueloSalida = 0;} if(isset($_POST['TxtHoraSalida'])) { $TxtHoraSalida = date('H:i:s', strtotime($_POST['TxtHoraSalida'])); } else { $TxtHoraSalida = null; } $mr->setHora_vuelo($HoraFormateada); $mr->setNo_noches($TxtNoches); $mr->setFecha_salida($TxtFechaSalida); $mr->setAerolinea_salida($TxtAerolineaSalida); $mr->setNo_vuelo_salida($TxtNoVueloSalida); $mr->setHora_vuelo_salida($TxtHoraSalida); $mr->setInfo_adicional($_POST['TxtInfo']); $mr->setPasajeros($_POST['iPasajeros']); $mr->setPeticiones_adicionales($_POST['TxtInfoA']); $mr->setFecha_llegada($_POST['TxtFecha']); $mr->setTipo($_POST['Tipo']); $mr->setTotal($_POST['hidTotal']); $VIP_Service = 0; if(isset($_POST['cmbVIP']) && $_POST['cmbVIP']==1){ if(isset($_POST['cerv']) && $_POST['cerv']>0){ $VIP_Service = $_POST['cerv']; }elseif(isset($_POST['ref']) && $_POST['ref']>0){ $VIP_Service = $_POST['ref']; }elseif(isset($_POST['vino']) && 0 < $_POST['vino']) { $VIP_Service = $_POST['vino']; } } if(isset($_POST['cmbGrocery'])) $cmbGrocery = $_POST['cmbGrocery']; else $cmbGrocery = 0; $mr->setVip($VIP_Service); $mr->setGrocery($cmbGrocery); $mr->setTipoCobro($_POST['cmbTipoCobro']); $iGuardo = $mr->guardar(); $to = $_POST['TxtEmail']; $from = "MAILHERE"; $subject = "Reservation Request Received ".$mr->getNombre()." ".$mr->getPaterno(); $body = ' <html> #MAIL BODY NO ISSUES HERE </html> '; $body2 = ' <html> #MAIL BODY NO ISSUES HERE </html> '; $to = preg_replace("([\r\n])", "", $to); $from = preg_replace("([\r\n])", "", $from); $subject = preg_replace("([\r\n])", "", $subject); $match = "/(bcc:|cc:|content\-type:)/i"; if(preg_match($match, $from) || preg_match($match, $subject) || preg_match($match, $body)) { die("Header injection detected."); } $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-Type: text/html; charset="iso-8859-1" \r\n'; $headers = "From: ".$from."\r\n"; $headers .= "Reply-to: ".$from."\r\n"; $headers .= 'Content-Type: text/html; charset="iso-8859-1" \r\n'; $headers .= 'X-Mailer: PHP/' . phpversion(). "\r\n"; // send mail //if(*mail($to,$subject,$body,$headers)){ if(mail($to,$subject,$body,$headers)){ #EMAILS ARE SENT HERE WITHOUT PROBLEM } if (isset($_POST['hidTotal']) && !empty($_POST['hidTotal']) && strlen(trim($_POST['hidTotal']))>1) { $precio = base64_encode(trim($_POST['hidTotal'])); $idres = base64_encode($iGuardo); $sCodedTF = hash('sha256',hash('sha256','a1b2c3d4e5'.base64_encode(base64_encode($precio)).'a1b2c3d4e5')); $sCodedIR = hash('sha256',hash('sha256','f6g7h8i9j0'.base64_encode(base64_encode($idres)).'f6g7h8i9j0')); } if($VIP_Service!=0){ include("Connection/nrc.php"); $sqlvip = "INSERT INTO de_vip (res,vip1,vip2,vip3,cant1,cant2,cant3) VALUES (".$iGuardo.",".$_POST['cerv'].",".$_POST['ref'].",".$_POST['vino'].",".$_POST['marcerv'].",".$_POST['marref'].",".$_POST['marvin'].");"; $resvip = mysqli_query($nrc,$sqlvip) or die(mysqli_error()); } if(($iGuardo == 0)||($iGuardo == NULL)){ ?> <script type="text/javascript"> window.location="error.php"; </script> <? header("Location:error.php");} else{ if ($mr->getTipoCobro() != 1) { echo ""; ?> <script type="text/javascript"> window.location="success.php?true=1"; </script> <? header("Location:success.php?true=1"); } else ?> <script type="text/javascript"> window.location="<? echo "final.php?true=1&w=".$sCodedTF.'&m='.$precio.'&v='.$sCodedIR.'&a='.$idres; ?>"; </script> <? } } Here is the file that has the function that gets the reservation saved in the DB [guardar()], there are no issues if id_traslado is 2 but it its 1, it seems to not save the submitted info correctly. <?php public function guardar(){ if (null != $this->getFecha_salida() || '00/00/0000' != $this->getFecha_salida()) { $salida = date('Y-m-d', strtotime($this->getFecha_salida())); } else { $salida = '0000-00-00'; } if (null != $this->getFecha_llegada()) { $llegada = date('Y-m-d', strtotime($this->getFecha_llegada())); } else { $salida = '0000-00-00'; } if ($this->getHora_vuelo('H:i:s') == null) { $hora_vuelo = "'NULL'"; } else { $hora_vuelo = "'".$this->getHora_vuelo()."'"; } if ($this->getHora_vuelo_salida('H:i:s') == null) { $hora_vuelo_salida = "'NULL'"; } else { $hora_vuelo_salida = "'".$this->getHora_vuelo_salida()."'"; } if($this->getId()>0){#si se cumple la condicion hace un update en la tabla cat_Lugares $mysqli = new mysqli("localhost", "root", "????", "niceridecabo"); $sql = "UPDATE ma_reservaciones SET nombre='".$this->getNombre()."', paterno='".$this->getPaterno()."', materno='".$this->getMaterno()."', direccion='".$this->getDireccion()."', ciudad='".$this->getCiudad()."', estado='".$this->getEstado()."', cp='".$this->getCP()."', pais='".$this->getPais()."', telefono='".$this->getTelefono()."', celular='".$this->getCelular()."', correo='".$this->getCorreo()."', id_tarifa=".$this->getId_tarifa().", aerolinea='".$this->getAerolinea()."', no_vuelo='".$this->getNo_vuelo()."', hora_vuelo=".$hora_vuelo.", no_noches='".$this->getNo_noches()."', fecha_salida='".$salida."', aerolinea_salida='".$this->getAerolinea_salida()."', no_vuelo_salida='".$this->getNo_vuelo_salida()."', hora_vuelo_salida=".$hora_vuelo_salida.", info_adicional='".$this->getInfo_adicional()."', pasajeros=".$this->getPasajeros().", peticiones_adicionales='".$this->getPeticiones_adicionales()."', fecha_llegada='".$llegada."', OtherAirport='".$this->getOtherAirport()."', IdPaquete=".$this->getIdPaquete().", IdTraslado=".$this->getIdTraslado().", IdHotel=".$this->getIdHotel().", vip=".$this->getVip().", total=".$this->getTotal().", id_tipocobro=".$this->getTipoCobro().", pagado=".$this->getPagado().", grocery=".$this->getGrocery()." WHERE id_reservacion = ".$this->getId().";"; if($mysqli->multi_query($sql)){ $this->setMsg('La reservacion se modifico correctamente.'); return 1; }else{ $this->setMsg('Error al modificar la reservacion.'); return 0; } }else{#en caso de que entre en el else se hace un insert sobre la tabla cat_Lugares $mysqli = new mysqli("localhost", "root", "????", "niceridecabo"); $sql ="INSERT INTO ma_reservaciones (nombre,paterno,materno,direccion,ciudad,estado,cp,pais,telefono,celular,correo,id_tarifa,aerolinea,no_vuelo,hora_vuelo,no_noches,fecha_salida,aerolinea_salida,no_vuelo_salida,hora_vuelo_salida,info_adicional,pasajeros,peticiones_adicionales,fecha_llegada,OtherAirport,IdPaquete,IdTraslado,IdHotel,tipo,total,fec_creacion,id_tipocobro,grocery,vip) VALUES ('".$this->getNombre()."','".$this->getPaterno()."','".$this->getMaterno()."','".$this->getDireccion()."','".$this->getCiudad()."','".$this->getEstado()."','".$this->getCP()."','".$this->getPais()."','".$this->getTelefono()."','".$this->getCelular()."','".$this->getCorreo()."',".$this->getId_tarifa().",'".$this->getAerolinea()."','".$this->getNo_vuelo()."',".$hora_vuelo.",".$this->getNo_noches().",'".$salida."','".$this->getAerolinea_salida()."','".$this->getNo_vuelo_salida()."',".$hora_vuelo_salida.",'".$this->getInfo_adicional()."',".$this->getPasajeros().",'".$this->getPeticiones_adicionales()."','".$llegada."','".$this->getOtherAirport()."',".$this->getIdPaquete().",".$this->getIdTraslado().",".$this->getIdHotel().",'".$this->getTipo()."',".$this->getTotal().",sysdate(),".$this->getTipoCobro().",".$this->getGrocery().",".$this->getVip().");"; if($mysqli->multi_query($sql)){ $this->setMsg('Reservation request received successfully.'); return $mysqli->insert_id; }else{ $this->setMsg('Something wrong happened while making the reservation.'); return 0; } } }
  3. Thanks for the advice, I'm someone new to code, specially PHP so from what I could gather $iGuardo gets a Null or 0 but only when the user is making a One Way reservation: ..... I previously called for dbs and some html.<?php }else{ //$_SERVER['DOCUMENT_ROOT'] = " /home/juancar0/public_html"; require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_maReservaciones.php'); //$_SERVER['DOCUMENT_ROOT'] = " /home/juancar0/public_html"; require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_deTarifas.php'); //$_SERVER['DOCUMENT_ROOT'] = " /home/juancar0/public_html"; require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_paquetes.php'); //$_SERVER['DOCUMENT_ROOT'] = " /home/juancar0/public_html"; require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_traslados.php'); //$_SERVER['DOCUMENT_ROOT'] = " /home/juancar0/public_html"; require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_aeropuertos.php'); //$_SERVER['DOCUMENT_ROOT'] = " /home/juancar0/public_html"; require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_lugares.php'); $Total = 0; if($_POST['idTarifa']!=0){ $dt = new reg_DeTarifas($_POST['idTarifa']); $reg_Paquetes = new reg_Paquetes($dt->getId_paquete()); $reg_Traslados = new reg_Traslados($dt->getId_traslado()); $reg_Aeropuertos = new reg_Aeropuertos($dt->getId_lugar_origen()); $reg_Lugares = new reg_Lugares($dt->getId_lugar_destino()); if ($dt->getId_paquete() == 1) { $Total = ($dt->getCosto())*($_POST['iPasajeros']); } }#if($_POST['idTarifa']!=0) $mr = new reg_MaResevaciones(); $mr->setNombre($_POST['TxtNombre']); $mr->setPaterno($_POST['TxtPaterno']); $mr->setDireccion($_POST['TxtDireccion']); $mr->setCiudad($_POST['TxtCiudad']); $mr->setEstado($_POST['TxtEstado']); $mr->setCP($_POST['TxtCP']); $mr->setPais($_POST['TxtPais']); $mr->setTelefono($_POST['TxtTelefono']); $mr->setCelular($_POST['TxtCelular']); $mr->setCorreo($_POST['TxtEmail']); $mr->setId_tarifa($_POST['idTarifa']); $mr->setOtherAirport($_POST['SAirport']); $mr->setIdPaquete($_POST['idPaquete']); $mr->setIdTraslado($_POST['idTraslado']); $mr->setIdHotel($_POST['idHotel']); $mr->setAerolinea($_POST['TxtAerolinea']); $mr->setNo_vuelo($_POST['TxtNoVuelo']); $HoraFormateada = date('H:i:s', strtotime($_POST['TxtHora'])); if(isset($_POST['TxtNoches'])){ $TxtNoches = $_POST['TxtNoches'];} else{ $TxtNoches = 0;} if(isset($_POST['TxtFechaSalida'])){ $TxtFechaSalida = $_POST['TxtFechaSalida'];} else{ $TxtFechaSalida = null;} if(isset($_POST['TxtAerolineaSalida'])){ $TxtAerolineaSalida = $_POST['TxtAerolineaSalida'];} else{ $TxtAerolineaSalida = '';} if(isset($_POST['TxtNoVueloSalida'])){ $TxtNoVueloSalida = $_POST['TxtNoVueloSalida'];} else{ $TxtNoVueloSalida = 0;} if(isset($_POST['TxtHoraSalida'])) { $TxtHoraSalida = date('H:i:s', strtotime($_POST['TxtHoraSalida'])); } else { $TxtHoraSalida = null; } $mr->setHora_vuelo($HoraFormateada); $mr->setNo_noches($TxtNoches); $mr->setFecha_salida($TxtFechaSalida); $mr->setAerolinea_salida($TxtAerolineaSalida); $mr->setNo_vuelo_salida($TxtNoVueloSalida); $mr->setHora_vuelo_salida($TxtHoraSalida); $mr->setInfo_adicional($_POST['TxtInfo']); $mr->setPasajeros($_POST['iPasajeros']); $mr->setPeticiones_adicionales($_POST['TxtInfoA']); $mr->setFecha_llegada($_POST['TxtFecha']); $mr->setTipo($_POST['Tipo']); $mr->setTotal($_POST['hidTotal']); $VIP_Service = 0; if(isset($_POST['cmbVIP']) && $_POST['cmbVIP']==1){ if(isset($_POST['cerv']) && $_POST['cerv']>0){ $VIP_Service = $_POST['cerv']; }elseif(isset($_POST['ref']) && $_POST['ref']>0){ $VIP_Service = $_POST['ref']; }elseif(isset($_POST['vino']) && 0 < $_POST['vino']) { $VIP_Service = $_POST['vino']; } } if(isset($_POST['cmbGrocery'])) $cmbGrocery = $_POST['cmbGrocery']; else $cmbGrocery = 0; $mr->setVip($VIP_Service); $mr->setGrocery($cmbGrocery); $mr->setTipoCobro($_POST['cmbTipoCobro']); $iGuardo = $mr->guardar(); $to = $_POST['TxtEmail']; $from = "ericka@niceridecabo.com"; $subject = "Reservation Request Received ".$mr->getNombre()." ".$mr->getPaterno(); $body = ' <html> <head> <title></title> </head> <body> ##MAIL GETS SENT CORRECTLY </table> </body> </html> '; $to = preg_replace("([\r\n])", "", $to); $from = preg_replace("([\r\n])", "", $from); $subject = preg_replace("([\r\n])", "", $subject); $match = "/(bcc:|cc:|content\-type:)/i"; if(preg_match($match, $from) || preg_match($match, $subject) || preg_match($match, $body)) { die("Header injection detected."); } $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-Type: text/html; charset="iso-8859-1" \r\n'; $headers = "From: ".$from."\r\n"; $headers .= "Reply-to: ".$from."\r\n"; $headers .= 'Content-Type: text/html; charset="iso-8859-1" \r\n'; $headers .= 'X-Mailer: PHP/' . phpversion(). "\r\n"; // send mail //if(*mail($to,$subject,$body,$headers)){ if(mail($to,$subject,$body,$headers)){ if(mail('#mailgoeshere',$subject,$body2,$headers)){ mail('#mailgoeshere',$subject,$body2,$headers); } else{ mail('#mailgoeshere','Error sending to #mailgoeshere',$body2,$headers); } $msgMail = ". Email sent successfully"; } else{ $msgMail = ". Error sending email"; } if (isset($_POST['hidTotal']) && !empty($_POST['hidTotal']) && strlen(trim($_POST['hidTotal']))>1) { $precio = base64_encode(trim($_POST['hidTotal'])); $idres = base64_encode($iGuardo); $sCodedTF = hash('sha256',hash('sha256','a1b2c3d4e5'.base64_encode(base64_encode($precio)).'a1b2c3d4e5')); $sCodedIR = hash('sha256',hash('sha256','f6g7h8i9j0'.base64_encode(base64_encode($idres)).'f6g7h8i9j0')); } if($VIP_Service!=0){ include("Connection/nrc.php"); $sqlvip = "INSERT INTO de_vip (res,vip1,vip2,vip3,cant1,cant2,cant3) VALUES (".$iGuardo.",".$_POST['cerv'].",".$_POST['ref'].",".$_POST['vino'].",".$_POST['marcerv'].",".$_POST['marref'].",".$_POST['marvin'].");"; $resvip = mysqli_query($nrc,$sqlvip) or die(mysqli_error()); } if(($iGuardo == 0)||($iGuardo == NULL)){ ?> <script type="text/javascript"> window.location="error.php"; </script> <? header("Location:error.php");} else{ if ($mr->getTipoCobro() != 1) { echo ""; ?> <script type="text/javascript"> window.location="success.php?true=1"; </script> <? header("Location:success.php?true=1"); } else ?> <script type="text/javascript"> window.location="<? echo "final.php?true=1&w=".$sCodedTF.'&m='.$precio.'&v='.$sCodedIR.'&a='.$idres; ?>"; </script> <? } } The error possibly lies in the reservation registration, as it does not show in the DB but Round Trips show up and have no errors. When a user selects One Way or Round Trip, the variable used for it is id_traslado. as gizmola mentioned is probably the jump to PHP 7.3 but the error log shows no errors. <?php //$_SERVER['DOCUMENT_ROOT'] = " /home/juancar0/public_html"; require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/funciones.php'); //$_SERVER['DOCUMENT_ROOT'] = " /home/juancar0/public_html"; require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_deTarifas.php'); //$_SERVER['DOCUMENT_ROOT'] = " /home/juancar0/public_html"; require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_aeropuertos.php'); //$_SERVER['DOCUMENT_ROOT'] = " /home/juancar0/public_html"; require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_status.php'); //$_SERVER['DOCUMENT_ROOT'] = " /home/juancar0/public_html"; require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_testimonial.php'); require_once $_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_deReservacionesSpecial.php'; class reg_MaResevaciones{ private $id = 0; private $nombre = ''; private $paterno = ''; private $materno = ''; private $direccion = ''; private $ciudad =''; private $estado = ''; private $cp = ''; private $pais = ''; private $telefono = ''; private $celular = ''; private $correo = ''; private $id_tarifa = 0; private $aerolinea = ''; private $no_vuelo = ''; private $hora_vuelo = null; private $no_noches = 0; private $fecha_salida = ''; // string (yyyy-mm-dd) private $fecha_salida_dt = 0; // datetime private $aerolinea_salida = ''; private $no_vuelo_salida = ''; private $hora_vuelo_salida = null; private $info_adicional = ''; private $pasajeros = 0; private $peticiones_adicionales = ''; private $fecha_llegada = ''; // string (yyyy-mm-dd) private $fecha_llegada_dt = 0; // datetime private $id_status = 0; private $OtherAirport = ''; private $id_paquete = 0; private $id_traslado = 0; private $id_hotel = 0; private $tipo = ''; private $total = 0; private $fecha_creacion = ''; private $tipocobro = 0; private $vip = 0; private $grocery = 0; private $folioSCT = ''; private $ipickup_time = null; private $ipickup_date = ''; private $dpickup_time = null; private $dpickup_date = ''; private $msg = ''; private $oTarifa = NULL; private $pagado = 0; private $oEsp = null; // instancia del objeto reg_deReservacionEspecial correspondiente public function __construct($id_reservacion=0){ if($id_reservacion>0){ $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo"); $sql = "SELECT * FROM ma_reservaciones WHERE id_reservacion ='".$id_reservacion."'"; //$sql = "call pa_SelMaResevaciones_filter (".$id_reservacion.")"; $mysqli->multi_query($sql); if($result = $mysqli->store_result()){ while ($dato = $result->fetch_row()){ $this->setId($dato[0]); $this->setNombre($dato[1]); $this->setPaterno($dato[2]); $this->setMaterno($dato[3]); $this->setDireccion($dato[4]); $this->setCiudad($dato[5]); $this->setEstado($dato[6]); $this->setCP($dato[7]); $this->setPais($dato[8]); $this->setTelefono($dato[9]); $this->setCelular($dato[10]); $this->setCorreo($dato[11]); $this->setId_tarifa($dato[12]); $this->setAerolinea($dato[13]); $this->setNo_vuelo($dato[14]); $this->setHora_vuelo($dato[15]); $this->setNo_noches($dato[16]); $this->setFecha_salida($dato[17]); $this->fecha_salida_dt = strtotime($dato[17]); $this->setAerolinea_salida($dato[18]); $this->setNo_vuelo_salida($dato[19]); $this->setHora_vuelo_salida($dato[20]); $this->setInfo_adicional($dato[21]); $this->setPasajeros($dato[22]); $this->setPeticiones_adicionales($dato[23]); $this->fecha_llegada = $dato[24]; $this->fecha_llegada_dt = strtotime($dato[24]); $this->setId_status($dato[25]); $this->setOtherAirport($dato[26]); $this->setIdPaquete($dato[27]); $this->setIdTraslado($dato[28]); $this->setIdHotel($dato[29]); $this->setTipo($dato[30]); $this->setTotal($dato[31]); $this->setFecha_creacion($dato[32]); $this->setTipoCobro($dato[33]); $this->setVip($dato[39]); $this->setGrocery($dato[40]); #informacion del voucher $this->folioSCT = $dato[34]; $this->ipickup_time = $dato[35]; $this->ipickup_date = $dato[36]; $this->rpickup_time = $dato[37]; $this->rpickup_date = $dato[38]; $this->setPagado($dato[41]); } } } } public function __toString() { return $this->id.' '.$this->paterno.' '.$this->nombre; } /** * * @return bool success */ public function guardarTotal() { $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo"); $sql = "UPDATE ma_reservaciones set total = " .$this->getTotal() ." WHERE id_reservacion = " .$this->getId().";"; if ($mysqli->query($sql)) { $this->setMsg('Info saved correctly'); return true; } else { $this->setMsg('There was an error when trying to save information.'); return false; } return true; } /** * * @return mixed */ public function guardar(){ if (null != $this->getFecha_salida() || '00/00/0000' != $this->getFecha_salida()) { $salida = date('Y-m-d', strtotime($this->getFecha_salida())); } else { $salida = '0000-00-00'; } if (null != $this->getFecha_llegada()) { $llegada = date('Y-m-d', strtotime($this->getFecha_llegada())); } else { $salida = '0000-00-00'; } if ($this->getHora_vuelo('H:i:s') == null) { $hora_vuelo = "'NULL'"; } else { $hora_vuelo = "'".$this->getHora_vuelo()."'"; } if ($this->getHora_vuelo_salida('H:i:s') == null) { $hora_vuelo_salida = "'NULL'"; } else { $hora_vuelo_salida = "'".$this->getHora_vuelo_salida()."'"; } if($this->getId()>0){#si se cumple la condicion hace un update en la tabla cat_Lugares $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo"); $sql = "UPDATE ma_reservaciones SET nombre='".$this->getNombre()."', paterno='".$this->getPaterno()."', materno='".$this->getMaterno()."', direccion='".$this->getDireccion()."', ciudad='".$this->getCiudad()."', estado='".$this->getEstado()."', cp='".$this->getCP()."', pais='".$this->getPais()."', telefono='".$this->getTelefono()."', celular='".$this->getCelular()."', correo='".$this->getCorreo()."', id_tarifa=".$this->getId_tarifa().", aerolinea='".$this->getAerolinea()."', no_vuelo='".$this->getNo_vuelo()."', hora_vuelo=".$hora_vuelo.", no_noches='".$this->getNo_noches()."', fecha_salida='".$salida."', aerolinea_salida='".$this->getAerolinea_salida()."', no_vuelo_salida='".$this->getNo_vuelo_salida()."', hora_vuelo_salida=".$hora_vuelo_salida.", info_adicional='".$this->getInfo_adicional()."', pasajeros=".$this->getPasajeros().", peticiones_adicionales='".$this->getPeticiones_adicionales()."', fecha_llegada='".$llegada."', OtherAirport='".$this->getOtherAirport()."', IdPaquete=".$this->getIdPaquete().", IdTraslado=".$this->getIdTraslado().", IdHotel=".$this->getIdHotel().", vip=".$this->getVip().", total=".$this->getTotal().", id_tipocobro=".$this->getTipoCobro().", pagado=".$this->getPagado().", grocery=".$this->getGrocery()." WHERE id_reservacion = ".$this->getId().";"; if($mysqli->multi_query($sql)){ $this->setMsg('La reservacion se modifico correctamente.'); return 1; }else{ $this->setMsg('Error al modificar la reservacion.'); return 0; } }else{#en caso de que entre en el else se hace un insert sobre la tabla cat_Lugares $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo"); $sql ="INSERT INTO ma_reservaciones (nombre,paterno,materno,direccion,ciudad,estado,cp,pais,telefono,celular,correo,id_tarifa,aerolinea,no_vuelo,hora_vuelo,no_noches,fecha_salida,aerolinea_salida,no_vuelo_salida,hora_vuelo_salida,info_adicional,pasajeros,peticiones_adicionales,fecha_llegada,OtherAirport,IdPaquete,IdTraslado,IdHotel,tipo,total,fec_creacion,id_tipocobro,grocery,vip) VALUES ('".$this->getNombre()."','".$this->getPaterno()."','".$this->getMaterno()."','".$this->getDireccion()."','".$this->getCiudad()."','".$this->getEstado()."','".$this->getCP()."','".$this->getPais()."','".$this->getTelefono()."','".$this->getCelular()."','".$this->getCorreo()."',".$this->getId_tarifa().",'".$this->getAerolinea()."','".$this->getNo_vuelo()."',".$hora_vuelo.",".$this->getNo_noches().",'".$salida."','".$this->getAerolinea_salida()."','".$this->getNo_vuelo_salida()."',".$hora_vuelo_salida.",'".$this->getInfo_adicional()."',".$this->getPasajeros().",'".$this->getPeticiones_adicionales()."','".$llegada."','".$this->getOtherAirport()."',".$this->getIdPaquete().",".$this->getIdTraslado().",".$this->getIdHotel().",'".$this->getTipo()."',".$this->getTotal().",sysdate(),".$this->getTipoCobro().",".$this->getGrocery().",".$this->getVip().");"; //$sql = "call pa_InsMaResevaciones_key ('".$this->getNombre()."','".$this->getPaterno()."','".$this->getMaterno()."','".$this->getDireccion()."','".$this->getCiudad()."','".$this->getEstado()."','".$this->getCP()."','".$this->getPais()."','".$this->getTelefono()."','".$this->getCelular()."','".$this->getCorreo()."',".$this->getId_tarifa().",'".$this->getAerolinea()."','".$this->getNo_vuelo()."',".$hora_vuelo.",".$this->getNo_noches().",'".$salida."','".$this->getAerolinea_salida()."','".$this->getNo_vuelo_salida()."',".$hora_vuelo_salida.",'".$this->getInfo_adicional()."',".$this->getPasajeros().",'".$this->getPeticiones_adicionales()."','".$llegada."','".$this->getOtherAirport()."',".$this->getIdPaquete().",".$this->getIdTraslado().",".$this->getIdHotel().",'".$this->getTipo()."',".$this->getTotal().",".$this->getTipoCobro().",".$this->getGrocery().",".$this->getVip().")"; /* if($this->getNombre()=='andrey sebastian' || $this->getCorreo()=='felipesotelo@gmail.com'){ print_r($this); echo $sql; die(); } */ if($mysqli->multi_query($sql)){ $this->setMsg('Reservation request received successfully.'); return $mysqli->insert_id; }else{ $this->setMsg('Something wrong happened while making the reservation.'); return 0; } } } public function ActualizaStatus(){ $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo"); $sql = "UPDATE ma_reservaciones SET id_status=".$this->getId_status()." WHERE id_reservacion = '".$this->getId()."'"; //$sql = "call pa_UpdStatusMaResevaciones_filter (".$this->getId().",".$this->getId_status().")"; if($mysqli->multi_query($sql)){ $this->setMsg('Operacion realizada correctamente..'); return 1; }else{ $this->setMsg('Operacion no se realizo correctamente.'); return 0; } } public function ActualizaVoucher($folioSCT = '', $initialPickUpTime = '', $initialPickUpDate = '', $returnPickUpTime = '', $returnPickUpDate = ''){ if ($initialPickUpDate != '') { $initialPickUpDate = date('Y-m-d', strtotime($initialPickUpDate)); } if ($returnPickUpDate != '') { $returnPickUpDate = date('Y-m-d',strtotime($returnPickUpDate)); } $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo"); $sql = "UPDATE ma_reservaciones SET FolioSCT='".$folioSCT."', iPickUpTime='".$initialPickUpTime."', iPickUpDate='".$initialPickUpDate."', rPickUpTime='".$returnPickUpTime."', rPickUpDate='".$returnPickUpDate."' where id_reservacion=".$this->getId().";"; //$sql = "call pa_UpdVoucher_key (".$this->getId().",'".$folioSCT."',".$initialPickUpTime.",'".$initialPickUpDate."',".$returnPickUpTime.",'".$returnPickUpDate."')"; if($mysqli->multi_query($sql)){ $this->setMsg('Operacion realizada correctamente..'); return 1; }else{ $this->setMsg('Vaucher no guardado correctamente.'); return 0; } } public function Pagar($idReservacion){ $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo"); $sql ="update ma_reservaciones set pagado=1 where id_reservacion = ".$idReservacion.";"; //$sql = "call pa_UpdPagado_key (".$idReservacion.")"; if($mysqli->multi_query($sql)){ $this->setMsg('Operacion realizada correctamente..'); return 1; }else{ $this->setMsg('Operacion no se realizo correctamente.'); return 0; } } public function getDestination() { $this->instanciaTarifa(); $destino = new reg_Lugares($this->oTarifa->getid_lugar_destino()); return $destino->getDescripcion(); } /** * @return reg_MaResevaciones */ public function setId($NewVal){ $this->id = Limpiar($NewVal); return $this; } public function getId(){ return $this->id; } /** * @return reg_MaResevaciones */ public function setNombre($NewVal){ $this->nombre = Limpiar($NewVal); return $this; } public function getNombre(){ return $this->nombre; } /** * @return reg_MaResevaciones */ public function setPaterno($NewVal){ $this->paterno = Limpiar($NewVal); return $this; } public function getPaterno(){ return $this->paterno; } /** * @return reg_MaResevaciones */ public function setMaterno($NewVal){ $this->materno = Limpiar($NewVal); return $this; } public function getMaterno(){ return $this->materno; } /** * @return reg_MaResevaciones */ public function setDireccion($NewVal){ $this->direccion = Limpiar($NewVal); return $this; } public function getDireccion(){ return $this->direccion; } /** * @return reg_MaResevaciones */ public function setCiudad($NewVal){ $this->ciudad = Limpiar($NewVal); return $this; } public function getCiudad(){ return $this->ciudad; } /** * @return reg_MaResevaciones */ public function setEstado($NewVal){ $this->estado = Limpiar($NewVal); return $this; } public function getEstado(){ return $this->estado; } /** * @return reg_MaResevaciones */ public function setCP($NewVal){ $this->cp = Limpiar($NewVal); return $this; } public function getCP(){ return $this->cp; } /** * @return reg_MaResevaciones */ public function setPais($NewVal){ $this->pais = Limpiar($NewVal); return $this; } public function getPais(){ return $this->pais; } /** * @return reg_MaResevaciones */ public function setTelefono($NewVal){ $this->telefono = Limpiar($NewVal); return $this; } public function getTelefono(){ return $this->telefono; } /** * @return reg_MaResevaciones */ public function setCelular($NewVal){ $this->celular = Limpiar($NewVal); return $this; } public function getCelular(){ return $this->celular; } /** * @return reg_MaResevaciones */ public function setCorreo($NewVal){ $this->correo = LimpiarCorreo($NewVal); return $this; } public function getCorreo(){ return $this->correo; } /** * @return reg_MaResevaciones */ public function setId_tarifa($NewVal){ $this->id_tarifa = Limpiar($NewVal); return $this; } public function getId_tarifa(){ return $this->id_tarifa; } /** * @return reg_MaResevaciones */ public function setAerolinea($NewVal){ $this->aerolinea = Limpiar($NewVal); return $this; } public function getAerolinea(){ return $this->aerolinea; } /** * @return reg_MaResevaciones */ public function setNo_vuelo($NewVal){ $this->no_vuelo = Limpiar($NewVal); return $this; } public function getNo_vuelo(){ return $this->no_vuelo; } /** * @return reg_MaResevaciones */ public function setHora_vuelo($NewVal){ if (false !== strpos(strtolower($NewVal), 'pm')) { $NewVal = date('H:i:s', strtotime($NewVal)); } $this->hora_vuelo = Limpiar($NewVal); return $this; } public function getHora_vuelo($format=null){ return $this->formatTime($this->hora_vuelo, $format); } /** * @return reg_MaResevaciones */ public function setNo_noches($NewVal){ $this->no_noches = Limpiar($NewVal); return $this; } public function getNo_noches(){ return $this->no_noches; } /** * @return reg_MaResevaciones */ public function setFecha_salida($NewVal){ #$this->fecha_salida = Limpiar($NewVal); $this->fecha_salida = ($NewVal); return $this; } public function getFecha_salida(){ return $this->fecha_salida; } public function getFecha_salida_mdy($separador='/'){ /*list($dSal,$mSal,$aSal) = explode("/",$this->fecha_salida); $salida = $mSal.$separador.$dSal.$separador.$aSal;*/ if ($this->getFecha_salida()== '0000-00-00' or $this->getFecha_salida() == '1969-12-31' ) { return ''; } return date("m{$separador}d{$separador}Y", $this->fecha_salida_dt); } /** * @return reg_MaResevaciones */ public function setAerolinea_salida($NewVal){ $this->aerolinea_salida = Limpiar($NewVal); return $this; } public function getAerolinea_salida(){ return $this->aerolinea_salida; } /** * @return reg_MaResevaciones */ public function setNo_vuelo_salida($NewVal){ $this->no_vuelo_salida = Limpiar($NewVal); return $this; } public function getNo_vuelo_salida(){ return $this->no_vuelo_salida; } /** * @return reg_MaResevaciones */ public function setHora_vuelo_salida($NewVal){ if (false !== strpos(strtolower($NewVal), 'pm')) $NewVal = date('H:i:s', strtotime($NewVal)); $this->hora_vuelo_salida = Limpiar($NewVal); return $this; } public function getHora_vuelo_salida($format=null){ return $this->formatTime($this->hora_vuelo_salida, $format); } /** * @return reg_MaResevaciones */ public function setInfo_adicional($NewVal){ $this->info_adicional = Limpiar($NewVal); return $this; } public function getInfo_adicional(){ return $this->info_adicional; } /** * @return reg_MaResevaciones */ public function setPasajeros($NewVal){ $this->pasajeros = Limpiar($NewVal); return $this; } public function getPasajeros(){ return $this->pasajeros; } /** * @return reg_MaResevaciones */ public function setPeticiones_adicionales($NewVal){ $this->peticiones_adicionales = Limpiar($NewVal); return $this; } public function getPeticiones_adicionales(){ return $this->peticiones_adicionales; } /** * @return reg_MaResevaciones */ public function setFecha_llegada($NewVal){ #$this->fecha_llegada = Limpiar($NewVal); $this->fecha_llegada = ($NewVal); return $this; } public function getFecha_llegada(){ return $this->fecha_llegada; } public function getFecha_llegada_mdy($separador='/'){ if ($this->getFecha_llegada()== '0000-00-00' or $this->getFecha_llegada() == '1969-12-31') { return ''; } return date("m{$separador}d{$separador}Y", $this->fecha_llegada_dt); } /** * @return reg_MaResevaciones */ public function setId_status($NewVal){ $this->id_status = Limpiar($NewVal); return $this; } public function getId_status(){ return $this->id_status; } /** * @return reg_MaResevaciones */ public function setOtherAirport($NewVal){ $this->OtherAirport = Limpiar($NewVal); return $this; } public function getOtherAirport(){ return $this->OtherAirport; } /** * @return reg_MaResevaciones */ public function setIdPaquete($NewVal){ $this->id_paquete = Limpiar($NewVal); return $this; } public function getIdPaquete(){ return $this->id_paquete; } /** * @return reg_MaResevaciones */ public function setIdTraslado($NewVal){ $this->id_traslado = Limpiar($NewVal); return $this; } public function getIdTraslado(){ return $this->id_traslado; } /** * @return reg_MaResevaciones */ public function setIdHotel($NewVal){ $this->id_hotel = Limpiar($NewVal); return $this; } public function getIdHotel(){ return $this->id_hotel; } /** * @return reg_MaResevaciones */ public function setTipo($NewVal){ $this->tipo = Limpiar($NewVal); return $this; } public function getTipo(){ return $this->tipo; } /** * @return reg_MaResevaciones */ public function setTotal($NewVal){ $this->total = Limpiar($NewVal); return $this; } public function getTotal(){ return $this->total; } /** * @return reg_MaResevaciones */ public function setFecha_creacion($NewVal){ $this->fecha_creacion = $NewVal; return $this; } public function getFecha_creacion(){ return $this->fecha_creacion; } public function getFecha_creacion_mdy($separador = '/') { $fc = strtotime($this->getFecha_creacion()); return date("m{$separador}d{$separador}Y", $fc); } /** * @return reg_MaResevaciones */ public function setTipoCobro($NewVal){ $this->tipocobro = Limpiar($NewVal); return $this; } public function getTipoCobro(){ return $this->tipocobro; } public function getVip(){ return $this->vip; } /** * @return reg_MaResevaciones */ public function setVip($newVal){ $this->vip = $newVal; return $this; } public function getGrocery(){ return $this->grocery; } /** * @return reg_MaResevaciones */ public function setGrocery($newVal){ $this->grocery = $newVal; return $this; } public function getFolioSCT(){ return $this->folioSCT; } /** * @return reg_MaResevaciones */ public function setFolioSTR($newVal){ $this->folioSCT = $newVal; return $this; } /** * @return reg_MaResevaciones */ public function setInitialPickUpTime($newVal){ if (!$newVal) $newVal = null; $this->ipickup_time = $newVal; return $this; } protected function formatTime($time,$format=null) { $timet = strtotime($time); if (null !== $format && null !== $time && $timet) { $time = date($format, $timet); } return $time; } public function getInitialPickUpTime($format=null){ return $this->formatTime($this->ipickup_time, $format); } public function setInitialPickUpDate($newVal){ $this->ipickup_date = $newVal; return $this; } public function getInitialPickUpDate($format = null){ $date = $this->ipickup_date; if ($date == '0000-00-00') { return ''; } if ($format != null && $date != '') { $date = date($format, strtotime($date)); } return $date; } public function setReturnPickUpTime($newVal){ $this->rpickup_time = $newVal; return $this; } public function getReturnPickUpTime($format=null){ return $this->formatTime($this->rpickup_time, $format); } /** * @return reg_MaResevaciones */ public function setReturnPickUpDate($newVal){ $this->rpickup_date = $newVal; return $this; } public function getReturnlPickUpDate($format = null){ $date = $this->rpickup_date; if ($date == '0000-00-00') { return ''; } if ($format != null && $date != '') { $date = date($format, strtotime($date)); } return $date; } /** * @return reg_MaResevaciones */ public function setMsg($NewVal){ $this->msg = Limpiar($NewVal); return $this; } public function getMsg(){ return $this->msg; } public function getLugarOrigenStr(){ $this->instanciaTarifa(); $retorno = ''; if($this->tipo == 'D'){ $retorno = $this->oTarifa->getLugarDestinoStr(); }else{ $retorno = $this->oTarifa->getLugarOrigenStr(); } return $retorno; } public function getLugarDestinoStr(){ $this->instanciaTarifa(); $retorno = ''; if($this->tipo == 'D'){ $retorno = $this->oTarifa->getLugarOrigenStr(); }else{ $retorno = $this->oTarifa->getLugarDestinoStr(); } return $retorno; } public function getTripStr(){ $this->instanciaTarifa(); return $this->oTarifa->getStripStr(); } public function getVehiculoStr(){ $this->instanciaTarifa(); return $this->oTarifa->getVehiculoStr(); } public function getTrasladoStr(){ $this->instanciaTarifa(); return $this->oTarifa->getTrasladoStr(); } public function getOTarifa(){ $this->instanciaTarifa(); return $this->oTarifa; } private function instanciaTarifa(){ if($this->oTarifa == null){ $this->oTarifa = new reg_DeTarifas($this->id_tarifa); } } /** * @return reg_MaResevaciones */ public function setPagado($newval){ $this->pagado = $newval; return $this; } public function getPagado(){ return $this->pagado; } public function tieneTestimonial(){ return reg_testimonial::tieneTestimonial($this->id); } public function getFecha_llegada_dt() { return $this->fecha_llegada_dt; } public function getFecha_salida_dt() { return $this->fecha_salida_dt; } public function getInfo() { $r = array(); if ($this->id_tarifa > 0) { // Shuttle o Private $this->instanciaTarifa(); $r['auto'] = $this->oTarifa->getVehiculoStr(); $r['destino'] = $this->oTarifa->getLugarDestinoStr(); $r['origen'] = $this->oTarifa->getLugarOrigenStr(); $r['traslado'] = $this->oTarifa->getTrasladoStr(); $r['zona'] = $this->oTarifa->getId_zona(); $r['paquete'] = $this->oTarifa->getStripStr(); } else { // Special Reservation $spec = new reg_DeResevacionesSpecial($this->id); $r['paquete'] = 'Special'; $r['destino'] = $spec->getDestination(); $r['origen'] = $spec->getPickUpLocation(); } return $r; } /** * * @return reg_DeTarifas */ public function getTarifa() { if ($this->getId_tarifa()) { $this->instanciaTarifa(); return $this->oTarifa; } return null; } /** * * @return reg_DeResevacionesSpecial */ public function getSpecial() { if (!$this->getId_tarifa()) { $special = new reg_DeResevacionesSpecial($this->id); return $special; } return false; } }
  4. Hello, im not a php expert so its not my code but I have been stuck trying to find the error for 6 days now. My friend asked me to help him. There is this shuttle reservation system, you can choose One Way or Round Trip. There are no issues with Round Trips, user info gets sent to the admin db and it shows up at the admin panel, but if we try doing One Way Trip, it just redirects to the error.php. and no info is saved into the db. This all started after he updated from mysql (and php 5.6) to mariaDB (and php 7.3). I have update all the php files to mysqli, but Im not sure if something else is missing. At line 1301 of reserve.php $iGuardo gets either a 0 or NULL but only when I try doing a One Way reservation. Here are other code pages that I think are linked to the main reserve.php. In prices.php is when the user selects the type of trip Round or One Way and in reg_maReservaciones.php the reservation is processed and sent to the DB.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.