Pb avec un chatbox

newbieflag Messages postés 8 Date d'inscription lundi 6 février 2006 Statut Membre Dernière intervention 23 novembre 2007 - 12 mars 2006 à 22:15
newbieflag Messages postés 8 Date d'inscription lundi 6 février 2006 Statut Membre Dernière intervention 23 novembre 2007 - 13 mars 2006 à 12:55
Voici le chatbox que j'ai emprunté sur une source...seul problème les messages s'effacent au bout de quelques heures...comment empêcher ça??? voici le code:
<style>
<!--
div.chat
{
overflow: auto;
width: 200px;
height: 150px;
border: 1px #757575 solid;
padding: 3px;
background: #FFFFFF;
}
div.miniform
{
width: 200px;
border: 1px #757575 solid;
border-top: 0px;
padding: 3px;
background: #EEEEEE;
text-align: center;
}
.date
{
color: #757575;
font-family:Arial;
font-weight:bold;
font-size: 8pt
}
.pseudo
{
color: #2E19D7;
font-family: Arial;
font-size: 8pt;
font-weight: bold;
text-decoration: underline;
text-transform: capitalize;
}
.msg
{color: #0000FF;
font-family: Arial;
font-size: 8pt;
font-weight: normal;
text-decoration: none
}
hr.chat
{
height: 1px #D7192E dotted;
border: 1px #D7192E dotted;
}
-->
</style>
<?php
$msg = array();
function file_save($filename, $content, $flags = 0)
{if (!($file = fopen($filename, 'w')))
return false;
$n = fwrite($file, $content);
fclose($file);
return $n ? $n : false;
}

if (!file_exists("./chat.php")) file_save("./chat.php","<?php\n\$msg = ".var_export($msg,TRUE)."\n?>");

include "chat.php";

while (count($msg) >= 5) array_shift($msg);

$canpost = empty($_POST['submit']) ? 'refresh' : $_POST['submit']; $canpost ($canpost 'refresh') ? 0 : 1;
if (!empty($_POST['mess']) && !empty($_POST['pseudo']) && $canpost)
{$i = count($msg);
$msg[$i]['pseudo'] = htmlentities($_POST['pseudo']);
$msg[$i]['texte'] = htmlentities($_POST['mess']);
$msg[$i]['date'] = time();
}

$msg2 = array_reverse($msg);
echo '
';
foreach ($msg2 as $message)
{echo ''.$message['pseudo'].' ['.date("d/m/y à H:i:s",$message['date']).']
'.nl2br($message['texte']).'
<hr class="chat">';
}
echo "
";

file_save("./chat.php", "<?php\n\$msg = ".var_export($msg,TRUE)."\n?>");
?>



<form method="post">
Pseudo:

<textarea name="mess" cols="20" rows="3"></textarea>


</form>

2 réponses

abdoulax Messages postés 875 Date d'inscription samedi 17 mai 2003 Statut Membre Dernière intervention 22 juin 2012 1
13 mars 2006 à 09:30
Ouai ms la il manque une bonne partie du code.......

Have Fun ...
0
newbieflag Messages postés 8 Date d'inscription lundi 6 février 2006 Statut Membre Dernière intervention 23 novembre 2007
13 mars 2006 à 12:55
C'est tout ce que j'ai, que manques-t-il pour toi? sinon aurais-tu un lien pour un autre chatbox fonctionnel sans base entièrement php...? Merci d'accorder du temps à mon problème...
0
Rejoignez-nous