Salut à tous.
J´aimerai savoir comment avoir un retour à la ligne tout les 50 caractères.
Merci.
Voilà le source de mon tchat en php.
< ?
$date = date("d/m");
$heure = date("H\hi");
echo " <H1>Index of Chat</H1>";
echo " <UL><img src=\"../up.gif\"><a href=../acceuil.html> Parent Directory</a></UL>";
echo " <center><img src=\"../Gif%20animes/sharingan01.gif\"><font color=\"#cc0000\" size=\"7\"><b>TCHAT-BOX</b><img
src=\"../Gif%20animes/sharingan01.gif\"></font>";
echo " <body bgcolor=\"#000000\"><br><br>";
echo " <table width=\"81%\" align=\"right\" border=\"1\" bordercolor=\"#cc0000\"><tr><td><div align=\"left\"><br>";
echo " <font color=\"#CC0000\">";
if($HTTP_POST_VARS[´submit´]) {
if(strstr($REMOTE_ADDR,"68.67.222.10")) { / / This is how you can set bans on people that abuse the system, just copy and paste this code and change the ip address
echo " You are banned due to abuse."; / / A message to tell the banned person they are banned
exit;
}
if(!$HTTP_POST_VARS[´name´]) {
echo " <font color=\"#cc0000\" size=\"7\">Entrez votre pseudo ! !!";
exit;
}
if(!$HTTP_POST_VARS[´shout´]) {
echo " <font color=\"#cc0000\" size=\"7\">Tapez votre texte ! !!";
exit;
}
if(strstr($HTTP_POST_VARS[´name´],"|")) {
echo " <font color=\"#cc0000\" size=\"7\">Name cannot contain the pipe symbol - |";
exit;
}
if(strstr($HTTP_POST_VARS[´shout´],"|")) {
echo " <font color=\"#cc0000\" size=\"7\">shout cannot contain the pipe symbol - |";
exit;
}
$fp = fopen(´shouts.txt´,´a´);
if(!$fp) {
echo " <font color=\"#cc0000\" size=\"7\">Error opening file!";
exit;
}
$line = $HTTP_POST_VARS[´name´];
$line . = " " . $date;
$line . = " " . $heure;
$line . = " |" . $HTTP_POST_VARS[´shout´];
$line . = " |" . $HTTP_POST_VARS[´url´];
$line = str_replace("\r\n","<BR>",$line);
$line = str_replace ( ":)", " <img src=smiles/icon_smile.gif>", $line);
$line = str_replace ( ":D", " <img src=smiles/icon_biggrin.gif>", $line);
$line = str_replace ( ":P", " <img src=smiles/icon_tounge.gif>", $line);
$line = str_replace ( ":(", " <img src=smiles/icon_sad.gif>", $line);
$line = str_replace ( "8)", " <img src=smiles/icon_cool.gif>", $line);
$line = str_replace ( ";)", " <img src=smiles/icon_wink.gif>", $line);
$line = str_replace ( ":-o", " <img src=smiles/icon_surprised.gif>", $line);
$line = str_replace ( ":flat:", " <img src=smiles/icon_neutral.gif>", $line);
$line = str_replace ( "8o", " <img src=smiles/icon_eek.gif>", $line);
$line = str_replace ( ":?", " <img src=smiles/icon_confused.gif>", $line);
$line = str_replace ( ":evil:", " <img src=smiles/icon_twisted.gif>", $line);
$line = str_replace ( ":eyes:", " <img src=smiles/icon_Eyecrazy.gif>", $line);
$line = str_replace ( "^^", " <img src=smiles/kakaicon.gif>", $line);
$line = str_replace ( "
", " <img src=smiles/kakashi4.gif>", $line);
$line = str_replace ( ":sweatdrop:", " <img src=smiles/sweatdrop.gif>", $line);
$line = str_replace ( ":yelling:", " <img src=smiles/yelling.gif>", $line);
$line = str_replace ( ":ninjaplot:", " <img src=smiles/ninjaplot.gif>", $line);
$line . = " \r\n";
fwrite($fp, $line);
if(!fclose($fp)) {
echo " <font color=\"#cc0000\" size=\"7\">Error closing file!";
exit;
}
echo " <font color=\"#CC0000\"><b>Texte ajouté!</b></font>\n";
}
$data = file(´shouts.txt´);
$data = array_reverse($data);
foreach($data as $element) {
$element = trim($element);
$pieces = explode("|", $element);
if(!$pieces[2]) {
echo " " . $pieces[0] . " : " . $pieces[1] . " <hr height=\"1\" color=\"#cc0000\" width=\"50%\">";
}
else {
echo " <a href=$pieces[2]>" . $pieces[0] . " :</a> " . $pieces[1] . " <hr height=\"1\" color=\"#0066CC\" width=\"50%\">";
}
}
echo " </div><div align=\"left\">";
echo " </td></tr></table><H5><u></u></H5><table bgcolor=\"#000000\" width=\"75\" align=\"left\" border=\"1\" bordercolor=\"#cc0000\"><tr><td><div align=\"left\"";
? >