Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/11/2002, 13:56
jonai
 
Fecha de Ingreso: noviembre-2002
Mensajes: 59
Antigüedad: 21 años, 5 meses
Puntos: 0
AYUDA CON SCRIPT DE PHP para TXT

Buenas tardes foreros todos estoy realizando un pequeño ticked de noticias utilizando el sript que paso a continuación:


--------------------------------------
Código PHP:

<?php
/////////////////////////////////////////////////////////////////////////
/////////////////////////////set the following///////////////////////////
/////////////////////////////////////////////////////////////////////////
$max "900"// sets the maximum amount of chars allowed per post.
$urpassword "pontupasssssssword"//set to your desired password.
/////////////////////////////////////////////////////////////////////////
$date_array getdate();
$time date("l, d M Y");
$news addslashes($news);

if (
$x == "1") {
global 
$urpassword;
   if (
$password == $urpassword){
   global 
$max;
      if ( 
strlen($news) > and strlen($news) <= $max){
         global 
$news$time;
         
$filename "guest.txt";
         
$fp fopen$filename"w" ) or die ("no file opening is occuring"); //$fp is short for file pointer
         
flock($fp,1); //allows file reading but prevents writing
         
fwrite($fp," ");
         
rewind($fp); // re-sets file pointer to start of file.
         
$newsall "book= $news";
         
fwrite$fp$newsall); //writes the value of the counter to where filepointer is.
         
flock($fp,3); //releases file
         
print "<p align='left'>Se han a&ntilde;adido las nuevas noticias:<br>";
         print 
"<b>$news</b> ";
         print 
"<br>Pulsa <a href='javascript:history.back()' style='text-decoration: none'>[aqui]</a> para ver los cambios.</p>";
      } else if (
$news == NULL){
         print 
"<p align='left'>Introduce alguna noticia 
<a href='javascript:history.back()' style='text-decoration: none'>[back]</a></p>"
;
      } else {
         print 
"<p align='left'><font size='2' face='Arial'>Ha ocurrido un erro la noticia tiene que tener 4 letras al menos y menos de $max.</font></p>";
      }
   } else {
     print 
"<b>$password</b> La contrase&ntilde;a no es valida <a href='javascript:history.back()' style='text-decoration: none'>[back]</a><br>";
   }
}
?>
<html>

<head>
<title>AÑADE NOTICIAS</title>
<style fprolloverstyle>A:hover {color: #000000}
</style>
</head>
<font face="Arial" size="2">INTRODUCE LA NOTICIA</font>

</html>
<font face="Arial" size="2">NO MAS DE</font><html><font face="Arial" size="2">&nbsp;&nbsp; </font>
<font face="Arial" size="1">(<?php global $max; print $max?> caracteres)</font><font face="Arial" size="2"><br><br>FECHA: <b><?php print $time?></b></font>
<body text="#000000" link="#000080" vlink="#000080" alink="#000080" style="font-family: Arial; font-size: 10pt">
<form method="POST" action=<?php print("$PHP_SELF"); ?>>
  <p>
  <textarea rows="9" name="news" cols="38" style="border-style: solid; border-width: 1"></textarea><br>
  INTRODUCE LA  CONTRASE&Ntilde;A&nbsp;&nbsp;&nbsp;<input type="password" name="password" size="20" style="border-style: solid; border-width: 1">&nbsp;<input type="hidden" name="x" size="1" value="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <input type="submit" value="Submit" name="B1" style="font-family: Arial; font-size: 10px; background-color: #FFFFFF"><input type="reset" value="Reset" name="B2" style="font-family: Arial; font-size: 10px; background-color: #FFFFFF"></p>
</form>

</body></html>
<b>NOTICIA A INCLUIR:</b><br><?php include("guest.txt");?>

</body>
-----------------------------
El script no es mio es el simplesnews y realmente me interesa que guarde los datos en un txt para poder leerlos desde flash, cual es mi problema:
1.- Para empezar no sé cómo hacer que al poner algún carácter especial ñ, é ü lo reconozca y me lo pase bien al txt para que sea legible una vez que lo solicito.

2.- Como hacer para poner un enlace, se puede poner algo así como lo que está en la opción de mandar mensajes de los foros.

Estoy agradecido desde ya.

Por cierto aquí les dejo el script para a quién pueda interesarle: