Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/03/2009, 07:50
gomminola
 
Fecha de Ingreso: mayo-2008
Mensajes: 253
Antigüedad: 16 años
Puntos: 8
sistema de comentarios

Hola de nuevo, encontre este sistema de comentarios.

Código PHP:
<?php


$datafile 
"msgs.data";


if(isset(
$_POST[content])) {
      
extract($_POST);

    
$oldarray fopen("$datafile""r");
    
$oldcontents fread($oldarrayfilesize($datafile)) or die( 'Could not read from file.');
    
fclose($oldarray);

    if(!
$fp fopen("$datafile""w")){
        die(
"Error: PHP does not appear to have permission to write to $datafile");
      }
    
fwrite ($fp"<b>Posted by:</b> $name -- ");
    
fwrite ($fpdate("n/d/y h:i:s A"));
    
fwrite ($fp"<br><b>Email:</b> <a href='mailto:$email'>$email</a><br>");
    
fwrite ($fp"<b>Topic:</b> $title<br><br>");
    
fwrite ($fpstripslashes($content) . "<br><hr noshade size=1><br>");

    
fwrite ($fp$oldcontents);
    
fclose($fp);
    
header("Location: $_SERVER[PHP_SELF]");
}
?>


<!-- HTML Begins Here -->


<font size=2 style='font-family:Verdana'>
<center><a href="#postnew">Post a Message</a></center><p>

<?

require("$datafile");
?>

<br><br>
<a name="postnew"></a>
<form method="post" action="<? echo $_SERVER[PHP_SELF]; ?>">
Name: <input type="text" name="name"><br>
Email: <input type="text" name="email"><br>
Title: <input type="text" name="title"><br>
<textarea name=content rows=15 cols=50 wrap=soft></textarea>
<input type="submit" name="submitButton" value="Post">
Lo que no entiendo es 1 cosa, cuando inserto el codigo en un div d html no me funciona, ¿pq?, si subo el php y lo ejectudo si va, tanto codigo me esta volviendo loca
Me da el error de que no encuentra el archivo $_SERVER[PHP_SELF];