Página desde la que accedo a login.php
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Producto</title>
<link href="estilo.css" type="text/css" rel="stylesheet" />
<script language="javascript" src="popup.js"></script>
<style type="text/css">
body
{
margin-left: 10px;
margin-top: 10px;
}
</style>
</head>
<?php
require_once("conexion.inc.php");
$conexion = mysql_connect($servidor, $usuario, $passwd);
$db = mysql_select_db($basedatos, $conexion);
if (!$conexion)
{
echo "Error al establecer la conexión con la base de datos: " . mysql_error();
exit();
}
if (!$db)
{
echo "Error seleccionando la base de datos: " . mysql_error();
exit();
}
$resultado = mysql_query("SELECT * FROM " . $_GET["categoria"] . " WHERE referencia=\"" . $_GET["referencia"] . "\"", $conexion);
$fila = mysql_fetch_array($resultado);
?>
<?php
if (!isset($_SESSION["logged"]))
{
?>
<body bgcolor="#F5F5F5" topmargin="10">
<table width="836" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
<tr>
<td colspan="6">
<iframe name="navigation" src="cabecera.html" frameborder="0" width="836" scrolling="no" height="118"></iframe>
</td>
</tr>
<tr>
<td width="836" height="20" colspan="6" style="font-size:12px">
<b>Para poder visualizar los precios debe
<?php
echo "<a href=\"login.php?referer=" . urlencode($_SERVER['PHP_SELF']) . "\">identificarse</a>";
?>
. Si no está registrado, puede hacerlo pinchando
<?php
echo "<a href=\"registro.php?referer=" . urlencode($_SERVER['PHP_SELF']) . "\">aquí</a>";
?>
.</b>
</td>
</tr>
<tr>
<td width="836" height="10" bgcolor="#F5F5F5" colspan="6"></td>
</tr>
<tr>
<td colspan="6" height="20" width="836">
<?php
echo $fila["descripcion"];
?>
</td>
</tr>
<tr>
<td width="836" height="10" bgcolor="#F5F5F5" colspan="6"></td>
</tr>
<tr>
<td colspan="6" height="20" width="836">
<?php
$color = explode("-", $fila["colores"]);
$total_color = count ($color);
for ($i=0; $i<$total_color; $i++)
{
$nombres_color = mysql_query("SELECT color FROM colores WHERE codigo = $color[$i]", $conexion);
$nom_color = mysql_fetch_array($nombres_color);
echo $nom_color["color"];
}
?>
</td>
</tr>
<tr>
<td width="836" height="10" bgcolor="#F5F5F5" colspan="6"></td>
</tr>
<tr>
<td rowspan="9" width="300" height="300" align="center">
<?php
echo "<img src=\"imagenes/" . $fila["referencia"] . ".jpg\" width=180 height=180>";
?>
</td>
<td rowspan="9" bgcolor="#F5F5F5" width="10"></td>
<th width="150">Cantidad</th>
<th width="150">Precio</th>
<td rowspan="9" bgcolor="#F5F5F5" width="10"></td>
<td></td>
</tr>
<tr>
<th width="150">25</th>
<td width="150" align="center">
<?php
echo "Debe identificarse.";
?>
</td>
<th width="226">Código de marcaje</th>
</tr>
<tr>
<th width="150">50</th>
<td width="150" align="center">
<?php
echo "Debe identificarse.";
?>
</td>
<td width="226" align="center">
<?php
echo $fila["codigo_marcaje"];
?>
</td>
</tr>
<tr>
<th width="150">100</th>
<td width="150" align="center">
<?php
echo "Debe identificarse.";
?>
</td>
<th width="226">Medida de marcaje</th>
</tr>
<tr>
<th width="150">250</th>
<td width="150" align="center">
<?php
echo "Debe identificarse.";
?>
</td>
<td width="226" align="center">
<?php
echo $fila["medida_marcaje"];
?>
</td>
</tr>
<tr>
<th width="150">500</th>
<td width="150" align="center">
<?php
echo "Debe identificarse.";
?>
</td>
<th width="226">Colores máximos de marcaje</th>
</tr>
<tr>
<th width="150">1000</th>
<td width="150" align="center">
<?php
echo "Debe identificarse.";
?>
</td>
<td width="226" align="center">
<?php
echo $fila["colores_maximos"];
?>
</td>
</tr>
<tr>
<th width="150">5000</th>
<td width="150" align="center">
<?php
echo "Debe identificarse.";
?>
</td>
<td></td>
</tr>
<tr>
<th width="150">10000</th>
<td width="150" align="center">
<?php
echo "Debe identificarse.";
mysql_free_result($resultado);
mysql_close($conexion);
?>
</td>
<td></td>
</tr>
</table>
</body>
<?php
}
else
{
?>
<body bgcolor="#F5F5F5" topmargin="10">
<table width="836" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
<tr>
<td colspan="6">
<iframe name="navigation" src="cabecera.html" frameborder="0" width="836" scrolling="no" height="118"></iframe>
</td>
</tr>
<tr>
<td colspan="6" height="20" width="836">
<?php
echo $fila["descripcion"];
?>
</td>
</tr>
<tr>
<td width="836" height="10" bgcolor="#F5F5F5" colspan="6"></td>
</tr>
<tr>
<td colspan="6" height="20" width="836">
<?php
$color = explode("-", $fila["colores"]);
$total_color = count ($color);
for ($i=0; $i<$total_color; $i++)
{
$nombres_color = mysql_query("SELECT color FROM colores WHERE codigo = $color[$i]", $conexion);
$nom_color = mysql_fetch_array($nombres_color);
echo $nom_color["color"];
}
?>
</td>
</tr>
<tr>
<td width="836" height="10" bgcolor="#F5F5F5" colspan="6"></td>
</tr>
<tr>
<td rowspan="9" width="300" height="300" align="center">
<?php
echo "<img src=\"imagenes/" . $fila["referencia"] . ".jpg\" width=180 height=180>";
?>
</td>
<td rowspan="9" bgcolor="#F5F5F5" width="10"></td>
<th width="150">Cantidad</th>
<th width="150">Precio</th>
<td rowspan="9" bgcolor="#F5F5F5" width="10"></td>
<td></td>
</tr>
<tr>
<th width="150">25</th>
<td width="150" align="center">
<?php
if ($fila["veinticinco"] != 0)
{
$precio = $fila["veinticinco"] + (($fila["veinticinco"] * $fila["incremento"]) / 100);
echo Round($precio,2) . "€/ud";
}
else
{
echo "Producto no disponible en esta cantidad.";
}
?>
</td>
<th width="226">Código de marcaje</th>
</tr>
<tr>
<th width="150">50</th>
<td width="150" align="center">
<?php
if ($fila["cincuenta"] != 0)
{
$precio = $fila["cincuenta"] + (($fila["cincuenta"] * $fila["incremento"]) / 100);
echo Round($precio,2) . "€/ud";
}
else
{
echo "Producto no disponible en esta cantidad.";
}
?>
</td>
<td width="226" align="center">
<?php
echo $fila["codigo_marcaje"];
?>
</td>
</tr>
<tr>
<th width="150">100</th>
<td width="150" align="center">
<?php
if ($fila["cien"] != 0)
{
$precio = $fila["cien"] + (($fila["cien"] * $fila["incremento"]) / 100);
echo Round($precio,2) . "€/ud";
}
else
{
echo "Producto no disponible en esta cantidad.";
}
?>
</td>
<th width="226">Medida de marcaje</th>
</tr>
<tr>
<th width="150">250</th>
<td width="150" align="center">
<?php
if ($fila["doscientoscincuenta"] != 0)
{
$precio = $fila["doscientoscincuenta"] + (($fila["doscientoscincuenta"] * $fila["incremento"]) / 100);
echo Round($precio,2) . "€/ud";
}
else
{
echo "Producto no disponible en esta cantidad.";
}
?>
</td>
<td width="226" align="center">
<?php
echo $fila["medida_marcaje"];
?>
</td>
</tr>
<tr>
<th width="150">500</th>
<td width="150" align="center">
<?php
if ($fila["quinientos"] != 0)
{
$precio = $fila["quinientos"] + (($fila["quinientos"] * $fila["incremento"]) / 100);
echo Round($precio,2) . "€/ud";
}
else
{
echo "Producto no disponible en esta cantidad.";
}
?>
</td>
<th width="226">Colores máximos de marcaje</th>
</tr>
<tr>
<th width="150">1000</th>
<td width="150" align="center">
<?php
if ($fila["mil"] != 0)
{
$precio = $fila["mil"] + (($fila["mil"] * $fila["incremento"]) / 100);
echo Round($precio,2) . "€/ud";
}
else
{
echo "Producto no disponible en esta cantidad.";
}
?>
</td>
<td width="226" align="center">
<?php
echo $fila["colores_maximos"];
?>
</td>
</tr>
<tr>
<th width="150">5000</th>
<td width="150" align="center">
<?php
if ($fila["cincomil"] != 0)
{
$precio = $fila["cincomil"] + (($fila["cincomil"] * $fila["incremento"]) / 100);
echo Round($precio,2) . "€/ud";
}
else
{
echo "Producto no disponible en esta cantidad.";
}
?>
</td>
<td></td>
</tr>
<tr>
<th width="150">10000</th>
<td width="150" align="center">
<?php
if ($fila["diezmil"] != 0)
{
$precio = $fila["diezmil"] + (($fila["diezmil"] * $fila["incremento"]) / 100);
echo Round($precio,2) . "€/ud";
}
else
{
echo "Producto no disponible en esta cantidad.";
}
mysql_free_result($resultado);
mysql_close($conexion);
?>
</td>
<td></td>
</tr>
</table>
</body>
<?php
}
?>
</html>
Muchas gracias por vuestras respuestas.
Un saludo.