Bonjour
j'ai mis sur mon site un petit espace ou les visiteurs peuvent envoyer les annonces gratuites.
Mais quand quel'un fait un saut de ligne , le scriot arrete.
j'ai utilisé php et mysql pour envoyer les messages dans une base de donnée.
Voici le script qui affiche la page :
le script ne marche pas pour le moment , vous pouvez le voir sur mon site en haut http://www.doublecanon.be/
<?php
#################################
$requet = mysql_query('SELECT msg FROM annonce ORDER BY id DESC LIMIT 7' );
$msg='';
while ($donnee=mysql_fetch_array($requet)) {
$msg = $msg.' '.$donnee['msg'];}
function unhtmlentities ($string)
{
// Remplace les entités numériques
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
// Remplace les entités litérales
$trans_tbl = get_html_translation_table (HTML_ENTITIES);
$trans_tbl = array_flip ($trans_tbl);
return strtr ($string, $trans_tbl);
}
$msg = unhtmlentities($msg);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script language="JavaScript">
<!--
//PLF-http://www.jejavascript.net/
var position=0;
var msg="<?php echo $msg; ?>"
var msg=" "+msg;
var longue=msg.length;
var fois=(200/msg.length)+1;
for(i=0;i<=fois;i++) msg+=msg;
function textdefil() {
document.form1.deftext.value=msg.substring(position,position+200);
position++;
if(position == longue) position=0;
setTimeout("textdefil()",200);
}
window.onload = textdefil;
//-->
</script>
</head>
<body topmargin="0" leftmargin="0" bgcolor="#AE0000">
<form name="form1">
<div align="center">
<input type="text" name="deftext" size=200 style="font-size: 8 pt; color: #FFFFFF; background-color: #AE0000; border: 1 solid #FFFFFF">
</div>
</form>
</body>
</html>
Partager