Inicializado=0; $this->Nif=""; $this->Nombre=""; $this->Apellidos=""; $this->Direccion=""; $this->CPostal=""; $this->Localidad=""; $this->Provincia=""; $this->Telefonos=""; $this->Fax=""; $this->Mail=""; $this->Web=""; $this->Imagenes=""; $this->Textos=""; $this->Titulos=""; $this->Logotipo=""; $this->Comentarios=""; $this->Usuario=""; $this->Contrasena=""; $this->Privacidad=-1; $this->Permisos=-1; $this->Intereses=0; $this->Acceso='1900-05-05'; $this->Notas=""; $this->Pendiente=1; $this->EnDirectorio=0; $this->Pais=""; $this->CuentaBancaria=""; $this->PagoCargoCuenta=0; $this->PagoContado=0; $this->EntregaDestinatario=""; $this->EntregaDireccion=""; $this->EntregaLocalidad=""; $this->EntregaProvincia=0; $this->EntregaCPostal=""; $this->EntregaTelefono=""; $this->EntregaEmail=""; $this->EntregaObservaciones=""; $this->ObservacionesCliente=""; $this->consulta=""; } /* Funciones de asignacion de valores */ function EstablecerNif($cif){ if ($this->Inicializado==0){ $this->AnteriorId=$cif; $this->Inicializado=1; }else{ $this->AnteriorId=$this->Nif; } $this->Nif=$cif; } function EstablecerIntereses($posicion,$val){ $bin=new binarios(); $this->Intereses=$bin->establecer($this->Intereses,$posicion,$val); } function ObtenerAcceso(){ list($ano, $mes, $dia)=explode("-",$this->Acceso,3); $acc=$dia."/".$mes."/".$ano; return($acc); } function ObtenerFechaAlta(){ list($fecha, $hora)=explode(" ",$this->FechaAlta,3); list($ano, $mes, $dia)=explode("-",$fecha,3); $acc=$dia."/".$mes."/".$ano; return($acc); } function ObtenerRol($conexion,$rol){ $rol->Consulta($conexion,""); if ($rol->FilasEnConsulta()){ $rol->EjecutarConsulta(0); $vari="Privacidad".$this->Privacidad."_rol"; return ($rol->$vari); }else{ return $rol->Privacidad1_rol; } } /* Funcion para el almacenamiento del enlace actual en la base de datos */ function Almacenar($conexion){ $accion="INSERT INTO P0114_persona (Nif, Nombre, Apellidos, Direccion, CPostal, Localidad, Provincia, Telefonos, Fax, Mail"; $accion=$accion.", Web, Imagenes, Textos, Titulos, Logotipo, Comentarios, Usuario, Contrasena, Privacidad, Permisos"; $accion=$accion.",Intereses, Acceso, Notas, Pendiente, EnDirectorio, FechaAlta, Pais, CuentaBancaria, PagoCargoCuenta, PagoContado"; $accion=$accion.",EntregaDestinatario, EntregaDireccion, EntregaLocalidad, EntregaProvincia, EntregaCPostal, EntregaTelefono, EntregaEmail, EntregaObservaciones, ObservacionesCliente)"; $accion=$accion." VALUES ('$this->Nif','".addslashes($this->Nombre)."','".addslashes($this->Apellidos)."', '".addslashes($this->Direccion)."'"; $accion=$accion.",'$this->CPostal','".addslashes($this->Localidad)."','".addslashes($this->Provincia)."','$this->Telefonos','$this->Fax','$this->Mail'"; $accion=$accion.",'$this->Web','$this->Imagenes','$this->Textos','$this->Titulos','$this->Logotipo'"; $accion=$accion.",'$this->Comentarios','$this->Usuario','$this->Contrasena','$this->Privacidad'"; $accion=$accion.",'$this->Permisos','$this->Intereses','$this->Acceso','$this->Notas','$this->Pendiente','$this->EnDirectorio','$this->FechaAlta'"; $accion=$accion.",'$this->Pais','$this->CuentaBancaria','$this->PagoCargoCuenta','$this->PagoContado'"; $accion=$accion.",'".addslashes($this->EntregaDestinatario)."','".addslashes($this->EntregaDireccion)."','".addslashes($this->EntregaLocalidad)."','".addslashes($this->EntregaProvincia)."'"; $accion=$accion.",'$this->EntregaCPostal','$this->EntregaTelefono','$this->EntregaEmail','".addslashes($this->EntregaObservaciones)."','".addslashes($this->ObservacionesCliente)."')"; mysql_query($accion,$conexion); return(mysql_insert_id($conexion)); } /* Funcion para la actualizacion de los datos almacenados en la base de datos */ function Actualizar($conexion){ $accion="UPDATE P0114_persona SET Identificador='$this->Identificador', Nif = '$this->Nif', Nombre = '".addslashes($this->Nombre)."',Apellidos = '".addslashes($this->Apellidos)."'"; $accion=$accion.", Direccion = '".addslashes($this->Direccion)."', CPostal = '$this->CPostal',Localidad='".addslashes($this->Localidad)."'"; $accion=$accion.", Provincia='".addslashes($this->Provincia)."',Telefonos='$this->Telefonos',Fax='$this->Fax'"; $accion=$accion.", Mail='$this->Mail', Web='$this->Web', Imagenes='$this->Imagenes', Textos= '".addslashes($this->Textos)."'"; $accion=$accion.", Titulos='".addslashes($this->Titulos)."',Logotipo='$this->Logotipo',Comentarios='".addslashes($this->Comentarios)."'"; $accion=$accion.", Usuario='$this->Usuario', Contrasena='$this->Contrasena', Privacidad='$this->Privacidad'"; $accion=$accion.", Permisos='$this->Permisos',Intereses='$this->Intereses',Acceso='$this->Acceso'"; $accion=$accion.", Notas='".addslashes($this->Notas)."', Pendiente='$this->Pendiente', EnDirectorio='$this->EnDirectorio', FechaAlta='$this->FechaAlta'"; $accion=$accion.", Pais='$this->Pais', CuentaBancaria='$this->CuentaBancaria', PagoCargoCuenta='$this->PagoCargoCuenta', PagoContado='$this->PagoContado'"; $accion=$accion.", EntregaDestinatario='".addslashes($this->EntregaDestinatario)."', EntregaDireccion='".addslashes($this->EntregaDireccion)."', EntregaLocalidad='".addslashes($this->EntregaLocalidad)."', EntregaProvincia='".addslashes($this->EntregaProvincia)."', EntregaCPostal='$this->EntregaCPostal'"; $accion=$accion.", EntregaTelefono='$this->EntregaTelefono', EntregaEmail='$this->EntregaEmail', EntregaObservaciones='".addslashes($this->EntregaObservaciones)."', ObservacionesCliente='".addslashes($this->Titulo)."' WHERE Identificador ='$this->Identificador'"; // print($accion); mysql_query($accion,$conexion); return($accion); } /* Funcion para borrar un elemento de la base de datos */ function Eliminar($conexion){ $accion="DELETE FROM P0114_persona WHERE Identificador = '$this->Identificador'"; mysql_query($accion,$conexion); } /* Consultas */ function Consulta($conexion,$restricciones){ $accion="SELECT * FROM P0114_persona"; if ($restricciones!=""){ $accion=$accion." ".$restricciones; } //print($accion); $this->consulta=mysql_query($accion,$conexion); return($accion); } function ConsultaCuantos($conexion,$restricciones){ $accion="SELECT COUNT(*) FROM P0114_persona "; if ($restricciones!=""){ $accion=$accion." ".$restricciones; } //print($accion); $this->consulta=mysql_query($accion,$conexion); return mysql_result($this->consulta,0,0); } function FilasEnConsulta(){ $aux=mysql_num_rows($this->consulta); return($aux); } function EjecutarConsulta($fila){ $this->Identificador=mysql_result($this->consulta,$fila,0); $this->Nif=mysql_result($this->consulta,$fila,1); $this->Nombre=stripslashes(mysql_result($this->consulta,$fila,2)); $this->Apellidos=stripslashes(mysql_result($this->consulta,$fila,3)); $this->Direccion=stripslashes(mysql_result($this->consulta,$fila,4)); $this->CPostal=mysql_result($this->consulta,$fila,5); $this->Localidad=stripslashes(mysql_result($this->consulta,$fila,6)); $this->Provincia=stripslashes(mysql_result($this->consulta,$fila,7)); $this->Telefonos=mysql_result($this->consulta,$fila,8); $this->Fax=mysql_result($this->consulta,$fila,9); $this->Mail=mysql_result($this->consulta,$fila,10); $this->Web=mysql_result($this->consulta,$fila,11); $this->Imagenes=mysql_result($this->consulta,$fila,12); $this->Textos=stripslashes(mysql_result($this->consulta,$fila,13)); $this->Titulos=stripslashes(mysql_result($this->consulta,$fila,14)); $this->Logotipo=mysql_result($this->consulta,$fila,15); $this->Comentarios=stripslashes(mysql_result($this->consulta,$fila,16)); $this->Usuario=mysql_result($this->consulta,$fila,17); $this->Contrasena=mysql_result($this->consulta,$fila,18); $this->Privacidad=mysql_result($this->consulta,$fila,19); $this->Permisos=mysql_result($this->consulta,$fila,20); $this->Intereses=mysql_result($this->consulta,$fila,21); $this->Acceso=mysql_result($this->consulta,$fila,22); $this->Notas=stripslashes(mysql_result($this->consulta,$fila,23)); $this->Pendiente=mysql_result($this->consulta,$fila,24); $this->EnDirectorio=mysql_result($this->consulta,$fila,25); $this->Inicializado=1; $this->AnteriorId=$this->Identificador; $this->FechaAlta=mysql_result($this->consulta,$fila,26); $this->Pais=mysql_result($this->consulta,$fila,27); $this->CuentaBancaria=mysql_result($this->consulta,$fila,28); $this->PagoCargoCuenta=mysql_result($this->consulta,$fila,29); $this->PagoContado=mysql_result($this->consulta,$fila,30); $this->EntregaDestinatario=stripslashes(mysql_result($this->consulta,$fila,31)); $this->EntregaDireccion=stripslashes(mysql_result($this->consulta,$fila,32)); $this->EntregaLocalidad=stripslashes(mysql_result($this->consulta,$fila,33)); $this->EntregaProvincia=stripslashes(mysql_result($this->consulta,$fila,34)); $this->EntregaCPostal=mysql_result($this->consulta,$fila,35); $this->EntregaTelefono=mysql_result($this->consulta,$fila,36); $this->EntregaEmail=mysql_result($this->consulta,$fila,37); $this->EntregaObservaciones=stripslashes(mysql_result($this->consulta,$fila,38)); $this->ObservacionesCliente=stripslashes(mysql_result($this->consulta,$fila,39)); } } ?> Nif=""; $this->Nombre=""; $this->Direccion=""; $this->CP=""; $this->Ciudad=""; $this->Provincia=""; $this->Telefono=""; $this->Email=""; $this->Fax=""; $this->NombreEntrega=""; $this->DireccionEntrega=""; $this->CPEntrega=""; $this->ProvinciaEntrega=""; $this->TelefonoEntrega=""; $this->EmailEntrega=""; $this->FaxEntrega=""; $this->TelefonoAC=""; $this->EmailAC=""; $this->HorarioAC=""; $this->QuienesSomos=""; } /* Funcion para el almacenamiento del enlace actual en la base de datos */ function Almacenar($conexion){ $accion="INSERT INTO P0114_empresa (Nif,Nombre,Direccion,CP,Ciudad,Provincia, Telefono,Email,Fax,NombreEntrega,DireccionEntrega,CPEntrega,CiudadEntrega, ProvinciaEntrega,TelefonoEntrega,EmailEntrega,FaxEntrega,TelefonoAC,EmailAC,HorarioAC, QuienesSomos) VALUES ('".addslashes($this->Nif)."','".addslashes($this->Nombre)."','".addslashes($this->Direccion)."', '".addslashes($this->CP)."','".addslashes($this->Ciudad)."','".addslashes($this->Provincia)."','".addslashes($this->Telefono)."','".addslashes($this->Email)."', '$this->Fax','".addslashes($this->NombreEntrega)."','".addslashes($this->DireccionEntrega)."','".addslashes($this->CPEntrega)."', '".addslashes($this->CiudadEntrega)."', '".addslashes($this->ProvinciaEntrega)."','".addslashes($this->TelefonoEntrega)."','".addslashes($this->EmailEntrega)."', '$this->FaxEntrega','$this->TelefonoAC','$this->EmailAC','".addslashes($this->HorarioAC)."','".addslashes($this->QuienesSomos)."')"; mysqli_query($conexion,$accion); //print($accion); } /* Funcion para la actualizacion de la cantidad de producto */ function Actualizar($conexion){ $accion="UPDATE P0114_empresa SET Nif='".addslashes($this->Nif)."', Nombre='".addslashes($this->Nombre)."', Direccion='".addslashes($this->Direccion)."', CP='".addslashes($this->CP)."', Ciudad='".addslashes($this->Ciudad)."', Provincia='".addslashes($this->Provincia)."', Telefono='".addslashes($this->Telefono)."', Email='".addslashes($this->Email)."', Fax='$this->Fax', NombreEntrega='".addslashes($this->NombreEntrega)."', DireccionEntrega='".addslashes($this->DireccionEntrega)."', CPEntrega='".addslashes($this->CPEntrega)."', CiudadEntrega='".addslashes($this->CiudadEntrega)."', ProvinciaEntrega='".addslashes($this->ProvinciaEntrega)."', TelefonoEntrega='".addslashes($this->TelefonoEntrega)."', EmailEntrega='".addslashes($this->EmailEntrega)."', FaxEntrega='$this->FaxEntrega', TelefonoAC='$this->TelefonoAC', EmailAC='$this->EmailAC', HorarioAC='".addslashes($this->HorarioAC)."', QuienesSomos='".addslashes($this->QuienesSomos)."'"; //print($accion); mysqli_query($conexion,$accion); return ($accion); } /* Funcion para borrar una compra de la base de datos */ function Eliminar($conexion){ $accion="DELETE FROM P0114_empresa WHERE Referencia='".$this->Referencia."'"; mysqli_query($conexion,$accion); //print($accion); } /* Consultas */ function Consulta($conexion,$restricciones){ $accion="SELECT * FROM P0114_empresa "; if ($restricciones!=""){ $accion=$accion." ".$restricciones; } $this->consulta=mysqli_query($conexion,$accion); return($accion); } function FilasEnConsulta(){ $aux=mysqli_num_rows($this->consulta); return($aux); } function EjecutarConsulta($fil){ mysqli_data_seek($this->consulta, $fil); /* obtener fila */ $row = mysqli_fetch_row($this->consulta); $this->Nif=$row[0]; $this->Nombre=$row[1]; $this->Direccion=stripcslashes($row[2]); $this->CP=$row[3]; $this->Ciudad=$row[4]; $this->Provincia=$row[4]; $this->Telefono=$row[6]; $this->Email=$row[7]; $this->Fax=$row[8]; $this->NombreEntrega=$row[9]; $this->DireccionEntrega=stripcslashes($row[10]); $this->CPEntrega=$row[11]; $this->CiudadEntrega=$row[12]; $this->ProvinciaEntrega=$row[13]; $this->TelefonoEntrega=$row[14]; $this->EmailEntrega=$row[15]; $this->FaxEntrega=$row[16]; $this->TelefonoAC=$row[17]; $this->EmailAC=$row[18]; $this->HorarioAC=stripcslashes($row[19]); $this->QuienesSomos=stripcslashes($row[20]); } } ?>