$q"); $result=mysql_query($q); while($row=mysql_fetch_array($result)){ if (urls_amigables($_REQUEST['id'])==urls_amigables($row['nombre'])){ $seleccion=$row['id']; break; } } //Si no existe el tipo de producto... 404 if (!$seleccion){ echo (""); return; } guardaEntrada("producto", $seleccion); //Seguimos el camino normal $_SESSION['producto']=$row['id']; $_SESSION['productoMiga']=$row['nombre']; //Generamos un random $salir=false; while(!$salir){ $codigoRandom=abs(rand(999,999999999999999)); //logger("generamos $codigoRandom"); $q="SELECT * FROM producto_plantilla WHERE random=$codigoRandom"; $result=mysql_query($q); $row=mysql_fetch_array($result); //logger($q); if (!$row) $salir=true; } $_SESSION['codigoRandom']=$codigoRandom; } $codigoRandom=$_SESSION['codigoRandom']; //------------------ACTUALIZACION DEL MENU LATERAL Y MIGAS DE PAN------------------------------- $q="SELECT * FROM producto WHERE id='".$_SESSION['producto']."'"; $result=mysql_query($q); $productoAux=mysql_fetch_array($result); //echo($q); $q="SELECT S.id sid, S.nombre snombre, L.id lid, L.nombre lnombre, T.nombre tnombre, T.id tid FROM linea L, seccion S, tipo_producto T WHERE T.id=".$productoAux['tipo']." AND T.tipo=L.id AND L.seccion=S.id"; $resultVariables=mysql_query($q); $rowVariables=mysql_fetch_array($resultVariables); $_SESSION['seccion']=$rowVariables['sid']; $_SESSION['linea']=$rowVariables['lid']; $_SESSION['tipoProducto']=$rowVariables['tid']; //---------------------------------------------------------------------------------------- $producto=$_SESSION['producto']; $seccion=$_SESSION['seccion']; $seccionMiga=idiomaElemento("seccion", $seccion, $idioma); $linea=$_SESSION['linea']; $lineaMiga=idiomaElemento("linea", $linea, $idioma); $tipoProducto=$_SESSION['tipoProducto']; $tipoProductoMiga=idiomaElemento("tipo_producto", $tipoProducto, $idioma); $q="SELECT * FROM producto WHERE id='$producto'"; $resultProducto=mysql_query($q); $rowProducto=mysql_fetch_array($resultProducto); include("recursos/productoIdioma.php"); $tituloCambiado=$nombreIdiomaSe; $key=$nombreIdiomaSe.", ".$tipoProductoMiga.", ".$lineaMiga.", ".$seccionMiga.", ".nombreMarca($rowProducto['subtipo']).", ".$tipoProductoMiga." ".$nombreIdiomaSe.", ".nombreMarca($rowProducto['subtipo'])." ".$nombreIdiomaSe; $description=$nombreIdiomaSe." ".substr(limpiaCodigo($descripcionIdiomaSe),0, 130); //echo("Tenemos: ".$linea."-".$tipoProducto."-".$tipoProductoAmigable."-".$producto); $migasDePan=''.menuIdiomaCodigo("Inicio", $idioma,1).' '.$simboloMigas.' '.$seccionMiga.' '.$simboloMigas.' '.$lineaMiga.' '.$simboloMigas.' '.$tipoProductoMiga.' '.$simboloMigas.' '.$nombreIdiomaSe; include("cabecera.php"); include("recursos/lateralProductos.php"); //Comprobamos si puede votar $fechita=date('Y-m-d'); $q="SELECT * FROM votes WHERE ip='$ip' and cod_producto='$producto' and fecha='$fechita'"; $resultVotos=mysql_query($q); $rowVotosHoy=mysql_fetch_array($resultVotos); if (!$rowVotosHoy) $puedeVotar=true; //echo($q); //Guardamos el voto if ($_REQUEST['voto'] && $puedeVotar){ $votoAux=$_REQUEST['voto']; $q="INSERT INTO votes (ip, votacion, fecha, cod_producto) VALUES ('$ip', $votoAux, '$fechita', $producto)"; $resultVotos=mysql_query($q); if ($resultVotos!=1) $mensajeVotos="No puede volver a votar hoy"; else{ $mensajeVotos=menuIdiomaCodigo("voto registrado", $idioma, 167); $puedeVotar=false; } } ?>