Foros del Web » Creando para Internet » Sistemas de gestión de contenidos »

esto esta bien

Estas en el tema de esto esta bien en el foro de Sistemas de gestión de contenidos en Foros del Web. es un mini chat <? /** * minichat 2 * Copyright Paul Mutton, 15th August 2002. * http://www.jibble.org/ * * Include this file on a ...
  #1 (permalink)  
Antiguo 05/08/2008, 18:05
 
Fecha de Ingreso: mayo-2008
Mensajes: 499
Antigüedad: 16 años
Puntos: 1
esto esta bien

es un mini chat

<?

/**
* minichat 2
* Copyright Paul Mutton, 15th August 2002.
* http://www.jibble.org/
*
* Include this file on a PHP web page to add a mini chat box.
*
* Features:-
* Totally rewritten from scratch.
* Much much more efficient than the previous version.
* HTML tags are filtered out.
* Imposes a max word size to avoid wrapping issues.
* Max nick and message lengths are enforced on the server side.
* Accidental "refresh" reposting is avoided.
* Appends all messages chronologically to the archive file.
* Displays latest 20 messages with the most recent at the top.
* Now logs I.P. addresses within comments (do what you want with them).
* Displays posting time in correct local time.
*
*/

$latest = $DOCUMENT_ROOT . "/temp/minichat2.latest";
$archive = $DOCUMENT_ROOT . "/temp/minichat2.archive";
$size = 20;
$nick_size = 20;
$message_size = 256;
$max_word_size = 20;

?>

<table width="120" align="center" border="0">
<tr>
<td>
<p align="center">
<font face="arial,sans-serif"><b><a href="http://www.jibble.org/chatbox.php">minichat 2</a></b></font>
</p>
<p align="center">
<form name="minichat_form" method="POST" action="<? echo $_SERVER['PHP_SELF']; ?>">
<font face="arial,sans-serif" size="2">
<input type="hidden" name="minichat_md5" value="<? if (isset($minichat_message)) {echo md5($minichat_message);} ?>">
Nick:<br>
<input type="text" name="minichat_nick" maxlength="<? echo $nick_size; ?>" size="15" style="font-family: Verdana, Arial, Helvetica, Sans-serif; font-size: 10px"><br>
Message:<br>
<textarea name="minichat_message" cols="16" rows="3" style="font-family: comic sans ms, Arial, Helvetica, Sans-serif; font-size: 10px"></textarea><br>
<input type="submit" name="minichat_submit" value="submit">
</font>
</form>
</p>
<p>
<font face="arial,sans-serif" size="1">

<?php

// Check to see if the user is trying to post something.
if (isset($minichat_md5) && isset($minichat_nick) && isset($minichat_message)) {

// Replace any new line stuff with a space.
$nick = strtr($nick, "\r\n", " ");
$message = strtr($message, "\r\n", " ");

// Trim leading and trailing whitespace where necessary and remove slashes.
$nick = trim(stripslashes($minichat_nick));
$message = trim(stripslashes($minichat_message));

// Only proceed if the md5 hash of message is not repeated.
if (md5($message) != $minichat_md5) {

// Only proceed if the user actually filled in both fields.
if (strlen($nick) > 0 && strlen($message) > 0) {

// If the fields are too long, then chop them to the limits.
if (strlen($nick) > $nick_size) {
$nick = substr($nick, 0, $nick_size);
}
if (strlen($message) > $message_size) {
$message = substr($message, 0, $message_size);
}

// Remove new line characters from the input.
$nick = str_replace("\n", " ", $nick);
$message = str_replace("\n", " ", $message);

// Enforce the maximum word size by breaking up $message into lines.
$message = preg_replace("/([^\s]{20})/", "$1\n", $message);

// Now we can encode the nick and message into HTML.
$nick = htmlentities($nick);
$message = htmlentities($message);

// Now replace the new line characters in $message.
$message = str_replace("\n", "<br>", $message);

// The IP address of the poster, web cache or whatever.
$ip = $_SERVER['REMOTE_ADDR'];
$time = date("j M Y - G:i:s T");

// Check to see if the 'latest' and 'archive' files exist and can be written to.
if (!is_writable($latest) || !is_writable($archive)) {
// Touch both files.
touch($latest);
touch($archive);
if (!is_writable($latest) || !is_writable($archive)) {
exit("$latest or $archive is not writable. Please check your permissions and try again.");
}
}

// Read every line of the 'latest' file into an array.
$lines = file($latest);
$bottom_index = count($lines);

// Note that each entry takes up 4 lines.
$line_ip = "<!-- $ip -->\n";
$line_nick = "* <font color=\"#9999ff\">Posted by $nick\n";
$line_time = "on $time</font><br>\n";
$line_message = "$message<br><br>\n";

$entry = $line_ip . $line_nick . $line_time. $line_message;

$already_posted = 0;
for ($i = 3; $i < $bottom_index; $i += 4) {
if ($lines[$i] == $line_message) {
$already_posted = 1;
break;
}
}

if ($already_posted == 0) {
// Now rebuild the 'latest' file.
// Start by entering the new entry at the top.
$out = fopen($latest, "w");
fwrite($out, $entry);

// Then write all other entries except the oldest.
if ($bottom_index >= $size * 4) {
$bottom_index = $size * 4 - 4;
}
for ($i = 0; $i < $bottom_index; $i++) {
fwrite($out, $lines[$i]);
}
fclose($out);

// Also append the entry to the archive file.
$out = fopen($archive, "a");
fwrite($out, $entry);
fclose($out);
}
else {
// This avoided a "probably accidental" repost.
}

}
else {
echo "<font color=\"red\">You must fill in both fields</font><br><br>";
}
}
else {
// This avoided a deliberate repost, maybe we should say something?
}


}

// include the latest comments on the page.
if (file_exists($latest)) {
include($latest);
}

?>

</font>
</p>
</td>
</tr>
</table>



porque me envia un < y dice que no se encontro ese file
  #2 (permalink)  
Antiguo 05/08/2008, 18:17
Avatar de chwc  
Fecha de Ingreso: julio-2008
Ubicación: Buenos Aires ! :D
Mensajes: 814
Antigüedad: 15 años, 9 meses
Puntos: 103
Respuesta: esto esta bien

de donde lo sacaste??????
fijate bien las instrucciones
que es esto:
$latest = $DOCUMENT_ROOT . "/temp/minichat2.latest";
$archive = $DOCUMENT_ROOT . "/temp/minichat2.archive";

me parece que tienes que crear esos dos archivos
  #3 (permalink)  
Antiguo 05/08/2008, 21:55
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: esto esta bien

a que te refieres con que... ¿¿¿esta bien???

digo, te envia un queee??? y que te dice que no encontro... ¿¿¿que file???

al parecer, no se puede decir si este bien o no.... no dices mucha informacion, suerte!
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #4 (permalink)  
Antiguo 06/08/2008, 08:20
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: esto esta bien

Tema trasladado a Aplicaciones Prefabricadas.

Por favor se mas claro en tus dudas.
  #5 (permalink)  
Antiguo 06/08/2008, 15:12
 
Fecha de Ingreso: mayo-2008
Mensajes: 499
Antigüedad: 16 años
Puntos: 1
Respuesta: esto esta bien

osea le aprieto submit
y.........

Forbidden

You don't have permission to access /iozk.php/< on this server.

y esto en direccion no se si es vital para saber el error

http://localhost/iozk.php/%3C?%20echo%20$_SERVER['PHP_SELF'];%20?%3E
  #6 (permalink)  
Antiguo 06/08/2008, 18:36
Avatar de jam1138
/** @package Moderador */
 
Fecha de Ingreso: julio-2004
Ubicación: sèveR led onieR lE
Mensajes: 9.368
Antigüedad: 19 años, 9 meses
Puntos: 102
Respuesta: esto esta bien

Es obvio la URL esta mal. Primero haz lo mismo que te dije acá: http://www.forosdelweb.com/f18/ayuda...6/#post2523684

Posteriormente reintenta a ver si con eso se arregla.
__________________
٩(͡๏̯͡๏)۶
» Cómo hacer preguntas de manera inteligente «

"100 años después, la revolución no es con armas, es intelectual y digital"
  #7 (permalink)  
Antiguo 08/08/2008, 15:52
 
Fecha de Ingreso: mayo-2008
Mensajes: 499
Antigüedad: 16 años
Puntos: 1
Respuesta: esto esta bien

el code lo saque de aqui http://www.jibble.org/chatbox.php pero me dice que cambie esto

$latest = $DOCUMENT_ROOT . "/temp/minichat2.latest";
$archive = $DOCUMENT_ROOT . "/temp/minichat2.archive";

pero no se como estructurar el codigo
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:23.