PHP/Javascript
Myrianne
-
bissdebrazza Messages postés 2886 Statut Contributeur -
bissdebrazza Messages postés 2886 Statut Contributeur -
Bonjour,
J'arrive pas à faire fonctionner ce code depuis toute la soirée ! J'ai besoin d'aide s'il vous plaît. Voici l'erreur qui s'affiche Parse error: syntax error, unexpected $end in ... on line 152
J'arrive pas à faire fonctionner ce code depuis toute la soirée ! J'ai besoin d'aide s'il vous plaît. Voici l'erreur qui s'affiche Parse error: syntax error, unexpected $end in ... on line 152
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Tchat</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script>
function bbcode(bbdebut, bbfin)
{
var input = window.document.formulaire.message;
input.focus();
if(typeof document.selection != 'undefined')
{
var range = document.selection.createRange();
var insText = range.text;
range.text = bbdebut + insText + bbfin;
range = document.selection.createRange();
if (insText.length == 0)
{
range.move('character', -bbfin.length);
}
else
{
range.moveStart('character', bbdebut.length + insText.length + bbfin.length);
}
range.select();
}
else if(typeof input.selectionStart != 'undefined')
{
var start = input.selectionStart;
var end = input.selectionEnd;
var insText = input.value.substring(start, end);
input.value = input.value.substr(0, start) + bbdebut + insText + bbfin + input.value.substr(end);
var pos;
if (insText.length == 0)
{
pos = start + bbdebut.length;
}
else
{
pos = start + bbdebut.length + insText.length + bbfin.length;
}
input.selectionStart = pos;
input.selectionEnd = pos;
}
else
{
var pos;
var re = new RegExp('^[0-9]{0,3}$');
while(!re.test(pos))
{
pos = prompt("insertion (0.." + input.value.length + " ):", "0" );
}
if(pos > input.value.length)
{
pos = input.value.length;
}
var insText = prompt("Veuillez taper le texte" );
input.value = input.value.substr(0, pos) + bbdebut + insText + bbfin + input.value.substr(pos);
}
}
function smilies(img)
{
window.document.formulaire.message.value += '' + img + '';
}
</script>
</head>
<style>
body
{
background-image: url('background.jpg');
}
#message
{
margin-top: 10px;
overflow: auto;
border: 1px solid black;
width: 600px;
height: 500px;
text-align: left;
padding: 5px
}
</style>
<body>
<center>
<div id="message">
<?php
function smiley($donnees)
{
$codsmiley = array(':folle:' , ':lol:');
$imgsimley = array('<img src="http://localhost/tchat/smileys/folle.gif"/> , <img src="http://localhost/tchat/smileys/lol.gif"/>');
str_replace($codsmiley, $imgsmiley, $message);
return $donnees;
if (isset($_POST['pseudo']) AND isset($_POST['message']))
{
if ($_POST['pseudo'] != NULL AND $_POST['message'] != NULL)
{
mysql_connect("localhost", "caché", "caché" );
mysql_select_db("caché" );
$message = mysql_real_escape_string(htmlspecialchars($_POST['message']));
$pseudo = mysql_real_escape_string(htmlspecialchars($_POST['pseudo']));
mysql_query("INSERT INTO webmaster011 VALUES('', '$pseudo', '$message')" );
mysql_close();
}
}
?>
<?php
mysql_connect("localhost", "caché", "caché" );
mysql_select_db("caché" );
$reponse = mysql_query("SELECT * FROM tchat ORDER BY ID DESC LIMIT 0,20" );
mysql_close();
while ($donnees = mysql_fetch_array($reponse) )
{
?>
<p><strong><?php echo $donnees['pseudo']; ?></strong> : <?php echo smiley($donnees['message']); ?></p>
<?php
}
?>
</div>
<p>
<form method="post" action="chat.php" name="formulaire">
Pseudo: <input type="text" name="pseudo" /><br/>
Message:<input type="text" name="message" /><br/>
<input type= "submit" />
<input type="reset" name = "Effacer" value = "Effacer"/><br/>
<fieldset><legend>Mise en forme</legend>
<img src="http://localhost/tchat/smileys/folle.gif" title="folle" alt="folle" onClick="javascript:smilies(':folle:');return(false)" />
<img src="http://localhost/tchat/smileys/lol.gif" title="lol" alt="lol" onClick="javascript:smilies(':lol:');return(false)" />
</fieldset>
</p></form>
</center>
</body>
</html>
A voir également:
- PHP/Javascript
- Easy php - Télécharger - Divers Web & Internet
- Telecharger javascript - Télécharger - Langages
- Expert php pinterest - Télécharger - Langages
- A javascript error occurred in the main process - Forum Windows
- A javaScript error occurred in the main process - Forum Handicap / Accessibilté
2 réponses
SALUT!
une accolade manquante
une accolade manquante
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Tchat</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script>
function bbcode(bbdebut, bbfin)
{
var input = window.document.formulaire.message;
input.focus();
if(typeof document.selection != 'undefined')
{
var range = document.selection.createRange();
var insText = range.text;
range.text = bbdebut + insText + bbfin;
range = document.selection.createRange();
if (insText.length == 0)
{
range.move('character', -bbfin.length);
}
else
{
range.moveStart('character', bbdebut.length + insText.length + bbfin.length);
}
range.select();
}
else if(typeof input.selectionStart != 'undefined')
{
var start = input.selectionStart;
var end = input.selectionEnd;
var insText = input.value.substring(start, end);
input.value = input.value.substr(0, start) + bbdebut + insText + bbfin + input.value.substr(end);
var pos;
if (insText.length == 0)
{
pos = start + bbdebut.length;
}
else
{
pos = start + bbdebut.length + insText.length + bbfin.length;
}
input.selectionStart = pos;
input.selectionEnd = pos;
}
else
{
var pos;
var re = new RegExp('^[0-9]{0,3}$');
while(!re.test(pos))
{
pos = prompt("insertion (0.." + input.value.length + " ):", "0" );
}
if(pos > input.value.length)
{
pos = input.value.length;
}
var insText = prompt("Veuillez taper le texte" );
input.value = input.value.substr(0, pos) + bbdebut + insText + bbfin + input.value.substr(pos);
}
}
function smilies(img)
{
window.document.formulaire.message.value += '' + img + '';
}
</script>
</head>
<style>
body
{
background-image: url('background.jpg');
}
#message
{
margin-top: 10px;
overflow: auto;
border: 1px solid black;
width: 600px;
height: 500px;
text-align: left;
padding: 5px
}
</style>
<body>
<center>
<div id="message">
<?php
function smiley($donnees)
{
$codsmiley = array(':folle:' , ':lol:');
$imgsimley = array('<img src="http://localhost/tchat/smileys/folle.gif"/> , <img src="http://localhost/tchat/smileys/lol.gif"/>');
str_replace($codsmiley, $imgsmiley, $message);
return $donnees;
if (isset($_POST['pseudo']) AND isset($_POST['message']))
{
if ($_POST['pseudo'] != NULL AND $_POST['message'] != NULL)
{
mysql_connect("localhost", "caché", "caché" );
mysql_select_db("caché" );
$message = mysql_real_escape_string(htmlspecialchars($_POST['message']));
$pseudo = mysql_real_escape_string(htmlspecialchars($_POST['pseudo']));
mysql_query("INSERT INTO webmaster011 VALUES('', '$pseudo', '$message')" );
mysql_close();
}
}
}
?>
<?php
mysql_connect("localhost", "caché", "caché" );
mysql_select_db("caché" );
$reponse = mysql_query("SELECT * FROM tchat ORDER BY ID DESC LIMIT 0,20" );
mysql_close();
while ($donnees = mysql_fetch_array($reponse) )
{
?>
<p><strong><?php echo $donnees['pseudo']; ?></strong> : <?php echo smiley($donnees['message']); ?></p>
<?php
}
?>
</div>
<p>
<form method="post" action="chat.php" name="formulaire">
Pseudo: <input type="text" name="pseudo" /><br/>
Message:<input type="text" name="message" /><br/>
<input type= "submit" />
<input type="reset" name = "Effacer" value = "Effacer"/><br/>
<fieldset><legend>Mise en forme</legend>
<img src="http://localhost/tchat/smileys/folle.gif" title="folle" alt="folle" onClick="javascript:smilies(':folle:');return(false)" />
<img src="http://localhost/tchat/smileys/lol.gif" title="lol" alt="lol" onClick="javascript:smilies(':lol:');return(false)" />
</fieldset>
</p></form>
</center>
</body>
</html>