Código PHP:
<html>
<head>
<title>Amigos</title>
<link rel="STYLESHEET" type="text/css" href="estilo.css">
</head>
<body>
<br>
<table align="center" width="550" cellspacing="2" cellpadding="8" border="0" bgcolor="#ffffff">
<tr>
<td>
<h1>Amigos</h1>
<?
//conecto con la base de datos
$conn = mysql_connect("","","");
mysql_select_db("",$conn);
if (!$HTTP_POST_VARS)
{
$ssql = "SELECT * FROM amigos";
if (isset($_GET["vermas"]))
$ssql .= " where id_amigos<=" . $vermas;
$ssql .= " ORDER BY id_amigos desc limit 11";
$resultid = mysql_query($ssql,$conn);
?>
Añadete a la seccion amigos
<br>
<br>
<?
$num_filas = 0;
while (($damefila=mysql_fetch_object($resultid)) && ($num_filas<10))
{
?>
<table align="center" width="100%" cellspacing="2" cellpadding="0" border="0">
<tr>
<td valign="top" class=fuente8><b>
<? if ($damefila->nombre == "-"){
echo "An�nimo";
}elseif ($damefila->email != "-") {
echo '<b>' . $damefila->nombre . '</b> - ' . $damefila->email . '';
}else{
echo $damefila->nombre;
}
?></b><br>
</td></tr>
<tr><td bgcolor=cccccc colspan="2"><img src="images/pixeltrans.gif" width=1 height=1 border="0"></td></tr>
<td class=fuente8 valign="top">
<?echo '<img src="' . $damefila->foto . '" width="200" height="200">?>
</td>
</tr>
</table>
<br>
<?
$num_filas++;
}
if ($damefila)
echo "<div align=center><b><a href=\"index.php?vermas=$damefila->id_amigos\">Ver mas amigos</a></b></div><br>";
mysql_free_result($resultid);
include ("formuamigo.html");
}
else
{
$nombre = strip_tags($_POST["nombre"]);
$email = strip_tags($_POST["email"]);
$foto = strip_tags($_POST["foto"]);
$nombre=substr($nombre,0,150);
$email=substr($email,0,80);
if (strlen($nombre)==0 and strlen($email)==0 and strlen($foto)==0)
{
?>
<div align="center"><b>Rellena todos los campos</div>
<?
}else{
if (!$nombre)$nombre="-";
if (!$email) $email="-";
if (!$foto) $foto="sin foto";
$ssql = "INSERT INTO amigos (nombre,email,foto) VALUES ('" . $nombre . "','" . $email . "','" . $foto . ")";
//echo $ssql . "<p>";
mysql_query($ssql,$conn);
?>
<div align="center"><b>Muchas gracias por tu participación</b></div>
<?
}
?>
<br>
<br>
<div align="center"><b><a href=".">Volver a la seccion de amigos</a></b></div>
<?
}
mysql_close($conn);
?>
</td>
</tr>
</table>
<br>
</body>
</html>
Este es el codigo completo