merci spiriteblue et je dois mettre le code après quel ligne de code ???
J'ai fais un test en ajoutant le code en dessous du fichier shoutbox.php et ça ne fonctionne pas quand je met ton code il n'y à plus rien qui apparaît dans la shoutbox
voici mon code du fichier non modifier shoutbox.php ci-dessous
Thank you Spiriteblue and I have to put the code after which line of code ???
I did a test by adding the code below the shoutbox.php file and it does not work when I put your code there is nothing that appears in the shoutbox
Here is my file of the file not modifying shoutbox.php below
<?php
//
// TorrentTrader v2.x
// $LastChangedDate: 2012-06-14 17:31:26 +0100 (Thu, 14 Jun 2012) $
// $LastChangedBy: torrenttrader $
//
// http://www.torrenttrader.org
//
//
require_once("backend/functions.php");
dbconn();
?>
<script type="text/javascript">
<!--
function bbshout(repdeb, repfin) {
var input = document.forms['shoutboxform'].elements['message'];
input.focus();
if(typeof document.selection != 'undefined') {
var range = document.selection.createRange();
var insText = range.text;
range.text = repdeb + insText + repfin;
range = document.selection.createRange();
if (insText.length == 0) {
range.move('character', -repfin.length);
} else {
range.moveStart('character', repdeb.length + insText.length + repfin.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) + repdeb + insText + repfin + input.value.substr(end);
var pos;
if (insText.length == 0) {
pos = start + repdeb.length;
} else {
pos = start + repdeb.length + insText.length + repfin.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 àla position (0.." + input.value.length + "):", "0");
}
if(pos > input.value.length) {
pos = input.value.length;
}
var insText = prompt("Veuillez entrer le texte àformater:");
input.value = input.value.substr(0, pos) + repdeb + insText + repfin + input.value.substr(pos);
}
}
function bbcolor() {
var colorvalue = document.forms['shoutboxform'].elements['color'].value;
bbshout("[color="+colorvalue+"]", "[/color]");
}
function bbfont() {
var fontvalue = document.forms['shoutboxform'].elements['font'].value;
bbshout("[font="+fontvalue+"]", "[/font]");
}
function bbsize() {
var sizevalue = document.forms['shoutboxform'].elements['size'].value;
bbshout("[size="+sizevalue+"]", "[/size]");
}
function bbimg() {
var imgvalue = document.forms['shoutboxform'].elements['img'].value;
bbshout("[img="+sizevalue+"]", "[/img]");
}
function bbblink() {
var blink = document.forms['shoutboxform'].elements['blink'].value;
bbshout("[blink="+blinkvalue+"]", "[/blink");
}
function bbdf() {
var df = document.forms['shoutboxform'].elements['df'].value;
bbshout("[df="+dfvalue+"]", "[/df");
}
//-->
</script>
<script type="text/javascript">
function blink() {
var blinks = document.getElementsByTagName('blink');
for (var i = blinks.length - 1; i >= 0; i--) {
var s = blinks;
s.style.visibility = (s.style.visibility === 'visible') ? 'hidden' : 'visible';
}
window.setTimeout(blink, 1000);
}
if (document.addEventListener) document.addEventListener("DOMContentLoaded", blink, false);
else if (window.addEventListener) window.addEventListener("load", blink, false);
else if (window.attachEvent) window.attachEvent("onload", blink);
else window.onload = blink;
</script>
<script language='javascript'>
function SmileIT(smile,form,text){
document.forms[form].elements[text].value = document.forms[form].elements[text].value+" "+smile+" ";
document.forms[form].elements[text].focus();
}
</script>
<script language='javascript'><!--
function mySubmit() {
setTimeout('document.shbox.reset()',150);
}
function Smilies(Smilie)
{
document.shoutboxform.message.value+=Smilie+" ";
document.shoutboxform.message.focus();
}
//--></SCRIPT>
<?php
function quickbbshout()
{
echo "<table align='left' width='75%' border=0 cellpadding=2 cellspacing=2><tr>";
echo "<td width='75%' align='center'>";
echo "<a href=\"javascript:bbshout('', '')\"> <img src=images/shoutbox/bbcode_bold.gif alt='Bold' title='Bold' height='18px' style='vertical-align: -30%' /></a>";
echo "<a href=\"javascript:bbshout('[i]', '')\"> <img src=images/shoutbox/bbcode_italic.gif border=0 alt='Italic' title='Italic' height='18px' style='vertical-align: -30%' /></a>";
echo "<a href=\"javascript:bbshout('', '')\"> <img src=images/shoutbox/bbcode_underline.gif border=0 alt='Underline' title='Underline' height='18px' style='vertical-align: -30%' /></a>";
// echo "<a href=\"javascript:bbshout('[blink]', '[/blink]')\"> <img src=images/shoutbox/blink.png border=0 alt='blink' title='Clignotant' height='18px' style='vertical-align: -30%' /></a>";
// echo "<a href=\"javascript:bbshout('', '
')\"> <img src=images/shoutbox/df.png border=0 alt='df' title='Défilant' height='18px' style='vertical-align: -30%' /></a>";
echo "<a href=\"javascript:bbshout('[url]', '[/url]')\"> <img src=images/shoutbox/bbcode_url.gif border=0 alt='Url' title='URL link' height='18px' style='vertical-align: -30%' /></a>";
echo "
<select name='color' class='bb_icon' onChange=\"javascript:bbcolor()\">
<option selected='selected'>Color</option>
<option value='#FF0000' style='color:#FF0000'>Rouge</option>
<option value='#00FFFF' style='color:#00FFFF'>Turquoise</option>
<option value='#0000FF' style='color:#0000FF'>Bleu clair</option>
<option value='#0000A0' style='color:#0000A0'>Bleu foncé</option>
<option value='#FF0080' style='color:#FF0080'>Pourpre clair</option>
<option value='#800080' style='color:#800080'>Pourpre foncé</option>
<option value='#FFFF00' style='color:#FFFF00'>Jaune</option>
<option value='#FF8040' style='color:#FF8040'>Orange</option>
<option value='#00FF00' style='color:#00FF00'>Vert pastel</option>
<option value='#C0C0C0' style='color:#C0C0C0'>Vert clair</option>
<option value='#808000' style='color:#808000'>Vert foncé</option>
</select>";
echo "
<select name='font' class='bb_icon' onChange=\"javascript:bbfont()\">
<option selected='selected'>Font</option>
<option value='Arial'>Arial</option>
<option value='Arial Black'>Arial Black</option>
<option value='Comic Sans MS'>Comic Sans MS</option>
<option value='Courier New'>Courier New</option>
<option value='Franklin Gothic Medium'>Franklin Gothic Medium</option>
<option value='Georgia'>Georgia</option>
<option value='Helvetica'>Helvetica</option>
<option value='Impact'>Impact</option>
<option value='Lucida Console'>Lucida Console</option>
<option value='Lucida Sans Unicode'>Lucida Sans Unicode</option>
<option value='Microsoft Sans Serif'>Microsoft Sans Serif</option>
<option value='Palatino Linotype'>Palatino Linotype</option>
<option value='Tahoma' style='font-family: Tahoma;'>Tahoma</option>
<option value='Times New Roman'>Times New Roman</option>
<option value='Trebuchet MS'>Trebuchet MS</option>
<option value='Verdana'>Verdana</option>
<option value='Symbol'>Symbol</option>
</select>";
echo "
<select name='size' class='bb_icon' onChange=\"javascript:bbsize()\">
<option selected='selected'>Size</option>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
</select>";
echo "</td></tr><tr><td width='75%' align='center'>";
echo "
<a href=\"javascript: SmileIT(':)','shoutboxform','message')\"><img border=0 src=images/smilies/smile.png></a>
<a href=\"javascript: SmileIT(':(','shoutboxform','message')\"><img border=0 src=images/smilies/sad.png></a>
<a href=\"javascript: SmileIT(';)','shoutboxform','message')\"><img border=0 src=images/smilies/wink.png></a>
<a href=\"javascript: SmileIT(':P','shoutboxform','message')\"><img border=0 src=images/smilies/razz.png></a>
<a href=\"javascript: SmileIT(':D','shoutboxform','message')\"><img border=0 src=images/smilies/grin.png></a>
<a href=\"javascript: SmileIT('-|)','shoutboxform','message')\"><img border=0 src=images/smilies/plain.png></a>
<a href=\"javascript: SmileIT(':O','shoutboxform','message')\"><img border=0 src=images/smilies/suprise.png></a>
<a href=\"javascript: SmileIT(':?','shoutboxform','message')\"><img border=0 src=images/smilies/confused.png></a>
<a href=\"javascript: SmileIT('8)','shoutboxform','message')\"><img border=0 src=images/smilies/glasses.png></a>
<a href=\"javascript: SmileIT('8o','shoutboxform','message')\"><img border=0 src=images/smilies/eek.png></a>
<a href=\"javascript: SmileIT('B)','shoutboxform','message')\"><img border=0 src=images/smilies/cool.png></a>
<a href=\"javascript: SmileIT(':-)','shoutboxform','message')\"><img border=0 src=images/smilies/smile-big.png></a>
<a href=\"javascript: SmileIT(':-(','shoutboxform','message')\"><img border=0 src=images/smilies/crying.png></a>
<a href=\"javascript: SmileIT(':-*','shoutboxform','message')\"><img border=0 src=images/smilies/kiss.png></a>
<a href=\"javascript: SmileIT('O:-D','shoutboxform','message')\"><img border=0 src=images/smilies/angel.png></a>
<a href=\"javascript: SmileIT(':-@','shoutboxform','message')\"><img border=0 src=images/smilies/devilish.png></a>
<a href=\"javascript: SmileIT(':love','shoutboxform','message')\"><img border=0 src=images/smilies/love.png></a>";
echo "</td></tr></table>
<TR>
<div>
.....
</div>";
}
//ROOMS
$room = ($_REQUEST['room']) ? (int) $_REQUEST['room'] : 0;
if ( get_user_class() < "3" && $room > "0" )
$room = 0;
if ( get_user_class() < "5" && $room > "1" )
$room = 0;
function therooms()
{
$data = '<select name="room" class="bb_icon" onchange="if(this.options[this.selectedIndex].value != -1){ window.location = this.options[this.selectedIndex].value; }">
<option value="shoutbox.php?room=0" ' . ($GLOBALS['room'] == 0 ? 'selected="selected"' : null) . '>Public</option>
<option value="shoutbox.php?room=1" ' . ($GLOBALS['room'] == 1 ? 'selected="selected"' : null) . '>VIP</option>
if ( get_user_class() >= 7 )
<option value="shoutbox.php?room=2" ' . ($GLOBALS['room'] == 2 ? 'selected="selected"' : null) . '>Staff</option>
</select>';
return $data;
}
function theroomsh()
{
$data = '<select name="room" class="bb_icon" onchange="if(this.options[this.selectedIndex].value != -1){ window.location = this.options[this.selectedIndex].value; }">
<option value="shoutbox.php?history=0&room=0" ' . ($GLOBALS['room'] == 0 ? 'selected="selected"' : null) . '>Public</option>
<option value="shoutbox.php?history=0&room=1" ' . ($GLOBALS['room'] == 1 ? 'selected="selected"' : null) . '>VIP</option>
if ( get_user_class() >= 7 )
<option value="shoutbox.php?history=1&room=2" ' . ($GLOBALS['room'] == 2 ? 'selected="selected"' : null) . '>Staff</option>
</select>';
return $data;
}
if ($site_config['SHOUTBOX'] && $CURUSER) {
//EDIT MESSAGE
function linkit($al_url, $al_msg) // create autolink
{
echo "\n<meta http-equiv=\"refresh\" content=\"12; url=$al_url\">\n";
echo "<center>\n";
echo "<b>$al_msg</b>\n";
echo "\n<b>Redirection ...</b>\n";
echo "\n[ <a href='$al_url'>lien</a> ]\n";
echo "</td>\n</tr>\n</table>\n</td>\n</tr>\n</table>\n</body>\n</html>\n";
echo "</center>\n";
exit;
}
//DELETE MESSAGES
//if (isset($_GET['del'])){
//
// if (is_numeric($_GET['del'])){
// $query = "SELECT * FROM shoutbox WHERE msgid=".$_GET['del'] ;
// $result = SQL_Query_exec($query);
// }else{
// echo "invalid msg id STOP TRYING TO INJECT SQL";
// exit;
// }
//
// $row = mysqli_fetch_row($result);
//
// if ($row && ($CURUSER["edit_users"]=="yes" || $CURUSER['username'] == $row[1])) {
// $query = "DELETE FROM shoutbox WHERE msgid=".$_GET['del'] ;
// write_log("<b><font color='orange'>Shout Deleted: </font> Deleted by ".$CURUSER['username']."</b>");
// SQL_Query_exec($query);
// }
//}
//INSERT MESSAGE
if (!empty($_POST['message']) && $CURUSER) {
$_POST['message'] = sqlesc($_POST['message']);
$query = "SELECT COUNT(*) FROM shoutbox WHERE message=" . $_POST['message'] . " AND user='" . class_user($CURUSER["username"]) . "' AND UNIX_TIMESTAMP('" . get_date_time() . "')-UNIX_TIMESTAMP(date) < 30";
$result = SQL_Query_exec($query);
$row = mysqli_fetch_row($result);
if ($row[0] == '0') {
$query = "INSERT INTO shoutbox (msgid, user, message, date, userid, room) VALUES (NULL, '" . $CURUSER['username'] . "', " . $_POST['message'] . ", '" . get_date_time() . "', '" . $CURUSER['id'] . "', '" . (int) $_POST['room'] . "')";
SQL_Query_exec($query);
}
}
//GET CURRENT USERS THEME AND LANGUAGE
if ($CURUSER) {
$ss_a = @mysqli_fetch_assoc(@SQL_Query_exec("select uri from stylesheets where id=" . $CURUSER["stylesheet"]));
if ($ss_a)
$THEME = $ss_a["uri"];
} else { //not logged in so get default theme/language
$ss_a = mysqli_fetch_assoc(SQL_Query_exec("select uri from stylesheets where id='" . $site_config['default_theme'] . "'"));
if ($ss_a)
$THEME = $ss_a["uri"];
}
if (!isset($_GET['history'])) {
?>
<html>
<head>
<title><?php
echo $site_config['SITENAME'] . T_("SHOUTBOX");
?></title>
<?php
/* If you do change the refresh interval, you should also change index.php printf(T_("SHOUTBOX_REFRESH"), 10) the 5 is in minutes */
?>
<meta http-equiv="refresh" content="120" />
<link rel="stylesheet" type="text/css" href="<?php echo $site_config['SITEURL'];?>/themes/<?php echo $THEME;?>/theme.css" /><script type="text/javascript" src="<?php echo $site_config['SITEURL'];?>/backend/java_klappe.js"></script>
</head>
<body class="shoutbox_body">
<?php
echo '<div class="shoutbox_contain"><table border="0" style="width: 99%; table-layout:fixed">';
//rooms
if (get_user_class() >= 3) {
echo '<div align="right">Chat Room: ';
echo therooms();
echo '</div>';
}
//rooms
} else {
if ($site_config["MEMBERSONLY"]) {
loggedinonly();
}
stdhead();
begin_frame(T_("SHOUTBOX_HISTORY"));
//rooms
if (get_user_class() >= 3) {
echo '<div align="right">Chat Room: ';
echo theroomsh();
echo '</div>';
}
//rooms
echo '<div class="shoutbox_history">';
$query = 'SELECT COUNT(*) FROM shoutbox WHERE room = ".$room."';
$result = SQL_Query_exec($query);
$row = mysqli_fetch_row($result);
$pages = round($row[0] / 100) + 1;
$i = 1;
echo '<div align="center">';
while ($pages > 0 && $row["room"] == $room) {
echo "<a href='" . $site_config['SITEURL'] . "/shoutbox.php?history=1&room=" . $room . "&page=" . $i . "'>[" . $i . "]</a> ";
$i++;
$pages--;
}
echo '</div><br /><table border="0" style="width: 99%; table-layout:fixed">';
}
if (isset($_GET['history'])) {
if (isset($_GET['page'])) {
if ($_GET['page'] > '1') {
$lowerlimit = $_GET['page'] * 100 - 100;
$upperlimit = $_GET['page'] * 100;
} else {
$lowerlimit = 0;
$upperlimit = 100;
}
} else {
$lowerlimit = 0;
$upperlimit = 100;
}
$query = 'SELECT s.* FROM shoutbox s INNER JOIN users u ON u.id = s.userid AND s.room = ' . $room . ' ORDER BY s.msgid DESC LIMIT ' . $lowerlimit . ',' . $upperlimit;
} else {
$query = 'SELECT s.* FROM shoutbox s INNER JOIN users u ON u.id = s.userid AND s.room = ' . $room . ' ORDER BY s.msgid DESC LIMIT 20';
}
$donated = ($CURUSER["donated"]);
$userdownloaded = mksize($CURUSER["downloaded"]);
$useruploaded = mksize($CURUSER["uploaded"]);
$privacylevel = $CURUSER["privacy"];
if ($CURUSER["downloaded"] > 0) {
$userratio = number_format($CURUSER["uploaded"] / $CURUSER["downloaded"], 2);
}else{
$userratio = "---";
}
print ("<br>
<div align='center'>
<img src='images/leech.png' title='Downloaded'> :
<font size=4 color=#f55c65>
$userdownloaded
</font>
<font size=4 color=#3790ba>
<-Vos statistiques->
</font>
<img src='images/seed.png' title='Uploaded'> :
<font size=4 color=#4fdf19>
$useruploaded
</font>
<font size=4 color=#3790ba> [
". Ratio .":
$userratio ]
</font>
<br><br>
");
$result = SQL_Query_exec($query);
$alt = false;
while ($row = mysqli_fetch_assoc($result)) {
if ($alt) {
echo '<tr class="shoutbox_noalt">';
$alt = false;
} else {
echo '<tr class="shoutbox_alt">';
$alt = true;
}
echo '<td style="font-size: 9px; width: 95px;">';
echo "<div align='left' style='float: left'>";
echo date('d/m H:i', utc_to_tz_time($row['date']));
echo "</div>";
if ( ($CURUSER["edit_users"]=="yes") || ($CURUSER['username'] == ($row['user'])) ){
echo "<div align='right' style='float: right'><a href='".$site_config['SITEURL']."/shoutedit.php?action=edit&msgid=".$row['msgid']."' style='font-size: 8px'><img src='images/shoutbox/shout_edit.png'></a> <a href='".$site_config['SITEURL']."/shoutedit.php?action=delete&msgid=".$row['msgid']."' style='font-size: 8px'><img src='images/shoutbox/shout_delete.png'></a> ".$av."<div>";
//echo "<div align='right' style='float: right'><a href='".$site_config['SITEURL']."/shoutbox.php?del=".$row['msgid']."' style='font-size: 8px'>[D]</a></div>";
}
echo "<div align='right' style='float: right'></div>";
echo '</td><td style="font-size: 12px; padding-left: 5px"><a href="'.$site_config['SITEURL'].'/account-details.php?id='.$row['userid'].'" target="_parent"><b>'.class_user($row['user']).':</b></a> '.nl2br(format_comment($row['message']));
echo '</td></tr>';
}
?>
</table>
</div>
<br />
<?php
//if the user is logged in, show the shoutbox, if not, dont.
if (!isset($_GET['history'])) {
if (isset($_COOKIE["pass"])) {
echo "<form name='shoutboxform' action='shoutbox.php' method='post'>";
echo "<center><table width='100%' border='0' cellpadding='1' cellspacing='1'>";
echo "<tr class='shoutbox_messageboxback'>";
echo "<td width='75%' align='center'>";
echo "<input type='hidden' name='room' value=$room />";
echo "<input type='text' name='message' class='shoutbox_msgbox' />";
echo "</td>";
echo "<td>";
echo " <input type='submit' name='submit' value='" . T_("SHOUT") . "' class='shoutbox_shoutbtn' />";
echo "</td>";
echo "<td>";
echo "<a href='shoutbox.php?room=$room'><small>".T_("REFRESH")."</small></a>";
echo " <small>-</small> <a href='" . $site_config['SITEURL'] . "/shoutbox.php?history=1&room=$room' target='_blank'><small>".T_("HISTORY")."</small></a>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo quickbbshout();
echo "</center></form>";
} else {
echo "<br /><div class='shoutbox_error'>" . T_("SHOUTBOX_MUST_LOGIN") . "</div>";
}
}
if (!isset($_GET['history'])) {
echo "</body></html>";
} else {
end_frame();
stdfoot();
}
} //END IF $SHOUTBOX
else {
echo T_("SHOUTBOX_DISABLED");
}
?>