Ver Mensaje Individual
  #9 (permalink)  
Antiguo 15/05/2011, 15:56
HalconVigia
 
Fecha de Ingreso: abril-2003
Ubicación: Mexico
Mensajes: 604
Antigüedad: 21 años
Puntos: 23
Información Respuesta: como hacer un buzon de mensaje para web

Buenas...

Tengo una muestra que hace algun tiempo alguien me dio. Espero que te sirva de base y lo adaptes a tus necesidades...

Index.php
Código PHP:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Comentarios</title>
<style type="text/css">
<!--
body {
    background-color: #FFFFFF;
}
.style1 {
    color: #000000;
    font-family: "Comic Sans MS";
}
a:link {
    color: #000000;
    text-decoration: none;
}
a:visited {
    text-decoration: none;
    color: #000000;
}
a:hover {
    text-decoration: none;
    color: #FF0000;
}
a:active {
    text-decoration: none;
    color: #000000;
}
-->
</style>
</head>
<body>
<p class="style1"><a href="enviar.php">Has Click aki para enviar tu comentario!</a></p>
<p align="left" class="style1">Actualmente hay  <?php #mostramos la cantidad de comentarios
$path $HTTP_SERVER_VARS['DOCUMENT_ROOT'];
$archivo file($path."/contador.txt");
$lineas count($archivo);
for(
$i=0$i $lineas$i++){
echo 
$archivo[$i]."<br>";
}
?>Comentarios</p>
</body>
</html>


<table width="250" border="0" align="justify">
  <tr>
    <th scope="col"><?php #aka los comentarios
$path $HTTP_SERVER_VARS['DOCUMENT_ROOT'];
$archivo file($path."/datos.txt");
$lineas count($archivo);
for(
$i=0$i $lineas$i++){
echo 
$archivo[$i]."<br>";
}

?></th>
  </tr>
</table>
Enviar.php
Código PHP:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Enviar Comentarios!</title>
<style type="text/css">
<!--
body {
    background-color: #FFFFFF;
}
.style2 {color: #FFFFFF}
#apDiv1 {
    position:absolute;
    left:168px;
    top:15px;
    width:246px;
    height:27px;
    z-index:1;
}
#apDiv2 {
    position:absolute;
    left:181px;
    top:65px;
    width:182px;
    height:22px;
    z-index:2;
}
body,td,th {
    color: #000000;
}
-->
</style></head>

<body>
<form action="<?=$PHP_SELF?>redireccionar.php" method="post" class="style2">
  <table width="250" border="0">
      <tr>
        <th scope="col">Ingresa tu Nick/Nombre</th>
      </tr>
      <tr>
        <th scope="col"><input name="nombre" type="text"  /></th>
      </tr>
      <tr>
        <th scope="row">Ingresa Tu Comentario</th>
    </tr>
      <tr>
        <th scope="row"><textarea name="apellidos"></textarea>        </th>
      </tr>
    </table>
  <br />
    <input type="submit" value="Enviar" />
</form>
</span>
</body>
</html>
redireccion.php
Código PHP:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Redireccion...</title>
<style type="text/css">
<!--
.style2 {
    font-family: "Comic Sans MS";
    font-weight: bold;
    font-size: 16px;
}
a:link {
    color: #000000;
    text-decoration: none;
}
a:visited {
    color: #000000;
    text-decoration: none;
}
a:hover {
    color: #FF0000;
    text-decoration: none;
}
a:active {
    color: #000000;
    text-decoration: none;
}
a {
    font-size: 14px;
    font-weight: bold;
}
.style3 {font-family: "Comic Sans MS"}
.style4 {font-size: 16px}
.style6 {font-size: 16}
.style8 {font-size: 14px}
.style9 {font-family: "Comic Sans MS"; font-size: 14px; }
-->
</style>
<body>
<?php #aka se gurdan los archivos resividos del formulario
if(isset($_POST['nombre'],$_POST['apellidos'])){

    
#se abre el fichero en modo lectura y escritura.
    
$archivo fopen("/datos.txt","w+");

    
#se crea uan variable con los datos a introducir. \r\n genera un salto de linea
    
$cadena "Nombre: ".$_POST['nombre'].".\r\nComentarios: ".$_POST['apellidos'].".\r\n\r\n";
    
fputs($archivo,$cadena);

    
#se cierra el fichero
    
fclose($archivo);
#aka porcada ves que se le de enviar el vacontando el este archivo
$archi '/contador.txt';
$auxi fopen($archi'rb');
$Visitas fgets($auxi10);
$Visitas++;
fclose($auxi);

$auxi fopen($archi'wb');
fwrite($auxi$Visitas);
fclose($auxi);

echo  
$_POST['nombre'];
echo 
$_POST['apellidos'];
echo 
"<br>".$cadena;
?>
<p class="style2">Gracias por tu Comentarios</p>
<p class="style1"> <span class="style3"><span class="style4"><span class="style6"><span class="style8"><a href="index.php">Has Click aki para ver tu Comentario</a></span></span></span></span></p>
<p class="style1"><span class="style9"><a href="javascript:window.close()">Has Click aki para salir de la web</a></span></p>
</body>
</html>
Espero que te sirva... saludos...
__________________
¡El Respeto al Derecho Ajeno Es la Paz!